Repository navigation
Commit fc21064
Give the CUDA extension the toolkit and the runtime it needs (pytorch#23100)
The CUDA extension could not build in two configurations. In both cases
it used something it never
asked for.
## It links the toolkit without looking for it
It worked anyway, because the Torch package found a few lines above in
the parent defines that
target, but only when Torch itself is a CUDA build. Anywhere that is not
true, the configure step
stops and says the target was not found.
The extension already looks for its accelerator package on the other
branch of the same condition,
and both backends that link the same library make the call for
themselves. This adds the matching
call.
## It needs the runtime, and in some builds had nothing to link it
against
The guard logs, so the extension needs the ExecuTorch runtime. It took
that through a helper which
does nothing when a build produces no shared runtime, so in those builds
the reference had nothing
to resolve against.
Where one shared runtime exists, the helper still retains it, so a
process keeps a single registry.
Where it does not, the extension links the static core, which is already
defined long before this
directory is configured.
That leaves the library holding a copy of the platform layer, and a copy
that nothing has started
aborts the first time anything reads a timestamp. So the guard's factory
starts it on the way in.
The factory is the only way to make a guard, the call is safe to repeat,
and the kernel registry
already does the same thing at its own entry point for the same reason.
Where the program around it
already carries the runtime, the two resolve to one copy and the call
changes nothing.
## Testing
I reproduced the missing toolkit target two ways: with a small project
whose subdirectory links the
runtime library without looking for the toolkit, and in this tree by
configuring an accelerator
build against a processor only Torch. Both configure cleanly once the
call is there.
For the runtime, I built the library with unresolved symbols rejected,
which is how it links where
there is no shared runtime to defer to. It fails without this change and
links with it. A log
running before the platform layer is started aborts, and starting it at
the entry point stops that.
The private default constructor makes the factory the only entry, so
nothing reaches a log first.
Co-authored-by: PyTorch Bot <pytorchbot@users.noreply.github.com>1 parent b253af8 commit fc21064
2 files changed
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
52 | 63 | | |
53 | 64 | | |
54 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
0 commit comments