[New GPU Codegen Prep] Add MoveArrayOutOfKernel - #2535
Open
ThrudPrimrose wants to merge 14 commits into
Open
ThrudPrimrose wants to merge 14 commits into
ThrudPrimrose wants to merge 14 commits into
Conversation
Hoists a transient GPU_Global array declared inside a GPU_Device map out of the kernel, giving it one slice per map iteration, and demotes one small enough to per-thread registers instead. GPUs cannot allocate device-global memory inside a kernel, so this exists for backward compatibility. The lift builds its memlet paths with add_memlet_path and finds a free name with utils.find_new_name rather than open-coding either, and the node-to-state lookup is built once for the whole pass.
…r redesign The pass now walks each owning SDFG's transient once, computes the GPU levels its accesses sit under, and prefixes every memlet from that one fact. Ported from extended, each with a reproducer: - index a lifted slice from the map's first iteration, not the raw param; - order the prepended indices like the prepended dimensions (outermost first); - carry one slice per iteration out through the map exits, not the whole buffer; - translate a lifted descriptor through the nested symbol_mapping (simultaneous); - reshape and rewrite only the defining SDFG and its ancestors, never the nests below it that receive the buffer through a connector; - rewrite subscripts that interstate edges, loops and branches read; - bind the kernel params the new index names into every nest on the way down, and never into a nest that assigns that name itself (refused instead). Also drops the node-to-state cache, a class-level mutable default shared across instances, and refuses a transient shared by two kernels or read by control flow under per-thread maps instead of lifting it wrongly.
…ls, control flow reading a per-thread buffer
…ansient in place when a nest would misread its index
… where the accumulator lives
…im redundant tests enclosing_maps walks helpers.get_parent_map. prefix_control_flow hands its subscript prefixer to rewrite_code_slots, which also rewrites NestedSDFG symbol_mapping values, so a nest bound to an element of a lifted buffer now reads it with the kernel index (new test). Merge duplicate tile_extent, layout and non-transient accumulator tests.
…not when unparsing reformats
ThrudPrimrose
marked this pull request as ready for review
September 28, 2026 16:33
…ift symbolic device-local transients and rewrite tasklet bodies Persistent and external transients are never demoted to registers, and an inline Python tasklet that names a lifted buffer gains the kernel index while a C++ one that subscripts it is refused. The WCR tests move into the main test file and the scratch fixtures share one helper.
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.
Hoists a transient
GPU_Globalarray declared inside aGPU_Devicemap out of the kernel, giving it one slice per map iteration, and demotes one small enough to per-thread registers instead; GPUs cannot allocate device-global memory inside a kernel, so this exists for backward compatibility. The lift builds its memlet paths withadd_memlet_pathand finds a free name withutils.find_new_namerather than open-coding either.