[code-reflection] RFR: [hat] DeviceType interface definition for private/local data structures [v4]
Juan Fumero
jfumero at openjdk.org
Thu Nov 13 15:32:15 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 with a new target base due to a merge or a rebase. The pull request now contains 23 commits:
- Merge branch 'code-reflection' into hat/device/types
- [hat] minor change
- [HAT] mxm example using F16 fixed
- Merge branch 'code-reflection' into hat/device/types
- [hat] Fast mxm in F16 added as unittest
- [hat] refactoring F16 name
- [hat] refactor devicetype codegen
- [hat] debug message cleanup
- [hat] Test unsupported removed due to errors in CUDA
- Merge branch 'code-reflection' into hat/device/types
- ... and 13 more: https://git.openjdk.org/babylon/compare/ff924aa5...a83940f8
-------------
Changes: https://git.openjdk.org/babylon/pull/678/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=678&range=03
Stats: 1719 lines in 38 files changed: 1330 ins; 168 del; 221 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