The main purpose of introducing these builtins is to add a range metadata [1, 1025) on the work group size loaded from dispatch ptr, which cannot be done by source code.
Why is this necessary? The builtin always has the same return type?
Comment that this is indexing the hsa_kernel_dispatch_packet sstruct?
I thought I had a patch to include the maximum group size in AMDGPUTargetInfo to avoid hardcoding it, but I guess it was never committed
Also set it's invariant
Also run in a hip test, or some case where the addrspacecast is needed?
Revised by Matt's comments
pointers returned by builtin functions are in default address space for HIP.
Added getMaxOpenCLWorkGroupSize() to TargetInfo