clc: rework optional subgroup feature
OpenCL 3.0 core requires __opencl_c_subgroups to be set, the OpenCL cl_khr_subgroups extenions can only be enabled if and only if the driver guarentees independent forward progress between subgroups. See CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS for more information. Signed-off-by: Karol Herbst <git@karolherbst.de> Reviewed-by: Nora Allen <blackcatgames@protonmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22893>
This commit is contained in:
@@ -58,7 +58,12 @@ struct clc_optional_features {
|
|||||||
bool images_write_3d;
|
bool images_write_3d;
|
||||||
bool integer_dot_product;
|
bool integer_dot_product;
|
||||||
bool intel_subgroups;
|
bool intel_subgroups;
|
||||||
|
/* OpenCL core subgroups */
|
||||||
bool subgroups;
|
bool subgroups;
|
||||||
|
/* OpenCL extension cl_khr_subgroups, which requires independent forward
|
||||||
|
* progress
|
||||||
|
*/
|
||||||
|
bool subgroups_ifp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct clc_compile_args {
|
struct clc_compile_args {
|
||||||
|
@@ -927,6 +927,10 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
|
|||||||
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_intel_subgroups");
|
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_intel_subgroups");
|
||||||
}
|
}
|
||||||
if (args->features.subgroups) {
|
if (args->features.subgroups) {
|
||||||
|
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+__opencl_c_subgroups");
|
||||||
|
}
|
||||||
|
if (args->features.subgroups_ifp) {
|
||||||
|
assert(args->features.subgroups);
|
||||||
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_subgroups");
|
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_subgroups");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -901,6 +901,7 @@ impl Device {
|
|||||||
integer_dot_product: true,
|
integer_dot_product: true,
|
||||||
intel_subgroups: false,
|
intel_subgroups: false,
|
||||||
subgroups: false,
|
subgroups: false,
|
||||||
|
subgroups_ifp: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -437,6 +437,7 @@ int main(int argc, char **argv)
|
|||||||
.fp16 = true,
|
.fp16 = true,
|
||||||
.intel_subgroups = true,
|
.intel_subgroups = true,
|
||||||
.subgroups = true,
|
.subgroups = true,
|
||||||
|
.subgroups_ifp = true,
|
||||||
},
|
},
|
||||||
.args = util_dynarray_begin(&clang_args),
|
.args = util_dynarray_begin(&clang_args),
|
||||||
.num_args = util_dynarray_num_elements(&clang_args, char *),
|
.num_args = util_dynarray_num_elements(&clang_args, char *),
|
||||||
|
Reference in New Issue
Block a user