[llvm] [Offload] Add olGetKernelMaxGroupSize (PR #142950)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 05:56:31 PDT 2025


RossBrunton wrote:

@jhuber6 I'm not a fan of that approach; it means that every time a kernel handle is created, a bunch of functors have to be created, even if the implementation never uses them. It also makes plugin code much more complicated.

If reducing the number of API functions is the goal, how about the following:

```c
uint64_t LocalSize = getLocalSizeFromSomewhere();
uint64_t MaxGroupSize;
olQueryKernel(Device, Kernel, OL_KERNEL_QUERY_MAX_GROUP_SIZE, sizeof(MaxGroupSize), MaxGroupSize, &LocalSize);
```

We add a function similar to `olGetKernelInfo`, but have it accept an additional `const void *`. This pointer points to an "argument" to the query type; in this case a `const uint64_t *` pointing to the local size. If we need to add future device info in the future, we can add new `OL_KERNEL_QUERY_*`s, each with a specific argument type.

https://github.com/llvm/llvm-project/pull/142950


More information about the llvm-commits mailing list