Skip to content

Commit 5fb2d56

Browse files
committed
[AMDGPU] Introduce a "new" target feature xf32-insts (llvm#115214)
The feature itself is not new. Just to use it to guard corresponding instructions. No test is needed, like its parent PR. (cherry picked from commit 9a43ae5) Change-Id: Iaba20594671acbbd6e5f0d58143d770d3806f821
1 parent 636061a commit 5fb2d56

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,13 @@ def FeatureRequiresCOV6 : SubtargetFeature<"requires-cov6",
10971097
"Target Requires Code Object V6"
10981098
>;
10991099

1100+
def FeatureXF32Insts : SubtargetFeature<"xf32-insts",
1101+
"HasXF32Insts",
1102+
"true",
1103+
"Has instructions that support xf32 format, such as "
1104+
"v_mfma_f32_16x16x8_xf32 and v_mfma_f32_32x32x4_xf32"
1105+
>;
1106+
11001107
// Dummy feature used to disable assembler instructions.
11011108
def FeatureDisable : SubtargetFeature<"",
11021109
"FeatureDisable","true",
@@ -1429,6 +1436,7 @@ def FeatureISAVersion9_4_Common : FeatureSet<
14291436
FeatureFP8Insts,
14301437
FeatureFP8ConversionInsts,
14311438
FeaturePkFmacF16Inst,
1439+
FeatureXF32Insts,
14321440
FeatureAtomicFaddRtnInsts,
14331441
FeatureAtomicFaddNoRtnInsts,
14341442
FeatureAtomicBufferGlobalPkAddF16Insts,
@@ -2264,6 +2272,9 @@ def HasAtomicCSubNoRtnInsts : Predicate<"Subtarget->hasAtomicCSubNoRtnInsts()">;
22642272

22652273
def HasScalarDwordx3Loads : Predicate<"Subtarget->hasScalarDwordx3Loads()">;
22662274

2275+
def HasXF32Insts : Predicate<"Subtarget->hasXF32Insts()">,
2276+
AssemblerPredicate<(all_of FeatureXF32Insts)>;
2277+
22672278
// Include AMDGPU TD files
22682279
include "SISchedule.td"
22692280
include "GCNProcessors.td"

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
178178
bool HasDefaultComponentZero = false;
179179
bool HasAgentScopeFineGrainedRemoteMemoryAtomics = false;
180180
bool HasDefaultComponentBroadcast = false;
181+
bool HasXF32Insts = false;
181182
/// The maximum number of instructions that may be placed within an S_CLAUSE,
182183
/// which is one greater than the maximum argument to S_CLAUSE. A value of 0
183184
/// indicates a lack of S_CLAUSE support.
@@ -1292,6 +1293,9 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
12921293
return getGeneration() == GFX12;
12931294
}
12941295

1296+
/// \returns true if the target has instructions with xf32 format support.
1297+
bool hasXF32Insts() const { return HasXF32Insts; }
1298+
12951299
/// \returns The maximum number of instructions that can be enclosed in an
12961300
/// S_CLAUSE on the given subtarget, or 0 for targets that do not support that
12971301
/// instruction.

llvm/lib/Target/AMDGPU/VOP3PInstructions.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,12 @@ let Predicates = [isGFX90APlus] in {
761761
let SubtargetPredicate = isGFX940Plus, is_gfx940_xdl = 1 in {
762762
defm V_MFMA_I32_32X32X16I8 : MAIInst<"v_mfma_i32_32x32x16i8", "I32_I64_X32", int_amdgcn_mfma_i32_32x32x16_i8>;
763763
defm V_MFMA_I32_16X16X32I8 : MAIInst<"v_mfma_i32_16x16x32i8", "I32_I64_X16", int_amdgcn_mfma_i32_16x16x32_i8>;
764+
} // End SubtargetPredicate = isGFX940Plus, is_gfx940_xdl = 1
765+
766+
let SubtargetPredicate = HasXF32Insts, is_gfx940_xdl = 1 in {
764767
defm V_MFMA_F32_16X16X8XF32 : MAIInst<"v_mfma_f32_16x16x8xf32", "F32_V2F32_X16", int_amdgcn_mfma_f32_16x16x8_xf32>;
765768
defm V_MFMA_F32_32X32X4XF32 : MAIInst<"v_mfma_f32_32x32x4xf32", "F32_V2F32_X32", int_amdgcn_mfma_f32_32x32x4_xf32>;
766-
767-
} // End SubtargetPredicate = isGFX940Plus, is_gfx940_xdl = 1
769+
} // End SubtargetPredicate = HasXF32Insts, is_gfx940_xdl = 1
768770

769771
let SubtargetPredicate = HasFP8Insts, is_gfx940_xdl = 1 in {
770772
defm V_MFMA_F32_16X16X32_BF8_BF8 : MAIInst<"v_mfma_f32_16x16x32_bf8_bf8", "F32_I64_X32", int_amdgcn_mfma_f32_16x16x32_bf8_bf8>;
@@ -1768,8 +1770,10 @@ defm V_MFMA_F64_4X4X4F64 : VOP3P_Real_MFMA_gfx90a <0x6f>;
17681770

17691771
defm V_MFMA_I32_32X32X16I8 : VOP3P_Real_MFMA_gfx940 <0x56, "v_mfma_i32_32x32x16_i8">;
17701772
defm V_MFMA_I32_16X16X32I8 : VOP3P_Real_MFMA_gfx940 <0x57, "v_mfma_i32_16x16x32_i8">;
1773+
let SubtargetPredicate = HasXF32Insts in {
17711774
defm V_MFMA_F32_16X16X8XF32 : VOP3P_Real_MFMA_gfx940 <0x3e, "v_mfma_f32_16x16x8_xf32">;
17721775
defm V_MFMA_F32_32X32X4XF32 : VOP3P_Real_MFMA_gfx940 <0x3f, "v_mfma_f32_32x32x4_xf32">;
1776+
} // End SubtargetPredicate = HasXF32Insts
17731777
let SubtargetPredicate = HasFP8Insts in {
17741778
defm V_MFMA_F32_16X16X32_BF8_BF8 : VOP3P_Real_MFMA_gfx940 <0x70>;
17751779
defm V_MFMA_F32_16X16X32_BF8_FP8 : VOP3P_Real_MFMA_gfx940 <0x71>;

0 commit comments

Comments
 (0)