[code-reflection] RFR: Float4 arrayView support
Ruby Chen
duke at openjdk.org
Fri Oct 31 22:04:51 UTC 2025
On Tue, 28 Oct 2025 06:56:53 GMT, Juan Fumero <jfumero at openjdk.org> wrote:
>> 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.
Good point; currently, a line like `vC[index * 4] = Float4.add(vA[index * 4], vB[index * 4])` won't be handled properly (the add operation won't be recursed over, and the resulting code will look like `vstore4(vA, 0, &c->array[index*4])` instead of storing the add operation's result).
(Edit: I originally thought that if we extracted the array accesses `vA[index * 4]` and `vB[index * 4]` into Float4 variables first before operating on them, the original code would work, but it doesn't seem to be the case)
There might also be something I'm missing that causes a case like `vC[index * 4] = Float4.add(vA[index * 4], vB[index * 4])` to fail with the original code; I'll give it another pass.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/646#discussion_r2470395187
More information about the babylon-dev
mailing list