[code-reflection] Integrated: Proposal for Vector Types for GPUs (OpenCL and CUDA backends)

Juan Fumero jfumero at openjdk.org
Tue Oct 14 12:12:49 UTC 2025


On Thu, 9 Oct 2025 14:34:08 GMT, Juan Fumero <jfumero at openjdk.org> wrote:

> This PR opens a new proposal to integrate an API for representing explicit vector types in HAT. 
> 
> The way to operate is as follows:
> 
> 
> Float4 vA = a.float4View(index * 4);
> Float4 vB = b.float4View(index * 4);
> Float4 vC = Float4.add(vA, vB);
> c.storeFloat4View(vC, index * 4);
> 
> 
> Java programmers can load/store float4 chunks within one instruction by using array views. These views operate on GPU's global memory, but we can add similar concepts for local/shared and private memory.  
> 
> Additionally, Java/HAT developers can access lanes within the vector instance by name:
> 
> 
> vA.x(myNewValue);
> float foo = vA.z();
> ``` 
> 
> This PR also extends the HAT API to allow vector functions in a chain.  For example:
> 
> 
> va.add(vb).mul(vc).div(va.mul(va));
> 
> 
> We will iterate over this proposal. 
> 
> How to test?
> 
> For CUDA
> 
> HAT=SHOW_CODE,INFO,SHOW_COMPILATION_PHASES java @hat/otest ffi-cuda oracle.code.hat.TestVectorTypes
> 
> 
> For OpenCL:
> 
> 
> HAT=SHOW_CODE,INFO,SHOW_COMPILATION_PHASES java @hat/otest ffi-opencl oracle.code.hat.TestVectorTypes
> 
> 
> This PR also introduces a new option to debug the HAT Dialect Phases. 
> 
> 
> HAT=SHOW_COMPILATION_PHASES ...

This pull request has now been integrated.

Changeset: 26afd5b8
Author:    Juan Fumero <jfumero at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/26afd5b8e08e01fa126f88467ebdbb3d79f27a51
Stats:     3489 lines in 45 files changed: 3344 ins; 88 del; 57 mod

Proposal for Vector Types for GPUs (OpenCL and CUDA backends)

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

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


More information about the babylon-dev mailing list