[code-reflection] RFR: [hat] DeviceType interface definition for private/local data structures [v3]
Juan Fumero
jfumero at openjdk.org
Thu Nov 13 11:50:41 UTC 2025
> 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
Juan Fumero has updated the pull request incrementally with two additional commits since the last revision:
- [hat] minor change
- [HAT] mxm example using F16 fixed
-------------
Changes:
- all: https://git.openjdk.org/babylon/pull/678/files
- new: https://git.openjdk.org/babylon/pull/678/files/bdb3444a..4a650501
Webrevs:
- full: https://webrevs.openjdk.org/?repo=babylon&pr=678&range=02
- incr: https://webrevs.openjdk.org/?repo=babylon&pr=678&range=01-02
Stats: 27 lines in 2 files changed: 11 ins; 3 del; 13 mod
Patch: https://git.openjdk.org/babylon/pull/678.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/678/head:pull/678
PR: https://git.openjdk.org/babylon/pull/678
More information about the babylon-dev
mailing list