Repository navigation
Commit 8d79988
committed
Add the two AOTI shims PyTorch 2.14 links against, and export all three
Lowering a CUDA model for a Windows target fails at link time:
x86_64-w64-mingw32-ld: undefined reference to `aoti_torch_dtype_uint8'
x86_64-w64-mingw32-ld: undefined reference to `aoti_torch_empty_strided_pinned'
x86_64-w64-mingw32-ld: undefined reference to `aoti_torch_is_defined'
collect2: error: ld returned 1 exit status
PyTorch generates a wrapper for the model and links it against this project's
shims. The wrapper's own header started calling these three in 2.14, where it
called none of them before, so the link now needs all three present.
Two did not exist here:
`aoti_torch_is_defined` asks whether a handle refers to a real tensor. PyTorch has
an undefined-tensor state with no equivalent here, so this is a null check.
`aoti_torch_empty_strided_pinned` asks for page-locked host memory, which lets the
copy of the model's constants to the device overlap with filling the next buffer.
There is no allocator for that memory here, so this reports that and the caller
takes the plain synchronous copy it already falls back to. That path is not an
error case: the calling code is named for trying, and every way it can fail logs
that it is falling back and carries on. Adding a real pinned allocator means
teaching the storage layer a new kind of memory and a matching way to release it,
which is a change of its own rather than part of moving a version pin.
The third, `aoti_torch_dtype_uint8`, was already implemented and simply missing
from the list of names the Windows link stub exports, along with the other two.
That stub is a checked-in file, so it is regenerated here. Every previous pin
bump has had to do the same.
Test Plan:
Read the requirement from the generated wrapper's header on both branches rather
than inferring it from the link error: it names these three in 2.14 and none of
them in 2.13, which is why this appears only after the pin moves.
Compiled the common shims and confirmed with the symbol table that
`aoti_torch_is_defined` is defined rather than merely declared. Checked its
signature against PyTorch's own header parameter by parameter, and matched the
pointer spelling the neighbouring shims already use for a tensor handle.
Regenerated the link stub from the names it already exported plus these three, so
it went from 42 to 45. Confirmed the result is a strict superset, that nothing was
dropped, that the counts of the two kinds of entry agree, and that all three names
are now in it.
Confirmed the caller treats a refusal as an ordinary outcome by reading it: it
returns empty and logs that it is falling back to the synchronous copy.
Formatting is clean on the changed files.
The CUDA shim file needs the CUDA headers to compile, which this machine does not
have, so that half is for CI to confirm. Whether a Windows target now links is
also for CI, since it needs the cross toolchain.1 parent 6a7ae1f commit 8d79988
5 files changed
Lines changed: 48 additions & 0 deletions
File tree
- backends
- aoti
- cuda/runtime
- shims
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
198 | 216 | | |
199 | 217 | | |
200 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
98 | 118 | | |
99 | 119 | | |
100 | 120 | | |
| |||
0 commit comments