[code-reflection] RFR: [hat][API] ComputeRange moved to NDRange

Juan Fumero jfumero at openjdk.org
Tue Nov 4 14:43:04 UTC 2025


On Tue, 4 Nov 2025 10:28:32 GMT, Juan Fumero <jfumero at openjdk.org> wrote:

> This PR refactors the `NDRange` and the `ComputeRange`.
> 
> NDRange removes the need for the accelerator object, and the internal kernelContext. 
> 
> Instead the `ComputeRange` has been moved to an `NDRange`. Thus, from this change, this is how we will dispatch kernels:
> 
> 
> NDRange ndRange = NDRange.of(new Global2D(globalSize, globalSize), new Local2D(BLOCK_SIZE, BLOCK_SIZE));
>         cc.dispatchKernel(ndRange,
>                 kc -> matrixMultiplyKernel2DLI(kc, matrixA, matrixB, matrixC, globalSize)
>         );
> 
> 
> We add also a set of factory methods to facilitate composing NDRanges when 1D is required :
> 
> For instance:
> 
> 
> cc.dispatchKernel( NDRange.of(call.length()), 
>    kc -> blackScholesKernel(kc, call, put, S, X, T, r, v)
>  );

To provide the (e.g., `Global1D.of(x)` we need code-reflection to support the `RECORD` type. So we can merge this one,  and once the code-reflection integrates this change, we can refine this part in the HAT API.

-------------

PR Comment: https://git.openjdk.org/babylon/pull/657#issuecomment-3486331466


More information about the babylon-dev mailing list