-
Notifications
You must be signed in to change notification settings - Fork 1.5k
8587 test erros on pytorch release 2508 on series 50 #8770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 41 commits
ba56a6d
5216b7a
eacd783
c64825f
66b6c17
19cab57
09c2cd9
7cd0607
3fd7546
4f6df07
36e2623
356956a
17b9910
8de64af
7c2ddb6
cfe5524
1dec216
ec8bf1f
4b5bf1e
23f0290
057ff4d
2b5b367
80124e6
1b5ac46
0a90770
b5b1eff
4a54359
f07dcb1
2feca34
0b887a3
e57f64e
e2b99da
256b671
f3e612c
43dd636
f284c48
c00aaf8
0cd053a
d30be44
08a1cce
f6473f9
fe40b4d
e79646c
c72c2d5
dd8cd19
f4cda7d
f11844b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,35 @@ | |
| __all__ = ["spatial_resample", "orientation", "flip", "resize", "rotate", "zoom", "rotate90", "affine_func"] | ||
|
|
||
|
|
||
| def _compiled_unsupported(device: torch.device) -> bool: | ||
| """ | ||
| Return True if ``monai._C`` (the compiled C extension providing ``grid_pull``) is not | ||
| compiled with support for the given CUDA device's compute capability. | ||
|
|
||
| Args: | ||
| device: The torch device to check for compiled extension support. | ||
|
|
||
| Returns: | ||
| True if the device is CUDA with compute capability major >= 12 (Blackwell+), | ||
| False otherwise. Always returns False for CPU devices. | ||
|
|
||
| Note: | ||
| ``monai._C`` is built at install time against a fixed set of CUDA architectures. | ||
| NVIDIA Blackwell GPUs (sm_120, compute capability 12.x) and newer were not included in | ||
| the default ``TORCH_CUDA_ARCH_LIST`` when the MONAI slim image was originally built, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember if I asked you, but have you tried building the slim image with the new capabilities added to TORCH_CUDA_ARCH_LIST? There must be a way of adding these as well for the main MONAI image.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I haven't tried rebuilding the slim image with sm_120 added to TORCH_CUDA_ARCH_LIST. The current Dockerfile.slim sets I opted for the runtime fallback approach ( However, I think a better approach is to also update TORCH_CUDA_ARCH_LIST and rebuild the image so a future slim image natively supports Blackwell. Let me try that and include it as part of this PR. |
||
| so executing ``grid_pull`` on those devices produces incorrect results. Falling back to | ||
| the PyTorch-native ``affine_grid`` + ``grid_sample`` path (``USE_COMPILED=False``) gives | ||
| correct output on all architectures. | ||
|
|
||
| The threshold (``major >= 12``) matches the first architecture family (Blackwell, sm_120) | ||
| that shipped after the highest sm supported in the current default build list (sm_90, | ||
| Hopper). Adjust this constant when ``monai._C`` is rebuilt with sm_120+ support. | ||
| """ | ||
| if device.type != "cuda": | ||
| return False | ||
| return torch.cuda.get_device_properties(device).major >= 12 | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| def _maybe_new_metatensor(img, dtype=None, device=None): | ||
| """create a metatensor with fresh metadata if track_meta is True otherwise convert img into a torch tensor""" | ||
| return convert_to_tensor( | ||
|
|
@@ -158,7 +187,8 @@ def spatial_resample( | |
| xform_shape = [-1] + in_sp_size | ||
| img = img.reshape(xform_shape) | ||
| img = img.to(dtype_pt) | ||
| if isinstance(mode, int) or USE_COMPILED: | ||
| _use_compiled = USE_COMPILED and not _compiled_unsupported(img.device) | ||
| if isinstance(mode, int) or _use_compiled: | ||
| dst_xform = create_translate(spatial_rank, [float(d - 1) / 2 for d in spatial_size]) | ||
| xform = xform @ convert_to_dst_type(dst_xform, xform)[0] | ||
| affine_xform = monai.transforms.Affine( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.