llvm icon indicating copy to clipboard operation
llvm copied to clipboard

[SYCL] Add max work-group size kernel properties

Open frasercrmck opened this issue 1 year ago • 4 comments

This patch adds two kernel properties to allow users to specify the maximum work-group size that a kernel will be invoked with.

The max_work_group_size property corresponds to the intel::max_work_group_size function attribute, but can be specified with 1, 2, or 3 dimensions (unlike the attribute which accepts only 3).

The max_linear_work_group_size property is similar but is always a single value which denotes the combined linear (total) work-group size. This can be used when the user cannot guarantee a maximum bound in each of the dimensions they wish to run the kernel, but can guarantee a total. This acts similarly to CUDA's maxThreadsPerBlock launch bounds property.

This patch also wires up the 'max_work_group_size' property to the equivalent SPIR-V execution mode, which should hopefully improve certain use cases.

frasercrmck avatar Jul 10 '24 14:07 frasercrmck

Split from #14448, @steffenlarsen and @gmlueck

frasercrmck avatar Jul 10 '24 14:07 frasercrmck

Could you please add a CodeGen lit test to exercise the changes in NVPTX.cpp?

Sorry, do you mean a backend CodeGen LIT test, or a frontend CodeGen test?

There are separate (upstream) backend CodeGen tests already for the NVVM annotations, like this one.

This PR adds frontend "CodeGen" tests in sycl/test/check_device_code/extensions/properties, as that's where the LLVM IR codegen tests for the other properties takes place. I think this is the same discussion as in #14502.

frasercrmck avatar Jul 15 '24 08:07 frasercrmck

Could you please add a CodeGen lit test to exercise the changes in NVPTX.cpp?

Note the updated version of this patch doesn't touch clang any more once #14634 landed.

frasercrmck avatar Aug 06 '24 09:08 frasercrmck

ping @intel/dpcpp-spirv-reviewers, thanks

frasercrmck avatar Aug 27 '24 16:08 frasercrmck

ping @intel/dpcpp-spirv-reviewers

frasercrmck avatar Sep 09 '24 08:09 frasercrmck

Three E2E tests failing on linux:

Failed Tests (3):
  SYCL :: DeviceDependencies/free_function_kernels.cpp
  SYCL :: LLVMIntrinsicLowering/bitreverse.cpp
  SYCL :: LLVMIntrinsicLowering/sub_byte_bitreverse.cpp

All for the same reason:

clang++: error: option '-fno-sycl-allow-device-dependencies' is deprecated and will be removed in a future release

Looks like a pre-existing problem.

frasercrmck avatar Sep 25 '24 11:09 frasercrmck

Same on Windows:

********************
Failed Tests (2):
  SYCL :: DeviceDependencies/free_function_kernels.cpp
  SYCL :: LLVMIntrinsicLowering/bitreverse.cpp

frasercrmck avatar Sep 25 '24 12:09 frasercrmck

@intel/llvm-gatekeepers this is ready to merge, thanks. The failures are unrelated (see above).

frasercrmck avatar Sep 25 '24 12:09 frasercrmck