[New GPU Codegen Prep] Add NestedGPUDeviceMapLowering - #2534
Open
ThrudPrimrose wants to merge 14 commits into
Open
ThrudPrimrose wants to merge 14 commits into
ThrudPrimrose wants to merge 14 commits into
Conversation
Lowers a GPU_Device map nested inside another into a single kernel: the outer map absorbs the inner maps' parameters and each inner body becomes a nested SDFG guarded by the condition selecting the iterations it owns. The body is moved with nest_state_subgraph and the scope dissolved through memlet paths, rather than rebuilt by hand. The bound check reproduces the range step, and the absorbed range is the bounding box of the inner ranges alone instead of being seeded at zero.
… removed Moving the body with nest_state_subgraph lost two things the hand-written nesting did. An empty memlet leaving the map scope is an ordering edge, and dropping it with the map detached the guarded body from its enclosing kernel, so the scope traversal could no longer place the nodes below it. The nested SDFG node was also left without the enclosing scope's symbols, which are declared on the nested SDFG but have to be bound on the node as well. A body directly nested in a kernel scope, and the binding of the outer kernel's parameter, are both now tested.
…orbed params unique Ported from extended and generalized: - translate each hoisted inner range through every NestedSDFG symbol_mapping, applied simultaneously (a swapping mapping no longer maps a name back to itself); - refuse a hoisted bound naming anything the host cannot evaluate where the grid is sized (a kernel param, or a loop variable defined inside the kernel); - rename an inner param that repeats a kernel param or a symbol of any SDFG between the kernel and the inner map, so the absorbed dimension is declared once and a nested binding of the same name does not shadow it; - type the threaded symbols from the map ranges instead of a fixed default.
…er maps and SymExpr bounds
…n becomes its own helper
…refusal cases, share one kernel lookup The guarded-body symbol check joins the flattening test it shared a setup with.
ThrudPrimrose
marked this pull request as ready for review
September 28, 2026 16:33
…p duplicate helpers, share one traversal The pass walks every scope and nested SDFG below a kernel with one recursive generator, so a GPU map behind a sequential scope or at any nesting depth is absorbed into the outermost kernel. The tests parametrize the bound, symbol-mapping and step cases and check each guard against the iterations of its own map.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lowers a
GPU_Devicemap nested inside another into a single kernel: the outer map absorbs the inner maps' parameters and each inner body becomes a nested SDFG guarded by the condition selecting the iterations it owns. The body is moved withnest_state_subgraphand the scope dissolved through memlet paths rather than rebuilt by hand, the bound check reproduces the range step, and the absorbed range is the bounding box of the inner ranges alone.