This adds get_kernel_max_sub_group_size_for_ndrange and get_kernel_sub_group_count_for_ndrange.
Note this also changes err_opencl_requires_extension to print the name of the function that the diagnostic is warning about.
Please, split this patch into two parts:
I suggest leaving SemaBuiltinReserveRWPipe as is (i.e. two parameter) and modify the check for sub_group_* functions only:
if (checkOpenCLSubgroupExt(S, TheCall) || SemaBuiltinReserveRWPipe(*this, TheCall)) return ExprError();
It think it's more readable than looking at SemaBuiltinReserveRWPipe declaration or leaving the comment like this:
if (SemaBuiltinReserveRWPipe(*this, TheCall, false /*isSubgroup*/))
Please, apply the same approach to SemaBuiltinCommitRWPipe.
In addition to that, it makes sense to set the TheCall type inside the SemaBuiltinReserveRWPipe to avoid code duplication.
Please, add a test case(s) on invalid block parameters to cover the checks you added for new sub_group_ built-ins..
|1 ↗||(On Diff #101576)|
I don't think it makes sense to add this test. This test look like a duplicate of test cases added to SemaOpenCL/cl20-device-side-enqueue.cl.
This built-in functions should return unsigned integers: "i." -> "Ui.".
|8423–8424 ↗||(On Diff #101576)|
Since, this message is not specific to enqueue_kernel anymore, I suggest either rename it or better re-use existing diagnostics if possible. I think there are already message to report argument mismatch + probably additional note diagnostics that hints correct argument type.
Overall the patch looks good, but I would suggest splitting it into three commits (as they seems to be independent):
Please, add a regression test for the part #3.
You might also review this patch with @Anastasia (OpenCL code owner).
This change is not covered with regression tests.