You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Small runtime-indexed local arrays spill to PTX local memory #397
codegenDevice code-generation pipeline (Rust MIR to IR to PTX)optional-optsOpt-in optimization passes for the oxide-owned opt registry (off by default)
Small fixed arrays indexed by a runtime value are lowered through an alloca and dynamic GEP. After inlining and normal optimization, those accesses can remain as per-thread PTX local memory even when the array is tiny and the surrounding loop has a compile-time bound.
This affects both by-value reads and reads/writes through compiler-owned local arrays. It is especially visible for nested aggregate arrays, where otherwise ordinary Rust range loops produce .local, ld.local, and st.local instructions.
Expected behavior
For small fixed arrays, cuda-oxide should use bounded constant-index extract/GEP plus select chains so LLVM can keep values in SSA. Large arrays and borrowed/external arrays should retain ordinary memory lowering to bound code growth and preserve memory-access semantics. A bounded post-inline full-unroll pass is also needed so Rust range-loop helpers expose those constant accesses before final SROA.
Reproducer
The existing array_for_loop GPU example can be extended with runtime reads/writes of a three-element aggregate array and assertions that the generated kernel contains no PTX local-memory operations.
codegenDevice code-generation pipeline (Rust MIR to IR to PTX)optional-optsOpt-in optimization passes for the oxide-owned opt registry (off by default)
Activity
perf(mir-importer): materialize a bare array constant as one immutabl…