Repository navigation
Conversation
Add the nvvm_entry_allocas standalone example. Check true-entry allocation placement and the absence of dynamic-stack PTX instructions while keeping an aggregate call with 128-bit parameter stores live through extended split compilation. Verify GPU results independently against a host oracle. On CUDA 13.4 the numerical oracle passes before entry normalization; the code-shape check distinguishes the storage-placement regression. Signed-off-by: Paul Zhang <paul@studio-vaai.com>
Normalize fixed scratch storage after NVVM compatibility rewrites, updating the LLVM-dialect IR before verification and export. Move original allocation operations with their metadata and supply dominating constant counts in entry, while retaining initialization at its original control-flow site. Leave dynamic counts and loop slots with observable addresses in place. Cover calls, block arguments, comparisons, pointer conversions, returns, stored pointers and selects through pointer-view chains, with both NVVM dialects, multi-block cycles, idempotence and count-dominance checks. Based on fcd6724. Signed-off-by: Paul Zhang <paul@studio-vaai.com>
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.
Fixes #1681 by moving eligible fixed scratch allocations into function entry during
nvvm-transformsnormalization.Scratch introduced during lowering can otherwise remain in body blocks and introduce dynamic stack handling when NVVM inlines helpers. This updates the LLVM dialect IR before verification and export, preserving alignment, source/debug metadata and initialization sites. Each moved allocation gets a constant count defined in entry.
Dynamic counts remain untouched. Allocations inside cycles are only hoisted when their pointer uses prove that the address cannot escape or be observed across iterations. Ordinary PTX builds keep their existing behavior.
The first commit adds
nvvm_entry_allocasfollowing the existing example structure. It checks GPU results independently from allocation placement and PTX shape -- the numerical oracle already passes before the fix on CUDA 13.4. The second commit implements normalization and adds regression coverage.Tested with Rust 1.99.1 and CUDA 13.4 on an RTX 5080:
Please let me know if anything should be adjusted -- happy to fix!