Repository navigation
Commit 060a508
committed
CUDA backend: add a PTE device-id remap tool under backends/cuda/scripts
A CUDA program records the devices it was exported for in its planned
memory table, in tensor placement info, and in each delegate's
target_device compile spec. All three must agree, so a program
exported on a shared multi-GPU box for whichever GPU was free
(cuda:3, say) does not load on a single-GPU robot as cuda:0, and the
loader has no way to move it.
scripts/remap_pte_devices.py rewrites all three places in the file
with one mapping, dense by default (3, 5, 7 become 0, 1, 2, keeping
their order) or explicit (--mapping 3=0,5=0 collapses everything
onto one device). The output is an ordinary PTE that loads as if it
had been exported for the new devices, so the runtime needs no
remapping support of its own. The companion .ptd is untouched:
tensor data carries no device ids. A mapping that does not cover a
recorded device is refused, so a file is never rewritten only in
part.
The tool lives in a new backends/cuda/scripts directory next to
merge_ptes.py, which moves there with it; a forwarding module stays
at the old merge_ptes path so existing imports and the documented
command keep working. Callers (CI, the CUDA examples README, tests,
BUCK targets) point at the new module paths.1 parent 679e49e commit 060a508
9 files changed
Lines changed: 1396 additions & 745 deletions
File tree
- .github/workflows
- backends/cuda
- scripts
- tests
- examples/cuda
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 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 | + | |
167 | 193 | | |
168 | 194 | | |
169 | 195 | | |
| |||
0 commit comments