Conversation
The GPU register/stack cross-talk check flagged any Register or Stack allocation scheduled outside the loops over GPU threads. But a Func scheduled compute_root().store_in(MemoryType::Stack) and read by a GPU kernel lives in ordinary host memory: a single copy every thread reads, not a per-thread private copy, so there is nothing to tell apart. Only run the check on allocations that are actually inside a GPU kernel by tracking whether we are within any GPU loop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9450 +/- ##
==========================================
+ Coverage 70.03% 70.06% +0.02%
==========================================
Files 261 261
Lines 79802 79805 +3
Branches 19455 19456 +1
==========================================
+ Hits 55892 55912 +20
- Misses 17997 18013 +16
+ Partials 5913 5880 -33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
A
Funcscheduledcompute_root().store_in(MemoryType::Stack)and read by a GPU kernel was tripping the GPU register/stack cross-talk check added in #9325, e.g.:fails with:
But this allocation lives on the CPU stack — a single host copy that every GPU
thread reads, like any other input buffer — not a per-thread private copy, so
there is no cross-talk to check for.
Cause
CheckCrossTalk::visit(Realize*)flagged anyRegister/Stackallocationscheduled outside the loops over GPU threads, without checking whether it was
inside a GPU kernel at all. It couldn't distinguish a genuine block-level
per-thread allocation from a host allocation that merely happens to be read by a
kernel.
Fix
Track whether we are inside any GPU loop (
is_gpu(op->for_type)) and only runthe check when the allocation is both inside a kernel and outside the thread
loops.
Test
Added a case to
test/correctness/gpu_register_at_block_level.cppcovering ahost stack allocation feeding a GPU kernel. Verified the existing
test/error/gpu_register_*negative tests still correctly reject realcross-talk.
🤖 Generated with Claude Code