[code-reflection] Integrated: [hat] DeviceType interface definition for private/local data structures

Juan Fumero jfumero at openjdk.org
Thu Nov 13 17:52:21 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

This pull request has now been integrated.

Changeset: 1a27f624
Author:    Juan Fumero <jfumero at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/1a27f62407b96421071a9a7e43cffb4f9c7dd217
Stats:     1719 lines in 38 files changed: 1330 ins; 168 del; 221 mod

[hat] DeviceType interface definition for private/local data structures

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

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


More information about the babylon-dev mailing list