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

Juan Fumero jfumero at openjdk.org
Tue Oct 14 11:26:25 UTC 2025


> 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();
> ``` 
> 
> 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 ...

Juan Fumero has updated the pull request incrementally with one additional commit since the last revision:

  [hat] F32ArrayPadded DS added

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

Changes:
  - all: https://git.openjdk.org/babylon/pull/606/files
  - new: https://git.openjdk.org/babylon/pull/606/files/5f37c6f7..7fbc18a7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=babylon&pr=606&range=01
 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=606&range=00-01

  Stats: 232 lines in 6 files changed: 137 ins; 14 del; 81 mod
  Patch: https://git.openjdk.org/babylon/pull/606.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/606/head:pull/606

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


More information about the babylon-dev mailing list