Repository navigation
Lay out off-resonance and transmit phase per voxel together on a card - #28
Merged
Merged
Conversation
The CUDA kernels carry the two through one launch flag and read both per voxel when either is declared, while the tissue buffers narrowed each to a single value by its own feature. A tissue giving off-resonance beside a transmit map, without a transmit phase, then read the phase past the end of its buffer: a wrong echo phase that changed with the batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 6, 2026
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.
What changed
_prepare_tissuetreatsB0andB1_PHASEas one group: when a run declares either, both get a value per voxel.Why
The CUDA kernels carry both through one launch flag,
off_axis(feature_flags), and read both per voxel when either is declared. The tissue buffers, though, narrowed each property to a single value by its own feature. A tissue that gives off-resonance beside a transmit map (or any other per-voxel property), without a transmit phase, then readb1_phasepast the end of a one-element buffer, at the voxel stride. The echo phase came back wrong, and it changed with whatever the allocator had left in that block.It only shows where off-resonance stays in the states, i.e. where the windings are uneven and the analytic dephasing path is off. A spin echo with a spoiler after the echo is enough. The CPU kernel lays everything out and was right throughout.
Found while driving torchsim from the pulserver virtual scanner's Fourier engine, where atoms carry both a field bin and a transmit bin.
Validation
test_one_half_of_the_off_axis_turn_matches_the_cpu_kernel(4 cases). It dirties the allocator's small blocks first, so an over-read reads non-zero values. It fails onmainfor the two off-resonance-only cases and passes with the change.tests/sequence/test_cuda_parity.py,test_transmit_array.py,test_real_subspace.py,test_flow_kernels.py,test_diffusion_kernels.py,tests/model/test_signal_model.pyandtests/optim/test_binding.pypass on an RTX 4060 (231 passed).ruff checkandruff format --checkare clean on the touched files.🤖 Generated with Claude Code