Skip to content

Commit 3134e69

Browse files
authored
AMDGPU: Add target feature for aligned VGPR requirement (#155336)
This now applies to gfx90a+ and gfx1250, so add a dedicated feature for it so the feature check can be composed correctly with unrelated properties. Probably would be better to invert this, but that turns out to be difficult given the current assumptions.
1 parent 8c692b4 commit 3134e69

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,12 @@ def FeatureGFX9Insts : SubtargetFeature<"gfx9-insts",
419419
"Additional instructions for GFX9+"
420420
>;
421421

422+
def FeatureRequiresAlignedVGPRs : SubtargetFeature<"vgpr-align2",
423+
"RequiresAlignVGPR",
424+
"true",
425+
"VGPR and AGPR tuple operands require even alignment"
426+
>;
427+
422428
def FeatureGFX90AInsts : SubtargetFeature<"gfx90a-insts",
423429
"GFX90AInsts",
424430
"true",
@@ -1721,6 +1727,7 @@ def FeatureISAVersion9_0_9 : FeatureSet<
17211727
def FeatureISAVersion9_0_A : FeatureSet<
17221728
!listconcat(FeatureISAVersion9_0_MI_Common.Features,
17231729
[FeatureGFX90AInsts,
1730+
FeatureRequiresAlignedVGPRs,
17241731
FeatureFmacF64Inst,
17251732
FeatureDPALU_DPP,
17261733
FeaturePackedFP32Ops,
@@ -1743,6 +1750,7 @@ def FeatureISAVersion9_4_Common : FeatureSet<
17431750
[FeatureGFX9,
17441751
FeatureGFX90AInsts,
17451752
FeatureGFX940Insts,
1753+
FeatureRequiresAlignedVGPRs,
17461754
FeatureFmaMixInsts,
17471755
FeatureLDSBankCount32,
17481756
FeatureDLInsts,
@@ -2019,6 +2027,7 @@ def FeatureISAVersion12 : FeatureSet<
20192027
def FeatureISAVersion12_50 : FeatureSet<
20202028
[FeatureGFX12,
20212029
FeatureGFX1250Insts,
2030+
FeatureRequiresAlignedVGPRs,
20222031
FeatureCUStores,
20232032
FeatureAddressableLocalMemorySize327680,
20242033
FeatureCuMode,

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
198198
bool DynamicVGPR = false;
199199
bool DynamicVGPRBlockSize32 = false;
200200
bool HasVMemToLDSLoad = false;
201+
bool RequiresAlignVGPR = false;
201202

202203
// This should not be used directly. 'TargetID' tracks the dynamic settings
203204
// for SRAMECC.
@@ -1350,7 +1351,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
13501351
}
13511352

13521353
/// Return if operations acting on VGPR tuples require even alignment.
1353-
bool needsAlignedVGPRs() const { return GFX90AInsts || GFX1250Insts; }
1354+
bool needsAlignedVGPRs() const { return RequiresAlignVGPR; }
13541355

13551356
/// Return true if the target has the S_PACK_HL_B32_B16 instruction.
13561357
bool hasSPackHL() const { return GFX11Insts; }

0 commit comments

Comments
 (0)