[code-reflection] RFR: [hat] DeviceType interface definition for private/local data structures
Juan Fumero
jfumero at openjdk.org
Wed Nov 12 15:49:04 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
-------------
Commit messages:
- [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
- test class reorganized
- [hat] CUDA Backend using the new F16 builtin
- [hat] F16 built-in type for HAT
- [hat] DeviceType load phase refined
- ... and 9 more: https://git.openjdk.org/babylon/compare/a1b01376...37b8417a
Changes: https://git.openjdk.org/babylon/pull/678/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=678&range=00
Stats: 1696 lines in 38 files changed: 1320 ins; 166 del; 210 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