← Back to Pull requests

Add support for cl_khr_subgroups and cl_khr_subgroup_extended_types #938

Merged
rjodinchr merged 5 files (132 lines) on Nov 29, 2026 11:14 UTC
View on GitHub
rjodinchr rjodinchr commented on Nov 17, 2026 12:43 UTC
Author

Initialize the SPIR-V target environment prior to building the device extension list, and require VK_SHADER_STAGE_COMPUTE_BIT in VkPhysicalDeviceSubgroupProperties::supportedStages for subgroup support.
Expose cl_khr_subgroup_extended_types on Vulkan 1.2+ devices that support basic, arithmetic, ballot, and vote subgroup operations along with 8-bit, 16-bit, and 64-bit integer types and 16-bit SSBO access.
Add a subgroup_independent_forward_progress device property (defaulting to false) to expose cl_khr_subgroups when enabled on capable devices, and report CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS in clGetDeviceInfo when either the property or cl_khr_subgroups is enabled.
Enable VK_KHR_shader_subgroup_uniform_control_flow when supported and pass -subgroup-uniform-control-flow to clspv.
Fix config.device_extensions entries to zero-initialize and null-terminate cl_name_version::name, set version 1.0.0, and avoid duplicates.
Fix clGetKernelSubGroupInfo conformance: allow device == nullptr for single-device contexts, validate that device belongs to the kernel's context and supports subgroups, implement CL_KERNEL_COMPILE_NUM_SUB_GROUPS, and fix parameter validation and return size / required subgroup size handling for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT.

Diff: 132 lines (+112 / -20) across 5 files Reviewer: kpet Review duration: 17190m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.38) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.38 · 132 lines diff across 5 files
0.38
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.83 · 5 substantive comment(s)
0.83
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
86%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.293
Real PR Conversation Timeline
7 items
rjodinchr rjodinchr commented on Nov 17, 2026 12:43 UTC
Author
kpet kpet commented on code on Nov 20, 2026 17:45 UTC
Code Review
src/device.cpp:1
@@ -323,6 +324,8 @@ void cvk_device::init_features(VkInstance instance) {
         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FMA_FEATURES_KHR;
     m_features_shader_atomic_float.sType =
         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT;
+      m_features_subgroup_uniform_control_flow.sType =

    m_features_subgroup_uniform_control_flow.sType =

kpet kpet commented on code on Nov 29, 2026 10:23 UTC
Code Review
src/device.cpp:1
@@ -708,11 +743,13 @@ void cvk_device::build_extension_ils_list() {
 
     auto config_extensions = config.device_extensions();
     for (auto& config_extension : config_extensions) {
-        cl_name_version extension;
-        extension.version = CL_MAKE_VERSION(0, 0, 0);
-        memcpy(extension.name, config_extension.c_str(),
-               std::min(config_extension.size(),
-                        (size_t)CL_NAME_VERSION_MAX_NAME_SIZE));
+        if (is_extension_enabled(config_extension.c_str())) {
+            continue;
+        }
+        cl_name_version extension{};
+        extension.version = CL_MAKE_VERSION(1, 0, 0);

What was the issue with 0.0.0? Either way it's made up but 0.0.0 makes it more obvious.

kpet kpet approved these changes on Nov 29, 2026 10:23 UTC
Approved Reviewer

Approved these changes.

rjodinchr rjodinchr commented on code on Nov 30, 2026 08:40 UTC
Code Review
src/device.cpp:1
@@ -708,11 +743,13 @@ void cvk_device::build_extension_ils_list() {
 
     auto config_extensions = config.device_extensions();
     for (auto& config_extension : config_extensions) {
-        cl_name_version extension;
-        extension.version = CL_MAKE_VERSION(0, 0, 0);
-        memcpy(extension.name, config_extension.c_str(),
-               std::min(config_extension.size(),
-                        (size_t)CL_NAME_VERSION_MAX_NAME_SIZE));
+        if (is_extension_enabled(config_extension.c_str())) {
+            continue;
+        }
+        cl_name_version extension{};
+        extension.version = CL_MAKE_VERSION(1, 0, 0);

Sorry about that, no real issue with 0.0.0, I just didn't remember why it was 0.0.0 when touching that loop, changed it, and forgot to double-check before pushing. I've opened a quick follow-up PR to switch it back to 0.0.0: https://github.com/kpet/clvk/pull/945.

kpet kpet commented on code on Nov 30, 2026 09:49 UTC
Code Review
src/device.cpp:1
@@ -708,11 +743,13 @@ void cvk_device::build_extension_ils_list() {
 
     auto config_extensions = config.device_extensions();
     for (auto& config_extension : config_extensions) {
-        cl_name_version extension;
-        extension.version = CL_MAKE_VERSION(0, 0, 0);
-        memcpy(extension.name, config_extension.c_str(),
-               std::min(config_extension.size(),
-                        (size_t)CL_NAME_VERSION_MAX_NAME_SIZE));
+        if (is_extension_enabled(config_extension.c_str())) {
+            continue;
+        }
+        cl_name_version extension{};
+        extension.version = CL_MAKE_VERSION(1, 0, 0);

No worries. Thanks for the PR.

Reviewers
Assignees
rjodinchr rjodinchr
Labels
risk: low confidence: 87.0% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 38.1% (MEDIUM) · Higher = larger blast radius
38.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 87.0% · Lower = rushed or shallow review
87.0%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 5.0% · Safe to merge
5.0%
Repository