Skip to content

Conversation

@36000
Copy link
Collaborator

@36000 36000 commented Jan 27, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 27, 2026 06:22
@36000 36000 merged commit fc7b95e into dipy:master Jan 27, 2026
4 of 5 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts how ArraySequence buffer sizing is computed/passed to prevent buffer sizing issues (unit mismatch/truncation) during streamline generation.

Changes:

  • Change SeedBatchPropagator.get_buffer_size() to return a megabyte-based (ceil’d) value.
  • Update ArraySequence construction sites to pass the new buffer size value directly (no // MEGABYTE at call sites).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cuslines/cuda_python/cu_tractography.py Updates ArraySequence buffer size argument for SFT generation to use the new units returned by the propagator.
cuslines/cuda_python/cu_propagate_seeds.py Changes buffer size calculation to return MB (rounded up) and updates ArraySequence creation accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 248 to 252
seeds[idx * global_chunk_sz : (idx + 1) * global_chunk_sz].shape[0]
)
array_sequence = ArraySequence(
(item for gen in generators for item in gen), buffer_size // MEGABYTE
(item for gen in generators for item in gen), buffer_size
)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In generate_sft, the ArraySequence is built from generators that are created from SeedBatchPropagator state. Because SeedBatchPropagator.as_generator() reads from self.slines/self.sline_lens (which are overwritten on each propagate() call), collecting generators across multiple chunks and consuming them after the loop will yield the last chunk’s data repeatedly (earlier chunk results are lost). Consider materializing/copying each chunk’s results before the next propagate(), or restructure to yield streamlines immediately per chunk instead of storing generators.

Copilot uses AI. Check for mistakes.
Comment on lines 250 to 252
array_sequence = ArraySequence(
(item for gen in generators for item in gen), buffer_size // MEGABYTE
(item for gen in generators for item in gen), buffer_size
)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the conversion by MEGABYTE was removed here, MEGABYTE appears to be unused in this module now. Removing the unused import will avoid lint/static-analysis failures and keep the unit handling clear.

Copilot uses AI. Check for mistakes.
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