Skip to content

ROI pool CUDA: compare in acc_type to fix half/MSVC build#9399

Open
kimchioverfit wants to merge 6 commits intopytorch:mainfrom
kimchioverfit:fix/roi-pool-half-msvc
Open

ROI pool CUDA: compare in acc_type to fix half/MSVC build#9399
kimchioverfit wants to merge 6 commits intopytorch:mainfrom
kimchioverfit:fix/roi-pool-half-msvc

Conversation

@kimchioverfit
Copy link

Fixes #9246

Summary

Fix MSVC + CUDA compilation failure in ROI Pool when T=half is dispatched.

On Windows (MSVC) with CUDA, instantiating the kernel through AT_DISPATCH_FLOATING_TYPES_AND_HALF causes an ambiguous operator> error when comparing two at::Half values.

Root Cause

MSVC reports ambiguity for operator> when T=half inside roi_pool_forward_kernel_impl, due to multiple viable overloads.

Change

Perform the comparison in at::acc_type<T, true> instead of T to avoid operator ambiguity while preserving numerical behavior.

BC / Functional Impact

No functional change is expected.
The modification only affects the comparison type used during compilation.

@pytorch-bot
Copy link

pytorch-bot bot commented Feb 21, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9399

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 20 Pending

As of commit 1d9444a with merge base 4729419 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla
Copy link

meta-cla bot commented Feb 21, 2026

Hi @kimchioverfit!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link

meta-cla bot commented Feb 21, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the cla signed label Feb 21, 2026
No functional changes.
Only formatting adjustments required by clang-format (include order and spacing).
@kimchioverfit
Copy link
Author

kimchioverfit commented Feb 24, 2026

I noticed an ongoing regression where torchvision / PyTorch nightly Windows CUDA 12.6 and 12.8 jobs are failing with a similar cudaErrorSymbolNotFound issue.

Since CUDA 13.0 passes and this appears to reproduce in nightly as well, this may not be directly caused by this PR.

That said, I might be mistaken, so please let me know if there’s anything I should further investigate or adjust on my side.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Hi @kimchioverfit , thanks for the PR.

I'm not sure we'll be able to move forward with it, because the issue seems to be compiler specific and we only try to support the compiler that torchvision is built with for the official wheels (I'm not sure which one it is, but it should be findable through our github workflows in .github).

Since it seems that you have a compilation error, can you just deactivate that kind of error in the compiler you're using? Otherwise, I suggest you align your compiler with the one torchvision uses.

@kimchioverfit
Copy link
Author

kimchioverfit commented Feb 25, 2026

@NicolasHug

I noticed that the CUDA 12.6/12.8 failure is marked as a “NEW FAILURE” in this PR.

However, Actions run #22314833507 already shows CUDA 12.6/12.8 failing with the same cudaErrorSymbolNotFound error.

Based on that, it seems this might be a pre-existing trunk issue rather than something introduced by this change.

Would it be possible to re-run the CI or double-check whether this failure is indeed unrelated to this PR?

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CUDA][Suggestion] ROI Pool half-precision build error due to ambiguous comparison

2 participants