Commit 2b5b367
committed
fix(warp): fix mode type mismatch in Warp fallback path on Blackwell GPUs
When USE_COMPILED=True, Warp.__init__ stores integer interpolation/padding
modes (e.g. 1, 0, 7) for grid_pull. However, when a Blackwell GPU triggers
the runtime fallback in forward(), F.grid_sample is called with those integers
instead of the required strings ("bilinear", "zeros", etc.), causing a crash.
Fix by always storing _interp_mode_native and _padding_mode_native as string
attributes in __init__, and using them exclusively in the F.grid_sample call.
Also clean up test_spatial_gpu_support.py:
- Remove duplicate test_non_cuda_device_always_supported (identical to cpu test)
- Implement test_resample_compilation_flag_respected using unittest.mock so it
runs without a physical Blackwell device
- Remove duplicate if __name__ == "__main__" block
https://claude.ai/code/session_015SGxtVTnVKUHk7hWHLSRZK1 parent 057ff4d commit 2b5b367
File tree
2 files changed
+34
-25
lines changed- monai/networks/blocks
- tests/transforms
2 files changed
+34
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
| |||
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
81 | | - | |
| 93 | + | |
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
| |||
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
97 | | - | |
| 109 | + | |
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
| |||
147 | 159 | | |
148 | 160 | | |
149 | 161 | | |
150 | | - | |
| 162 | + | |
151 | 163 | | |
152 | 164 | | |
153 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 32 | | |
37 | 33 | | |
38 | 34 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
| |||
56 | 50 | | |
57 | 51 | | |
58 | 52 | | |
59 | | - | |
60 | 53 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
| |||
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | | - | |
0 commit comments