[code-reflection] RFR: Float4 arrayView support

Juan Fumero jfumero at openjdk.org
Fri Oct 31 22:04:50 UTC 2025


On Tue, 28 Oct 2025 06:50:35 GMT, Juan Fumero <jfumero at openjdk.org> wrote:

>> Preliminary `Float4` support for arrayViews. Currently only supported for `F32ArrayPadded` buffers, which can be accessed like a `Float4[]` as shown below:
>> 
>> Float4[] arr = buffer.float4ArrayView(); // for a F32ArrayPadded buffer
>> 
>> At the moment, to use an element in the array, the `Float4` must be loaded into a separate variable first, i.e.
>> 
>> Float4 a = arr[index * 4];
>> 
>> A value can be stored into the array through the following syntax:
>> 
>> arr[index * 4] = ...
>
> hat/backends/ffi/opencl/src/main/java/hat/backend/ffi/OpenCLHATKernelBuilder.java line 89:
> 
>> 87:                 .oparen();
>> 88:         // if the value to be stored is an operation, recurse on the operation
>> 89:         if (hatVectorStoreView.operands().get(1) instanceof Op.Result r && r.op() instanceof HATVectorBinaryOp) {
> 
> Shouldn't this be automatically visited when `HATVectorBinaryOp` is found? Do you have the use case in which this is needed?  The reason I am asking is that this also works with the prev. proposal for single Float4 loads./stores . So I wonder which pattern triggers the new check.

We will need to propagate this change also for the CUDA codegen.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/646#discussion_r2468132770


More information about the babylon-dev mailing list