You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SYCL][CUDA] No attribute form of __launch_bounds__ left: intel::max_work_group_size removed in #21864, and min_work_groups_per_cu / max_work_groups_per_mp reject kernel-lambda syntax #23322
#8080 documents how to express CUDA's __launch_bounds__(maxThreadsPerBlock, minBlocksPerMultiprocessor, maxBlocksPerCluster) in SYCL with three attributes:
CUDA argument
Attribute
Current sycl branch
maxThreadsPerBlock
[[intel::max_work_group_size(Z, Y, X)]]
Removed by #21864 ("Remove FPGA Attributes from SYCL FE"). Now warning: unknown attribute 'intel::max_work_group_size' ignored
minBlocksPerMultiprocessor
[[intel::min_work_groups_per_cu(N)]]
Present. Lowers to minctasm on a functor operator(), but is rejected on a kernel lambda
maxBlocksPerCluster
[[intel::max_work_groups_per_mp(N)]]
Present. Same as above (maxclusterrank)
This causes two problems.
Removing intel::max_work_group_size silently drops the launch bound. It was an FPGA attribute, but on NVPTX it was also the documented way to emit maxntid. Existing code still compiles, with only an unknown-attribute warning. The bound is lost, and a kernel launched with 1024 work-items fails at run time:
SYCL error: Exceeded the number of registers available on the hardware.
The number registers per work-group cannot exceed 65536 for this kernel on this device.
The kernel uses 254 registers per work-item for a total of 1024 work-items per work-group.
The replacement is the max_work_group_size<...> kernel property from sycl_ext_oneapi_kernel_properties, returned from get(properties_tag). With it, the same kernel launches and maxntidx is emitted. However, neither the warning nor [SYCL][CUDA][HIP] Guidance for __launch_bounds__ in SYCL #8080 points to the property.
intel::min_work_groups_per_cu and intel::max_work_groups_per_mp can't be written on a kernel lambda.AttrDocs.td says they apply to "a device function/lambda function". Unlike [[sycl::reqd_sub_group_size]] (and the removed intel::max_work_group_size), they don't set SupportsNonconformingLambdaSyntax, so the usual SYCL lambda placement is an error. There is also no kernel property for them. So a lambda kernel has no way to express the second and third __launch_bounds__ arguments, and the first one is only available as a property.
To reproduce
Compiler: intel/llvm sycl at fbf7d1fd2cbf40b346e8109a81b3a13cf87d7ebd (clang 23.0.0git).
Code that used [[intel::max_work_group_size]] as a launch bound should get a diagnostic that names the max_work_group_size kernel property as the replacement, rather than a generic unknown-attribute warning. Alternatively, the attribute could be kept for non-FPGA targets.
intel::min_work_groups_per_cu and intel::max_work_groups_per_mp should accept the SYCL kernel-lambda syntax, as their documentation says. Alternatively, they could be exposed as kernel properties next to max_work_group_size, so that all of __launch_bounds__ can be expressed in one place.
Target: NVIDIA A100 (sm_80) at run time; sm_90 for the maxclusterrank check above
DPC++: intel/llvm sycl branch, fbf7d1fd2cbf40b346e8109a81b3a13cf87d7ebd, built from source
Additional context
Found while porting a CUDA kernel that uses __launch_bounds__(1024) to SYCL. Switching to get(properties_tag) returning max_work_group_size<1024> fixed the launch on the A100 and did not change AMD (gfx942) performance.
Describe the bug
#8080 documents how to express CUDA's
__launch_bounds__(maxThreadsPerBlock, minBlocksPerMultiprocessor, maxBlocksPerCluster)in SYCL with three attributes:syclbranchmaxThreadsPerBlock[[intel::max_work_group_size(Z, Y, X)]]warning: unknown attribute 'intel::max_work_group_size' ignoredminBlocksPerMultiprocessor[[intel::min_work_groups_per_cu(N)]]minctasmon a functoroperator(), but is rejected on a kernel lambdamaxBlocksPerCluster[[intel::max_work_groups_per_mp(N)]]maxclusterrank)This causes two problems.
Removing
intel::max_work_group_sizesilently drops the launch bound. It was an FPGA attribute, but on NVPTX it was also the documented way to emitmaxntid. Existing code still compiles, with only an unknown-attribute warning. The bound is lost, and a kernel launched with 1024 work-items fails at run time:The replacement is the
max_work_group_size<...>kernel property fromsycl_ext_oneapi_kernel_properties, returned fromget(properties_tag). With it, the same kernel launches andmaxntidxis emitted. However, neither the warning nor [SYCL][CUDA][HIP] Guidance for __launch_bounds__ in SYCL #8080 points to the property.intel::min_work_groups_per_cuandintel::max_work_groups_per_mpcan't be written on a kernel lambda.AttrDocs.tdsays they apply to "a device function/lambda function". Unlike[[sycl::reqd_sub_group_size]](and the removedintel::max_work_group_size), they don't setSupportsNonconformingLambdaSyntax, so the usual SYCL lambda placement is an error. There is also no kernel property for them. So a lambda kernel has no way to express the second and third__launch_bounds__arguments, and the first one is only available as a property.To reproduce
Compiler: intel/llvm
syclatfbf7d1fd2cbf40b346e8109a81b3a13cf87d7ebd(clang 23.0.0git).Lambda form (
lb.cpp):Functor form (
lb2.cpp) works, but only when combined with the property:Expected behavior
[[intel::max_work_group_size]]as a launch bound should get a diagnostic that names themax_work_group_sizekernel property as the replacement, rather than a generic unknown-attribute warning. Alternatively, the attribute could be kept for non-FPGA targets.intel::min_work_groups_per_cuandintel::max_work_groups_per_mpshould accept the SYCL kernel-lambda syntax, as their documentation says. Alternatively, they could be exposed as kernel properties next tomax_work_group_size, so that all of__launch_bounds__can be expressed in one place.Environment
sm_80) at run time;sm_90for themaxclusterrankcheck abovesyclbranch,fbf7d1fd2cbf40b346e8109a81b3a13cf87d7ebd, built from sourceAdditional context
Found while porting a CUDA kernel that uses
__launch_bounds__(1024)to SYCL. Switching toget(properties_tag)returningmax_work_group_size<1024>fixed the launch on the A100 and did not change AMD (gfx942) performance.