Skip to content

Fix split-memory path of TV denoising (tv_proximal.cu) - #806

Open
AnderBiguri wants to merge 1 commit into
masterfrom
fix/tv-proximal-split-path
Open

AnderBiguri wants to merge 1 commit into
masterfrom
fix/tv-proximal-split-path

Conversation

@AnderBiguri

Copy link
Copy Markdown
Member

Three bugs in the path used when the image does not fit in GPU memory (splits>1), not covered by #804:

  • When reloading d_src for the last chunk, the memset zeroed d_pz instead of d_src. It ran on stream 1 while d_pz was being uploaded and negated on stream 4, so pz on the last chunk was fully or partly reset each time, depending on timing.
  • At the end of each split, the copies of u/px/py/pz back to the host were not waited for. The first device of the next split reads its halo from the part of the host array the last device of this split is still writing. Synchronize all devices at the end of each split, as GD_TV.cu and GD_AwTV.cu already do.
  • buffer_length could be computed as 0 when a GPU has little spare memory, so the main loop never advanced. Clamp it to 1; memory for that case is already checked above.

Not run on GPU hardware.

Claude-Session: https://claude.ai/code/session_01L6n1VLmYDf6QeHNsr3mDwy

Three bugs in the path used when the image does not fit in GPU memory
(splits>1), not covered by #804:

- When reloading d_src for the last chunk, the memset zeroed d_pz instead
  of d_src. It ran on stream 1 while d_pz was being uploaded and negated on
  stream 4, so pz on the last chunk was fully or partly reset each time,
  depending on timing.
- At the end of each split, the copies of u/px/py/pz back to the host were
  not waited for. The first device of the next split reads its halo from the
  part of the host array the last device of this split is still writing.
  Synchronize all devices at the end of each split, as GD_TV.cu and
  GD_AwTV.cu already do.
- buffer_length could be computed as 0 when a GPU has little spare memory,
  so the main loop never advanced. Clamp it to 1; memory for that case is
  already checked above.

Not run on GPU hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6n1VLmYDf6QeHNsr3mDwy
@AnderBiguri

Copy link
Copy Markdown
Member Author

@jeffdaily You may want to have a look at this, as my agent has suggested these extra cases. I can not see any issue with them, but I don't have the hardware to test all cases, so if you could do that in yours, it would be fantastic

This branch has not been deployed

No deployments
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