Skip to content

Commit

Permalink
Disable clang inline asm workaround for clang-14 and later (pytorch#861)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#861

clang-14 will improve handling of inline assembly when `-masm=intel` is used (https://reviews.llvm.org/D113707)

The workaround used so far used for clang will no longer be necessary for clang-14 and triggers a syntax error.

Reviewed By: efiks

Differential Revision: D33553604

fbshipit-source-id: d036628f1cd7deb60e0bdebee25c95a7020cb38d
  • Loading branch information
MatzeB authored and facebook-github-bot committed Jan 13, 2022
1 parent 9d7c48a commit 135412d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
12 changes: 6 additions & 6 deletions src/FbgemmFP16UKernelsAvx2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace fbgemm {

void NOINLINE gemmkernel_1x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -132,7 +132,7 @@ void NOINLINE gemmkernel_1x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_2x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -275,7 +275,7 @@ void NOINLINE gemmkernel_2x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_3x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -437,7 +437,7 @@ void NOINLINE gemmkernel_3x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_4x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -618,7 +618,7 @@ void NOINLINE gemmkernel_4x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_5x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -818,7 +818,7 @@ void NOINLINE gemmkernel_5x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_6x2_Avx2_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down
28 changes: 14 additions & 14 deletions src/FbgemmFP16UKernelsAvx512.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace fbgemm {

void NOINLINE gemmkernel_1x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -132,7 +132,7 @@ void NOINLINE gemmkernel_1x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_2x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -275,7 +275,7 @@ void NOINLINE gemmkernel_2x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_3x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -437,7 +437,7 @@ void NOINLINE gemmkernel_3x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_4x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -618,7 +618,7 @@ void NOINLINE gemmkernel_4x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_5x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -818,7 +818,7 @@ void NOINLINE gemmkernel_5x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_6x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1037,7 +1037,7 @@ void NOINLINE gemmkernel_6x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_7x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1275,7 +1275,7 @@ void NOINLINE gemmkernel_7x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_8x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1532,7 +1532,7 @@ void NOINLINE gemmkernel_8x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_9x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1808,7 +1808,7 @@ void NOINLINE gemmkernel_9x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_10x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -2103,7 +2103,7 @@ void NOINLINE gemmkernel_10x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_11x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -2417,7 +2417,7 @@ void NOINLINE gemmkernel_11x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_12x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -2750,7 +2750,7 @@ void NOINLINE gemmkernel_12x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_13x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -3102,7 +3102,7 @@ void NOINLINE gemmkernel_13x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_14x2_Avx512_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down
16 changes: 8 additions & 8 deletions src/FbgemmFP16UKernelsAvx512_256.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace fbgemm {

void NOINLINE gemmkernel_7x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -248,7 +248,7 @@ void NOINLINE gemmkernel_7x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_8x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -505,7 +505,7 @@ void NOINLINE gemmkernel_8x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_9x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -781,7 +781,7 @@ void NOINLINE gemmkernel_9x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_10x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1076,7 +1076,7 @@ void NOINLINE gemmkernel_10x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_11x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1390,7 +1390,7 @@ void NOINLINE gemmkernel_11x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_12x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -1723,7 +1723,7 @@ void NOINLINE gemmkernel_12x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_13x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down Expand Up @@ -2075,7 +2075,7 @@ void NOINLINE gemmkernel_13x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
}
void NOINLINE gemmkernel_14x2_Avx512_256_fp16_fA0fB0fC0(GemmParamsFP16* gp) {
asm volatile(
#if !defined(__clang__)
#if !defined(__clang__) || __clang_major__ >= 14
"mov r14, %[gp]\t\n"
#else
"mov %[gp], %%r14\t\n"
Expand Down
2 changes: 1 addition & 1 deletion src/codegen_fp16fp32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ int main(int argc, const char* argv[]) {

srcfile << " asm volatile(\n";

srcfile << "#if !defined(__clang__)"
srcfile << "#if !defined(__clang__) || __clang_major__ >= 14"
<< "\n";
addi(srcfile, "mov r14, %[gp]");
srcfile << "#else\n";
Expand Down

0 comments on commit 135412d

Please sign in to comment.