[code-reflection] RFR: [hat] Proposal for bfloat16 [v4]

Gary Frost gfrost at openjdk.org
Wed Dec 3 14:14:59 UTC 2025


On Wed, 3 Dec 2025 14:08:37 GMT, Gary Frost <gfrost at openjdk.org> wrote:

>> Juan Fumero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   [hat] bfloat16 codegen refactored
>
> 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 ...
}

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

PR Review Comment: https://git.openjdk.org/babylon/pull/716#discussion_r2585283414


More information about the babylon-dev mailing list