Repository navigation
Commit f8245a5
committed
build: infer toolchain from external CC/CXX; fix externally-supplied-clang regression
When CUDA_PYTHON_TOOLCHAIN is unset on Linux, infer the toolchain from the
externally-set CC/CXX (CXX preferred, fall back to CC): a value containing
'clang' selects llvm, else gnu. This fixes the regression reported by
sylvesterkaczmarek: previously the default 'gnu' flag set (incl.
-fno-var-tracking-assignments) reached an externally-supplied clang
because the default path did not override CC/CXX and the old _is_clang strip
was removed. Now clang is inferred and the llvm flag set (no gcc-only flags,
-fuse-ld=lld) is used, and the external compiler is left in place, so a
wrapper like CC='sccache clang' survives and gets the llvm flags.
When CUDA_PYTHON_TOOLCHAIN is set it takes precedence over an externally-
set CC: a mismatch warns (CC only; CXX commonly defaults to 'c++' and is not
a reliable user-intent signal) and the external CC is overridden.
The shared toolchain helpers remain byte-identical across the two
build_hooks.py via the 'keep in sync' markers. _resolve_toolchain_name now
returns an 'explicit' flag so _apply_toolchain_env only overrides CC/CXX
when the toolchain was chosen explicitly (not inferred).
Tests: regression tests for externally-supplied CC=clang (infer llvm, no
gcc-only flags, CC survives), CC=gcc (infer gnu), and the explicit
mismatch/no-mismatch cases. A module-level autouse fixture cleans
CC/CXX/LDSHARED per test because _apply_toolchain_env sets them directly
in os.environ, which monkeypatch does not revert.1 parent b0289f6 commit f8245a5
4 files changed
Lines changed: 262 additions & 38 deletions
File tree
- cuda_bindings
- tests
- cuda_core
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
108 | 118 | | |
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
118 | 150 | | |
119 | | - | |
| 151 | + | |
120 | 152 | | |
121 | 153 | | |
122 | | - | |
123 | | - | |
| 154 | + | |
| 155 | + | |
124 | 156 | | |
125 | | - | |
126 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
127 | 161 | | |
128 | | - | |
| 162 | + | |
129 | 163 | | |
130 | 164 | | |
131 | 165 | | |
| |||
164 | 198 | | |
165 | 199 | | |
166 | 200 | | |
167 | | - | |
| 201 | + | |
168 | 202 | | |
169 | 203 | | |
170 | 204 | | |
| |||
199 | 233 | | |
200 | 234 | | |
201 | 235 | | |
202 | | - | |
| 236 | + | |
203 | 237 | | |
204 | 238 | | |
205 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
135 | 145 | | |
136 | 146 | | |
137 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | | - | |
99 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
104 | 115 | | |
105 | 116 | | |
106 | 117 | | |
107 | 118 | | |
108 | 119 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
114 | 147 | | |
115 | | - | |
| 148 | + | |
116 | 149 | | |
117 | 150 | | |
118 | | - | |
119 | | - | |
| 151 | + | |
| 152 | + | |
120 | 153 | | |
121 | | - | |
122 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
123 | 158 | | |
124 | | - | |
| 159 | + | |
125 | 160 | | |
126 | 161 | | |
127 | 162 | | |
| |||
160 | 195 | | |
161 | 196 | | |
162 | 197 | | |
163 | | - | |
| 198 | + | |
164 | 199 | | |
165 | 200 | | |
166 | 201 | | |
| |||
190 | 225 | | |
191 | 226 | | |
192 | 227 | | |
193 | | - | |
| 228 | + | |
194 | 229 | | |
195 | 230 | | |
196 | 231 | | |
| |||
0 commit comments