[PATCH] D95951: [OpenCL] Add cl_khr_subgroup_non_uniform_arithmetic to TableGen BIFs
Sven van Haastregt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 10 01:45:26 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9ae99a0de8c7: [OpenCL] Add cl_khr_subgroup_non_uniform_arithmetic to TableGen BIFs (authored by svenvh).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95951/new/
https://reviews.llvm.org/D95951
Files:
clang/lib/Sema/OpenCLBuiltins.td
clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
Index: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
===================================================================
--- clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -37,6 +37,7 @@
// Enable extensions that are enabled in opencl-c-base.h.
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#define cl_khr_subgroup_ballot 1
+#define cl_khr_subgroup_non_uniform_arithmetic 1
#endif
#endif
@@ -140,11 +141,13 @@
#endif
}
-kernel void extended_subgroup(global uint4 *out) {
+kernel void extended_subgroup(global uint4 *out, global int *scalar) {
out[0] = get_sub_group_eq_mask();
+ scalar[0] = sub_group_non_uniform_scan_inclusive_or(3);
#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error at -2{{implicit declaration of function 'get_sub_group_eq_mask' is invalid in OpenCL}}
- // expected-error at -3{{implicit conversion changes signedness}}
+ // expected-error at -3{{implicit declaration of function 'get_sub_group_eq_mask' is invalid in OpenCL}}
+ // expected-error at -4{{implicit conversion changes signedness}}
+ // expected-error at -4{{implicit declaration of function 'sub_group_non_uniform_scan_inclusive_or' is invalid in OpenCL}}
#endif
}
Index: clang/lib/Sema/OpenCLBuiltins.td
===================================================================
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -55,6 +55,7 @@
def FuncExtKhrSubgroups : FunctionExtension<"cl_khr_subgroups">;
def FuncExtKhrSubgroupNonUniformVote : FunctionExtension<"cl_khr_subgroup_non_uniform_vote">;
def FuncExtKhrSubgroupBallot : FunctionExtension<"cl_khr_subgroup_ballot">;
+def FuncExtKhrSubgroupNonUniformArithmetic: FunctionExtension<"cl_khr_subgroup_non_uniform_arithmetic">;
def FuncExtKhrSubgroupShuffle : FunctionExtension<"cl_khr_subgroup_shuffle">;
def FuncExtKhrSubgroupShuffleRelative : FunctionExtension<"cl_khr_subgroup_shuffle_relative">;
def FuncExtKhrGlobalInt32BaseAtomics : FunctionExtension<"cl_khr_global_int32_base_atomics">;
@@ -1523,7 +1524,19 @@
}
// Section 38.7.1 - cl_khr_subgroup_non_uniform_arithmetic
-// TODO
+let Extension = FuncExtKhrSubgroupNonUniformArithmetic in {
+ foreach name = ["reduce_", "scan_exclusive_", "scan_inclusive_"] in {
+ foreach op = ["add", "min", "max", "mul"] in {
+ def : Builtin<"sub_group_non_uniform_" # name # op, [AGenType1, AGenType1]>;
+ }
+ foreach op = ["and", "or", "xor"] in {
+ def : Builtin<"sub_group_non_uniform_" # name # op, [AIGenType1, AIGenType1]>;
+ }
+ foreach op = ["and", "or", "xor"] in {
+ def : Builtin<"sub_group_non_uniform_" # name # "logical_" # op, [Int, Int]>;
+ }
+ }
+}
// Section 38.8.1 - cl_khr_subgroup_shuffle
let Extension = FuncExtKhrSubgroupShuffle in {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95951.322620.patch
Type: text/x-patch
Size: 2909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210210/08c975de/attachment.bin>
More information about the cfe-commits
mailing list