Skip to content

Backport "Fix stain covariance centering with CuPy CUB" (#1142) - #1154

Merged
rapids-bot[bot] merged 1 commit into
rapidsai:release/26.10from
jakirkham:backport-26.10/grlee77/fix/cupy-14-2-stain-normalizer-covariance
Sep 9, 2026
Merged

Backport "Fix stain covariance centering with CuPy CUB" (#1142)#1154
rapids-bot[bot] merged 1 commit into
rapidsai:release/26.10from
jakirkham:backport-26.10/grlee77/fix/cupy-14-2-stain-normalizer-covariance

Conversation

@jakirkham

@jakirkham jakirkham commented Sep 8, 2026

Copy link
Copy Markdown
Member

This was originally submitted as a bug fix for a test fix in cuCIM 26.10 with PR #1142 . However it wound up being merged after main was updated to 26.12. To ensure this fix is properly included in 26.10 as intended, this backports the fix to the release/26.10 branch. Have done this by cherry-picking the merged change f849ce3 from main.

Original PR body text:

resolves #1137 by making stain normalization robust to a small change in numerical accuracy of some axis-specific cupy.mean operations when CUB is enabled in CuPy 14.2.

The root cause and two possible fixes are explained in this comment in that issue: #1137 (comment)

The second option of shifting each row to make the computation numerically robust while preserving the performance of float32 reduction was kept.

resolves rapidsai#1137 by making stain normalization robust to a small change in numerical accuracy of some axis-specific `cupy.mean` operations when CUB is enabled in CuPy 14.2.

The root cause and two possible fixes are explained in this comment in that issue:
rapidsai#1137 (comment)

The second option of shifting each row to make the computation numerically robust while preserving the performance of float32 reduction was kept.

Authors:
  - Gregory Lee (https://github.com/grlee77)

Approvers:
  - https://github.com/jakirkham

URL: rapidsai#1142
@jakirkham jakirkham added this to the v26.10.00 milestone Sep 8, 2026
@jakirkham
jakirkham requested a review from grlee77 September 8, 2026 21:01
@jakirkham
jakirkham requested a review from a team as a code owner September 8, 2026 21:01
@jakirkham jakirkham added this to cucim Sep 8, 2026
@jakirkham jakirkham added bug Something isn't working non-breaking Introduces a non-breaking change labels Sep 8, 2026

@grlee77 grlee77 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for adding the backport @jakirkham

@grlee77

grlee77 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit 4491322 into rapidsai:release/26.10 Sep 9, 2026
75 checks passed
@github-project-automation github-project-automation Bot moved this to Done in cucim Sep 9, 2026
@jakirkham
jakirkham deleted the backport-26.10/grlee77/fix/cupy-14-2-stain-normalizer-covariance branch September 9, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants