[code-reflection] RFR: Enhance grammar of op attributes
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed May 28 15:47:13 UTC 2025
On Wed, 28 May 2025 15:28:30 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This PR enhances the grammar of op attributes, so as to avoid use of "stringy" attributes where possible. Now all attributes that are Java primitives are externalized and re-parsed back automatically. This means that op factories no longer need to test for attribute values of type `String` and then manually parse that string back into the correct primitive, which makes the code more robust.
>
> This change caused some reshuffling in the tests -- most notably, when fixing the triton test, the new logic highlighted what was probably an "issue" in the triton transformer (see related comment).
cr-examples/triton/src/main/java/oracle/code/triton/TritonTransformer.java line 1056:
> 1054: b = block.context().getValue(b);
> 1055: // Computed result is tensor of floats, regardless of inputs
> 1056: Object zero = 0.0f;
The previous constant was `0.0` which parses as a `double` constant, not a `float` one. Of course the string representation of both would be the same -- but now that `AttributeWriter` appends the correct suffix, this issue led to weird mismatches in tests.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/435#discussion_r2112222554
More information about the babylon-dev
mailing list