llvm-project
ac7cf4c8 - [mlir][ROCDL] Improve block/grid_dim handling, fix subgroup ID (#186235)

Commit
1 day ago
[mlir][ROCDL] Improve block/grid_dim handling, fix subgroup ID (#186235) This began as me chasing down the fact that the subgroup_id pattern introduced lately was causing crashes in translation because of mismatches between the i64 type of the ockl functions being called and the i32 type they'd been assigned, and spilled out into a refactor of how we handle these dimension-lookup functions. This commit removes the {Block,Grid}Dim{X,Y,Z} ops from the rocdl dialect, since they were translating to library calls and not intrinsics, which meant they don't fit into the dialect. Therefore, we instead add a new pattern that rewrites block/grid dimensions to library calls. While I'm there, I go ahead and implement support for upper bounds on these dimensions accessors, adding a fallback bound of 1 <= size < 1024 to those calls. This also meant updating the lowering of subgroup_id to use that same call-generation logic. While I was here, I factored out the "get block/grid bounds from the context" logic from the index op lowering template into a separate function that would be reusable in the new patterns. This also makes the subgroup_id tests stricter. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Tim Gymnich <tim@gymni.ch>
Author
Parents
Loading