Skip to content

Commit cc1141a

Browse files
committed
Merge branch 'main' into ms_amxMovrs
2 parents 193420c + 4c4db3c commit cc1141a

File tree

207 files changed

+4800
-1246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+4800
-1246
lines changed

clang/docs/AMDGPUSupport.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ Predefined Macros
5050
* - ``__AMDGCN_UNSAFE_FP_ATOMICS__``
5151
- Defined if unsafe floating-point atomics are allowed.
5252
* - ``__AMDGCN_WAVEFRONT_SIZE__``
53-
- Defines the wavefront size. Allowed values are 32 and 64.
53+
- Defines the wavefront size. Allowed values are 32 and 64 (deprecated).
5454
* - ``__AMDGCN_WAVEFRONT_SIZE``
55-
- Alias to ``__AMDGCN_WAVEFRONT_SIZE__``. To be deprecated.
55+
- Alias to ``__AMDGCN_WAVEFRONT_SIZE__`` (deprecated).
5656
* - ``__HAS_FMAF__``
5757
- Defined if FMAF instruction is available (deprecated).
5858
* - ``__HAS_LDEXPF__``

clang/docs/HIPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ Predefined Macros
178178

179179
Note that some architecture specific AMDGPU macros will have default values when
180180
used from the HIP host compilation. Other :doc:`AMDGPU macros <AMDGPUSupport>`
181-
like ``__AMDGCN_WAVEFRONT_SIZE__`` will default to 64 for example.
181+
like ``__AMDGCN_WAVEFRONT_SIZE__`` (deprecated) will default to 64 for example.
182182

183183
Compilation Modes
184184
=================

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ X86 Support
741741
- Support ISA of ``AMX-TRANSPOSE``.
742742
- Support ISA of ``AMX-MOVRS``.
743743
- Support ISA of ``AMX-AVX512``.
744+
- Support ISA of ``AMX-TF32``.
744745

