Skip to content

Commit 3a0ecb2

Browse files
jhuber6arsenm
authored andcommitted
[AMDGPU] Allow w64 ballot to be used on w32 targets (llvm#80183)
Summary: Currently we cannot compile `__builtin_amdgcn_ballot_w64` on non-wave64 targets even though it is valid. This is relevant for making library code that can handle both without needing to check the wavefront size. This patch relaxes the semantic check for w64 so it can be used normally. (cherry picked from commit 5249379) Change-Id: Ief434d2bc0928a5bdc3149651357b94706611f09
1 parent b8a2fdd commit 3a0ecb2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ BUILTIN(__builtin_amdgcn_mqsad_u32_u8, "V4UiWUiUiV4Ui", "nc")
151151
//===----------------------------------------------------------------------===//
152152

153153
TARGET_BUILTIN(__builtin_amdgcn_ballot_w32, "ZUib", "nc", "wavefrontsize32")
154-
TARGET_BUILTIN(__builtin_amdgcn_ballot_w64, "WUib", "nc", "wavefrontsize64")
154+
BUILTIN(__builtin_amdgcn_ballot_w64, "WUib", "nc")
155155

156156
// Deprecated intrinsics in favor of __builtin_amdgn_ballot_{w32|w64}
157157
BUILTIN(__builtin_amdgcn_uicmp, "WUiUiUiIi", "nc")

clang/test/SemaOpenCL/builtins-amdgcn-error-wave64.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// RUN: %clang_cc1 -triple amdgcn-- -verify -S -o - %s
2-
// RUN: %clang_cc1 -triple amdgcn-- -target-feature +wavefrontsize32 -verify -S -o - %s
3-
// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -target-feature +wavefrontsize32 -verify -S -o - %s
42
// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -target-feature -wavefrontsize64 -verify -S -o - %s
53
// RUN: %clang_cc1 -triple amdgcn-- -target-cpu gfx1010 -verify -S -o - %s
64

5+
// expected-no-diagnostics
6+
77
typedef unsigned long ulong;
88

99
void test_ballot_wave64(global ulong* out, int a, int b) {
10-
*out = __builtin_amdgcn_ballot_w64(a == b); // expected-error {{'__builtin_amdgcn_ballot_w64' needs target feature wavefrontsize64}}
10+
*out = __builtin_amdgcn_ballot_w64(a == b);
1111
}
1212

1313
__attribute__((target("wavefrontsize64")))

0 commit comments

Comments
 (0)