https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/204514
This reverts commit f4caa0a172d96597c375e6b6b2192c289723a6b9. This feature was added to gfx12-5-generic only, which does not make sense given that both gxf1250 and gfx1251 have the same unconditional xnack handling. It also does not make sense to diagnose trying to use a specific xnack mode on the generic target only, and only from the backend. The current feature management is a confusing mess, given that we have 2 parallel feature systems. AMDGPUTargetParser has a table containing a bitmask of features, which already contained FEATURE_XNACK_ALWAYS for gfx1250/gfx1251, but not gfx12-5-generic. Add this handling there so the sanitizer detection is consistent on the generic target. These 2 feature tables probably should be unified in some way. We also probably should have a subtarget feature for the xnack handling, but it should be inverted. xnack-any-only is an antifeature, in that it removes functionality from the base target. It would be better to invert this, so all of the older targets support configurable xnack modes. >From 4c94fd83c23c0478e6906321f9d06d9e7bfde41a Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Thu, 18 Jun 2026 07:45:21 +0200 Subject: [PATCH] AMDGPU: Remove xnack-any-only subtarget feature and handling This reverts commit f4caa0a172d96597c375e6b6b2192c289723a6b9. This feature was added to gfx12-5-generic only, which does not make sense given that both gxf1250 and gfx1251 have the same unconditional xnack handling. It also does not make sense to diagnose trying to use a specific xnack mode on the generic target only, and only from the backend. The current feature management is a confusing mess, given that we have 2 parallel feature systems. AMDGPUTargetParser has a table containing a bitmask of features, which already contained FEATURE_XNACK_ALWAYS for gfx1250/gfx1251, but not gfx12-5-generic. Add this handling there so the sanitizer detection is consistent on the generic target. These 2 feature tables probably should be unified in some way. We also probably should have a subtarget feature for the xnack handling, but it should be inverted. xnack-any-only is an antifeature, in that it removes functionality from the base target. It would be better to invert this, so all of the older targets support configurable xnack modes. --- .../rocm/amdgcn/bitcode/oclc_isa_version_12-5-generic.bc | 0 clang/test/Driver/hip-sanitize-options.hip | 5 +++++ llvm/include/llvm/TargetParser/AMDGPUTargetParser.def | 2 +- llvm/lib/Target/AMDGPU/AMDGPU.td | 5 ----- llvm/lib/Target/AMDGPU/GCNSubtarget.cpp | 4 ---- llvm/test/CodeGen/AMDGPU/gfx12-5-generic-no-xnack.ll | 9 --------- 6 files changed, 6 insertions(+), 19 deletions(-) create mode 100644 clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_12-5-generic.bc delete mode 100644 llvm/test/CodeGen/AMDGPU/gfx12-5-generic-no-xnack.ll diff --git a/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_12-5-generic.bc b/clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_12-5-generic.bc new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/clang/test/Driver/hip-sanitize-options.hip b/clang/test/Driver/hip-sanitize-options.hip index e7b315711b216..16eccf4a76013 100644 --- a/clang/test/Driver/hip-sanitize-options.hip +++ b/clang/test/Driver/hip-sanitize-options.hip @@ -8,6 +8,11 @@ // RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ // RUN: %s 2>&1 | FileCheck -check-prefixes=NORDC %s +// RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx12-5-generic \ +// RUN: -fsanitize=address \ +// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ +// RUN: %s 2>&1 | FileCheck -check-prefixes=NORDC %s + // RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx900:xnack+ \ // RUN: -fsanitize=address -fno-gpu-sanitize \ // RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \ diff --git a/llvm/include/llvm/TargetParser/AMDGPUTargetParser.def b/llvm/include/llvm/TargetParser/AMDGPUTargetParser.def index 191b8e4672082..64fafe7b9f3ea 100644 --- a/llvm/include/llvm/TargetParser/AMDGPUTargetParser.def +++ b/llvm/include/llvm/TargetParser/AMDGPUTargetParser.def @@ -146,7 +146,7 @@ AMDGCN_GPU ("gfx10-3-generic", GK_GFX10_3_GENERIC, (10, 3, 0), FEATURE_FAST AMDGCN_GPU ("gfx11-generic", GK_GFX11_GENERIC, (11, 0, 3), FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_WGP) AMDGCN_GPU ("gfx12-generic", GK_GFX12_GENERIC, (12, 0, 0), FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_WGP) AMDGCN_GPU ("gfx9-4-generic", GK_GFX9_4_GENERIC, ( 9, 4, 0), FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK|FEATURE_SRAMECC) -AMDGCN_GPU ("gfx12-5-generic", GK_GFX12_5_GENERIC, (12, 5, 0), FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32) +AMDGCN_GPU ("gfx12-5-generic", GK_GFX12_5_GENERIC, (12, 5, 0), FEATURE_FAST_FMA_F32|FEATURE_FAST_DENORMAL_F32|FEATURE_WAVE32|FEATURE_XNACK_ALWAYS) #undef AMDGCN_GPU #undef AMDGCN_GPU_ALIAS diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td index c517155a71ec5..0ae993fe9cd9c 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -207,10 +207,6 @@ def FeatureSupportsXNACK : SubtargetFeature<"xnack-support", "Hardware supports XNACK" >; -defm XNACKAnyOnly : AMDGPUSubtargetFeature<"xnack-any-only", - "Target only supports XnackSetting to be Any" ->; - // XNACK is disabled if SH_MEM_CONFIG.ADDRESS_MODE = GPUVM on chips that support // XNACK. The current default kernel driver setting is: // - graphics ring: XNACK disabled @@ -2258,7 +2254,6 @@ def FeatureISAVersion12_5_Generic: FeatureSet< [FeatureAddressableLocalMemorySize327680, FeatureSetregVGPRMSBFixup, FeatureRequiresCOV6, - FeatureXNACKAnyOnly, FeatureGFX125xLowestRateWMMA])>; def FeatureISAVersion13 : FeatureSet< diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp b/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp index 622a28312fa21..081f8c94738d6 100644 --- a/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp +++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp @@ -174,10 +174,6 @@ void GCNSubtarget::checkSubtargetFeatures(const Function &F) const { Ctx.diagnose(DiagnosticInfoUnsupported( F, "must specify exactly one of wavefrontsize32 and wavefrontsize64")); } - if (hasFeature(AMDGPU::FeatureXNACKAnyOnly) && TargetID.isXnackOnOrOff()) { - Ctx.diagnose(DiagnosticInfoUnsupported( - F, "target only supports xnack 'Any'; '+/-xnack' is not allowed")); - } } GCNSubtarget::GCNSubtarget(const Triple &TT, StringRef GPU, StringRef FS, diff --git a/llvm/test/CodeGen/AMDGPU/gfx12-5-generic-no-xnack.ll b/llvm/test/CodeGen/AMDGPU/gfx12-5-generic-no-xnack.ll deleted file mode 100644 index 5db4275dc9c77..0000000000000 --- a/llvm/test/CodeGen/AMDGPU/gfx12-5-generic-no-xnack.ll +++ /dev/null @@ -1,9 +0,0 @@ -; RUN: not llc -mtriple=amdgcn -mcpu=gfx12-5-generic -mattr=+xnack -filetype=null %s 2>&1 | FileCheck --check-prefix=GFX125-PLUS-XNACK %s -; RUN: not llc -mtriple=amdgcn -mcpu=gfx12-5-generic -mattr=-xnack -filetype=null %s 2>&1 | FileCheck --check-prefix=GFX125-MINUS-XNACK %s - -; GFX125-PLUS-XNACK: target only supports xnack 'Any'; '+/-xnack' is not allowed -; GFX125-MINUS-XNACK: target only supports xnack 'Any'; '+/-xnack' is not allowed - -define void @foo() { - ret void -} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
