Skip to content

[New GPU Codegen Prep] Add MoveArrayOutOfKernel - #2535

Open
ThrudPrimrose wants to merge 14 commits into
mainfrom
gpu-prep/hoist-kernel-transients
Open

ThrudPrimrose wants to merge 14 commits into
mainfrom
gpu-prep/hoist-kernel-transients

Conversation

@ThrudPrimrose

Copy link
Copy Markdown
Collaborator

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.

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.
@ThrudPrimrose ThrudPrimrose changed the title [WIP] Add MoveArrayOutOfKernel [New GPU Codegen Prep] Add MoveArrayOutOfKernel Aug 26, 2026
…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
…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.
@ThrudPrimrose
ThrudPrimrose marked this pull request as ready for review September 28, 2026 16:33
ThrudPrimrose and others added 4 commits September 28, 2026 22:08
…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant