diff --git a/clang/test/CodeGenOpenCL/amdgpu-features-illegal.cl b/clang/test/CodeGenOpenCL/amdgpu-features-illegal.cl index 4e2f7f86e8402..04de5dca3f6c0 100644 --- a/clang/test/CodeGenOpenCL/amdgpu-features-illegal.cl +++ b/clang/test/CodeGenOpenCL/amdgpu-features-illegal.cl @@ -1,8 +1,10 @@ // RUN: not %clang_cc1 -triple amdgcn -target-feature +wavefrontsize32 -target-feature +wavefrontsize64 -o /dev/null %s 2>&1 | FileCheck %s // RUN: not %clang_cc1 -triple amdgcn -target-cpu gfx1103 -target-feature +wavefrontsize32 -target-feature +wavefrontsize64 -o /dev/null %s 2>&1 | FileCheck %s // RUN: not %clang_cc1 -triple amdgcn -target-cpu gfx900 -target-feature +wavefrontsize32 -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=GFX9 +// RUN: not %clang_cc1 -triple amdgcn -target-cpu gfx1250 -target-feature +wavefrontsize64 -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=GFX1250 // CHECK: error: invalid feature combination: 'wavefrontsize32' and 'wavefrontsize64' are mutually exclusive // GFX9: error: option 'wavefrontsize32' cannot be specified on this target +// GFX1250: error: option 'wavefrontsize64' cannot be specified on this target kernel void test() {} diff --git a/llvm/lib/TargetParser/TargetParser.cpp b/llvm/lib/TargetParser/TargetParser.cpp index 50b97d3257540..31558126c66b3 100644 --- a/llvm/lib/TargetParser/TargetParser.cpp +++ b/llvm/lib/TargetParser/TargetParser.cpp @@ -774,6 +774,18 @@ static bool isWave32Capable(StringRef GPU, const Triple &T) { return IsWave32Capable; } +static bool isWave64Capable(StringRef GPU, const Triple &T) { + if (T.isAMDGCN()) { + switch (parseArchAMDGCN(GPU)) { + case GK_GFX1250: + return false; + default: + break; + } + } + return true; +} + std::pair AMDGPU::insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap &Features) { @@ -788,6 +800,9 @@ AMDGPU::insertWaveSizeFeature(StringRef GPU, const Triple &T, if (HaveWave32 && !IsNullGPU && !IsWave32Capable) { return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "wavefrontsize32"}; } + if (HaveWave64 && !IsNullGPU && !isWave64Capable(GPU, T)) { + return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "wavefrontsize64"}; + } // Don't assume any wavesize with an unknown subtarget. if (!IsNullGPU) { // Default to wave32 if available, or wave64 if not