[code-reflection] RFR: Float4 arrayView support
Ruby Chen
duke at openjdk.org
Fri Oct 31 22:04:54 UTC 2025
On Tue, 28 Oct 2025 06:53:27 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/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java line 99:
>
>> 97: switch (op) {
>> 98: case JavaOp.InvokeOp iop -> {
>> 99: if (isVectorOperation(iop)) {
>
> This HAT Phase is invoked after all vector operations have been inserted in the new code-model. So I wonder if this is actually triggered. My take is that, at this point in the compilation pipeline, all VectoLoads, Stores and VSelect are already in place. Is this correct?
That's correct; this is leftover from when I was testing earlier haha. Good catch!
> hat/core/src/main/java/hat/phases/HATDialectifyArrayViewPhase.java line 165:
>
>> 163: }
>> 164: // handles only 1D and 2D arrays
>> 165: case JavaOp.ArrayAccessOp.ArrayLoadOp alop -> {
>
> My take is that this phase is hitting this `case` for all the actual array view. If the prev. block still insert the dialect ops for vectors, we could substitute the prev.. pipeline of hat phases with this one.
Oh interesting, are you proposing combining some of the hat phases into one larger overall phase using this `case` logic?
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/646#discussion_r2470578540
PR Review Comment: https://git.openjdk.org/babylon/pull/646#discussion_r2470585428
More information about the babylon-dev
mailing list