[code-reflection] RFR: [hat] Proposal for bfloat16 [v4]
Juan Fumero
jfumero at openjdk.org
Wed Dec 3 15:24:55 UTC 2025
On Wed, 3 Dec 2025 14:11:51 GMT, Gary Frost <gfrost at openjdk.org> wrote:
>> hat/core/src/main/java/hat/codebuilders/C99HATKernelBuilder.java line 126:
>>
>>> 124: if (OpTk.isAssignable(buildContext.lookup, javaType, MappableIface.class) && javaType instanceof ClassType classType) {
>>> 125: globalPtrPrefix().suffix_t(classType).asterisk();
>>> 126: } else if (javaType instanceof ClassType classType && classType.toClassName().equals(F16.class.getCanonicalName())) {
>>
>> Can we leverage OpTk.isAssignable ? or at least avoid string comparisons on Class.getCanonicalName
>>
>> Something like
>> OpTK.isAssignable(lookup, classType, F16.class) ?
>>
>> I think we have access to the lookup in the context...
>
> Actually if you check for DeviceType... you might be able to collapse multiple else ifs... here
>
> }else if (javaType instanceof ClassType classType && OpTk.isAssignable(javaType,DeviceType.class){
> .... generate the typedef ...
> }
We need to design a better strategy here. The problem is not that much about the String comparison, but the array implementation (e.g., `F16Impl`. What we could do is to add new Ops in the dialect to handle this case and make it generic, and we could avoid completely these comparisons. I prefer to have a separate PR for this.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585550861
More information about the babylon-dev
mailing list