745746
Arm and AArch64 Support
746747
^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/BuiltinsX86_64.def

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ TARGET_BUILTIN(__builtin_ia32_tcvtrowps2pbf16l_internal, "V32yUsUsV256iUi", "n",
146146
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2phh_internal, "V32xUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
147147
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2phl_internal, "V32xUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
148148
TARGET_BUILTIN(__builtin_ia32_tilemovrow_internal, "V16iUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
149+
TARGET_BUILTIN(__builtin_ia32_tmmultf32ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-tf32")
150+
TARGET_BUILTIN(__builtin_ia32_ttmmultf32ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-tf32,amx-transpose")
151+
149152
// AMX
150153
TARGET_BUILTIN(__builtin_ia32_tile_loadconfig, "vvC*", "n", "amx-tile")
151154
TARGET_BUILTIN(__builtin_ia32_tile_storeconfig, "vvC*", "n", "amx-tile")
@@ -186,10 +189,6 @@ TARGET_BUILTIN(__builtin_ia32_tcvtrowps2phh, "V32xIUcUi", "n", "amx-avx512,avx10
186189
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2phl, "V32xIUcUi", "n", "amx-avx512,avx10.2-512")
187190
TARGET_BUILTIN(__builtin_ia32_tilemovrow, "V16iIUcUi", "n", "amx-avx512,avx10.2-512")
188191

189-
TARGET_BUILTIN(__builtin_ia32_prefetchi, "vvC*Ui", "nc", "prefetchi")
190-
TARGET_BUILTIN(__builtin_ia32_cmpccxadd32, "Siv*SiSiIi", "n", "cmpccxadd")
191-
TARGET_BUILTIN(__builtin_ia32_cmpccxadd64, "SLLiSLLi*SLLiSLLiIi", "n", "cmpccxadd")
192-
193192
// AMX_FP16 FP16
194193
TARGET_BUILTIN(__builtin_ia32_tdpfp16ps, "vIUcIUcIUc", "n", "amx-fp16")
195194

@@ -199,6 +198,14 @@ TARGET_BUILTIN(__builtin_ia32_tdpbhf8ps, "vIUcUIcUIc", "n", "amx-fp8")
199198
TARGET_BUILTIN(__builtin_ia32_tdphbf8ps, "vIUcUIcUIc", "n", "amx-fp8")
200199
TARGET_BUILTIN(__builtin_ia32_tdphf8ps, "vIUcUIcUIc", "n", "amx-fp8")
201200

201+
// AMX TF32
202+
TARGET_BUILTIN(__builtin_ia32_tmmultf32ps, "vIUcIUcIUc", "n", "amx-tf32")
203+
TARGET_BUILTIN(__builtin_ia32_ttmmultf32ps, "vIUcIUcIUc", "n", "amx-tf32,amx-transpose")
204+
205+
TARGET_BUILTIN(__builtin_ia32_prefetchi, "vvC*Ui", "nc", "prefetchi")
206+
TARGET_BUILTIN(__builtin_ia32_cmpccxadd32, "Siv*SiSiIi", "n", "cmpccxadd")
207+
TARGET_BUILTIN(__builtin_ia32_cmpccxadd64, "SLLiSLLi*SLLiSLLiIi", "n", "cmpccxadd")
208+
202209
// RAO-INT
203210
TARGET_BUILTIN(__builtin_ia32_aadd64, "vv*SOi", "n", "raoint")
204211
TARGET_BUILTIN(__builtin_ia32_aand64, "vv*SOi", "n", "raoint")

clang/include/clang/Basic/MacroBuilder.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ class MacroBuilder {
2626
MacroBuilder(raw_ostream &Output) : Out(Output) {}
2727

2828
/// Append a \#define line for macro of the form "\#define Name Value\n".
29-
void defineMacro(const Twine &Name, const Twine &Value = "1") {
29+
/// If DeprecationMsg is provided, also append a pragma to deprecate the
30+
/// defined macro.
31+
void defineMacro(const Twine &Name, const Twine &Value = "1",
32+
Twine DeprecationMsg = "") {
3033
Out << "#define " << Name << ' ' << Value << '\n';
34+
if (!DeprecationMsg.isTriviallyEmpty())
35+
Out << "#pragma clang deprecated(" << Name << ", \"" << DeprecationMsg
36+
<< "\")\n";
3137
}
3238

3339
/// Append a \#undef line for Name. Name should be of the form XXX

clang/include/clang/Basic/arm_sve.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,9 @@ def SVRSQRTS : SInst<"svrsqrts[_{d}]", "ddd", "hfd", MergeNone, "aarch64_sve_frs
880880
////////////////////////////////////////////////////////////////////////////////
881881
// Floating-point reductions
882882

883-
def SVFADDA : SInst<"svadda[_{d}]", "sPsd", "hfd", MergeNone, "aarch64_sve_fadda", [VerifyRuntimeMode]>;
883+
let SVETargetGuard = "sve", SMETargetGuard = InvalidMode in {
884+
def SVFADDA : SInst<"svadda[_{d}]", "sPsd", "hfd", MergeNone, "aarch64_sve_fadda">;
885+
}
884886
def SVFADDV : SInst<"svaddv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_faddv", [VerifyRuntimeMode]>;
885887
def SVFMAXV : SInst<"svmaxv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fmaxv", [VerifyRuntimeMode]>;
886888
def SVFMAXNMV : SInst<"svmaxnmv[_{d}]", "sPd", "hfd", MergeNone, "aarch64_sve_fmaxnmv", [VerifyRuntimeMode]>;

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6297,6 +6297,8 @@ def mamx_int8 : Flag<["-"], "mamx-int8">, Group<m_x86_Features_Group>;
62976297
def mno_amx_int8 : Flag<["-"], "mno-amx-int8">, Group<m_x86_Features_Group>;
62986298
def mamx_fp8 : Flag<["-"], "mamx-fp8">, Group<m_x86_Features_Group>;
62996299
def mno_amx_fp8 : Flag<["-"], "mno-amx-fp8">, Group<m_x86_Features_Group>;
6300+
def mamx_tf32 : Flag<["-"], "mamx-tf32">, Group<m_x86_Features_Group>;
6301+
def mno_amx_tf32 : Flag<["-"], "mno-amx-tf32">, Group<m_x86_Features_Group>;
63006302
def mamx_tile : Flag<["-"], "mamx-tile">, Group<m_x86_Features_Group>;
63016303
def mno_amx_tile : Flag<["-"], "mno-amx-tile">, Group<m_x86_Features_Group>;
63026304
def mamx_transpose : Flag<["-"], "mamx-transpose">, Group<m_x86_Features_Group>;

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,12 @@ void AMDGPUTargetInfo::getTargetDefines(const LangOptions &Opts,
337337
if (hasFastFMA())
338338
Builder.defineMacro("FP_FAST_FMA");
339339

340-
Builder.defineMacro("__AMDGCN_WAVEFRONT_SIZE__", Twine(WavefrontSize));
341-
// ToDo: deprecate this macro for naming consistency.
342-
Builder.defineMacro("__AMDGCN_WAVEFRONT_SIZE", Twine(WavefrontSize));
340+
Builder.defineMacro("__AMDGCN_WAVEFRONT_SIZE__", Twine(WavefrontSize),
341+
"compile-time-constant access to the wavefront size will "
342+
"be removed in a future release");
343+
Builder.defineMacro("__AMDGCN_WAVEFRONT_SIZE", Twine(WavefrontSize),
344+
"compile-time-constant access to the wavefront size will "
345+
"be removed in a future release");
343346
Builder.defineMacro("__AMDGCN_CUMODE__", Twine(CUMode));
344347
}
345348

clang/lib/Basic/Targets/X86.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
436436
HasAMXTRANSPOSE = true;
437437
} else if (Feature == "+amx-avx512") {
438438
HasAMXAVX512 = true;
439+
} else if (Feature == "+amx-tf32") {
440+
HasAMXTF32 = true;
439441
} else if (Feature == "+cmpccxadd") {
440442
HasCMPCCXADD = true;
441443
} else if (Feature == "+raoint") {
@@ -963,6 +965,8 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
963965
Builder.defineMacro("__AMX_TRANSPOSE__");
964966
if (HasAMXAVX512)
965967
Builder.defineMacro("__AMX_AVX512__");
968+
if (HasAMXTF32)
969+
Builder.defineMacro("__AMX_TF32__");
966970
if (HasCMPCCXADD)
967971
Builder.defineMacro("__CMPCCXADD__");
968972
if (HasRAOINT)
@@ -1095,6 +1099,7 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const {
10951099
.Case("amx-fp8", true)
10961100
.Case("amx-int8", true)
10971101
.Case("amx-movrs", true)
1102+
.Case("amx-tf32", true)
10981103
.Case("amx-tile", true)
10991104
.Case("amx-transpose", true)
11001105
.Case("avx", true)
@@ -1217,6 +1222,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const {
12171222
.Case("amx-fp8", HasAMXFP8)
12181223
.Case("amx-int8", HasAMXINT8)
12191224
.Case("amx-movrs", HasAMXMOVRS)
1225+
.Case("amx-tf32", HasAMXTF32)
12201226
.Case("amx-tile", HasAMXTILE)
12211227
.Case("amx-transpose", HasAMXTRANSPOSE)
12221228
.Case("avx", SSELevel >= AVX)

clang/lib/Basic/Targets/X86.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
161161
bool HasAMXMOVRS = false;
162162
bool HasAMXTRANSPOSE = false;
163163
bool HasAMXAVX512 = false;
164+
bool HasAMXTF32 = false;
164165
bool HasSERIALIZE = false;
165166
bool HasTSXLDTRK = false;
166167
bool HasUSERMSR = false;

0 commit comments

Comments
 (0)