[code-reflection] RFR: [hat] DeviceType interface definition for private/local data structures
Juan Fumero
jfumero at openjdk.org
Thu Nov 13 09:29:07 UTC 2025
On Wed, 12 Nov 2025 14:40:13 GMT, Juan Fumero <jfumero at openjdk.org> wrote:
> This PR introduces the `DeviceType` to be able to represent user data types in Local and Private memory of the GPU for both CUDA and OpenCL.
>
> As a PoC, it extends the support for FP16 (`half`) to be able to operate, load and store F16 types, even in data structures defined by the user using F16.
>
> Example:
>
>
> interface DevicePrivateArray2 extends DeviceType {
> F16 array(int index); // F16 is a predefine HAT type
> void array(int index, F16 value);
>
> DeviceSchema<DevicePrivateArray2> schema = DeviceSchema.of(DevicePrivateArray2.class,
> builder -> builder.withArray("array", 1024). // build an array of this type for 1024 elemtns
> .withDeps(F16.class, half -> half.withField("value"))); // compose of this type
>
> // compatible with the prev. IFace version
> static DevicePrivateArray2 create(Accelerator accelerator) { return null; }
>
> // marker to create this object in private memory
> static DevicePrivateArray2 createPrivate() { return null; }
> }
>
>
> How to test?
>
>
> HAT=SHOW_CODE java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestF16Type
Holding the merge until we recover HAT from the master branch. So I will convert this PR to a draft PR
-------------
PR Comment: https://git.openjdk.org/babylon/pull/678#issuecomment-3526714871
More information about the babylon-dev
mailing list