[code-reflection] RFR: [hat][proposal] Adding notion of local thread ids and local group sizes int HAT
Juan Fumero
duke at openjdk.org
Tue Aug 19 10:00:45 UTC 2025
On Mon, 18 Aug 2025 14:10:45 GMT, Juan Fumero <duke at openjdk.org> wrote:
> This PR extends the `KernelContext` API to access local thread ids and group sizes.
>
> It keeps compatibility with the prev. API, thus, it maintains the `kernelcontext.x` and `kernelcontext.maxX` thread accessors. However, we might remove this in near future in favour for the kernelContext.gix and `kernelcontext.gsx`.
> This is just a proposal.
>
> Simple example:
>
>
> @CodeReflection
> private static void assign(@RO KernelContext context, @RW S32Array arrayA, @RW S32Array arrayB, @RW S32Array arrayC) {
> int gix = context.gix;
> int lix = context.lix;
> int lsx = context.lsx;
> int bsx = context.bsx;
> arrayA.array (gix, lix); // Store local thread id
> arrayB.array(gix, lsx); // Store local size
> arrayC.array(gix, bsx); // Store thread block id
> }
>
>
> How to test:
>
>
>
> # For OpenCL
> java -cp job.jar hat.java exp ffi-opencl $@
>
> # For CUDA
> java -cp job.jar hat.java exp ffi-cuda $@
>
>
> Still a draft PR until double checking with the CUDA backend.
Ready for review
-------------
PR Comment: https://git.openjdk.org/babylon/pull/527#issuecomment-3200049316
More information about the babylon-dev
mailing list