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

Juan Fumero jfumero at openjdk.org
Tue Nov 4 14:40:22 UTC 2025


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)
 );

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

Commit messages:
 - [hat] Using factory methods of to create NDRanges
 - [hat] Restore the NDRange
 - [hat][wip] NDRange completely removed
 - [hat][wip] NDRange removed
 - [hat] NDRange setup simplified
 - [hat] NDRange.of to specify 1D programs

Changes: https://git.openjdk.org/babylon/pull/657/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=657&range=00
  Stats: 943 lines in 64 files changed: 256 ins; 387 del; 300 mod
  Patch: https://git.openjdk.org/babylon/pull/657.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/657/head:pull/657

PR: https://git.openjdk.org/babylon/pull/657


More information about the babylon-dev mailing list