[clang] clang: Report subgroup ext types for AMDGPU with llvm env (PR #188472)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 25 05:11:20 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
Report cl_khr_subgroup_extended_types for AMDGPU when targeting
the llvm environment.
---
Full diff: https://github.com/llvm/llvm-project/pull/188472.diff
2 Files Affected:
- (modified) clang/lib/Basic/Targets/AMDGPU.h (+4)
- (modified) clang/test/Misc/amdgcn.languageOptsOpenCL.cl (+14)
``````````diff
diff --git a/clang/lib/Basic/Targets/AMDGPU.h b/clang/lib/Basic/Targets/AMDGPU.h
index 08ccc668f78b6..38030ba07f9be 100644
--- a/clang/lib/Basic/Targets/AMDGPU.h
+++ b/clang/lib/Basic/Targets/AMDGPU.h
@@ -346,6 +346,10 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
Opts["__opencl_c_device_enqueue"] = true;
Opts["__opencl_c_pipes"] = true;
}
+
+ if (getTriple().getEnvironment() == llvm::Triple::LLVM) {
+ Opts["cl_khr_subgroup_extended_types"] = true;
+ }
}
}
diff --git a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
index fd42912854020..5e611329b518d 100644
--- a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
+++ b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -14,6 +14,8 @@
// Test none target with amdhsa triple, which implies >= gfx700
// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-amdhsa -Wpedantic-core-features -DTEST_CORE_FEATURES -DFLAT_SUPPORT
+// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-amdhsa-llvm -Wpedantic-core-features -DTEST_CORE_FEATURES -DFLAT_SUPPORT -DLLVM_ENV_EXTENSIONS
+
// Extensions in all versions
#ifndef cl_clang_storage_class_specifiers
#error "Missing cl_clang_storage_class_specifiers define"
@@ -219,3 +221,15 @@
#endif
#endif
#endif
+
+#ifdef LLVM_ENV_EXTENSIONS
+ // Features available with llvm env
+ #ifndef cl_khr_subgroup_extended_types
+ #error "missing cl_khr_subgroup_extended_types define"
+ #endif
+#else
+ // Features not available with unknown environment.
+ #ifdef cl_khr_subgroup_extended_types
+ #error "incorrect cl_khr_subgroup_extended_types define"
+ #endif
+#endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/188472
More information about the cfe-commits
mailing list