Author: Matt Arsenault Date: 2026-06-18T13:07:22+02:00 New Revision: 08b557bf5139394194be22359268b7b88f81faae
URL: https://github.com/llvm/llvm-project/commit/08b557bf5139394194be22359268b7b88f81faae DIFF: https://github.com/llvm/llvm-project/commit/08b557bf5139394194be22359268b7b88f81faae.diff LOG: AMDGPU: Remove xnack-any-only subtarget feature and handling (#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. Added: clang/test/Driver/Inputs/rocm/amdgcn/bitcode/oclc_isa_version_12-5-generic.bc Modified: clang/test/Driver/hip-sanitize-options.hip llvm/include/llvm/TargetParser/AMDGPUTargetParser.def llvm/lib/Target/AMDGPU/AMDGPU.td llvm/lib/Target/AMDGPU/GCNSubtarget.cpp Removed: 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 13946d8aa25c3..d15fc01f30019 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 31adc397e1c1f..524d8e8e31b1b 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 @@ -2265,7 +2261,6 @@ def FeatureISAVersion12_5_Generic: FeatureSet< [FeatureAddressableLocalMemorySize327680, FeatureSetregVGPRMSBFixup, FeatureRequiresCOV6, - FeatureXNACKAnyOnly, FeatureGFX125xLowestRateWMMA, FeatureTransCoexecutionHazard])>; diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp b/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp index 793d9725818b0..14de6753d42e4 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
