Skip to content

Use cudart symbols from the main program. - #994

Merged
soumith merged 1 commit into
pytorch:masterfrom
colesbury:cudart
Mar 13, 2017
Merged

soumith merged 1 commit into
pytorch:masterfrom
colesbury:cudart

Conversation

@colesbury

Copy link
Copy Markdown
Contributor

Our extension library links against cudart and pulls in the symbols. Use
LoadLibrary(None) to use the same symbols as the _C extension.

This fixes the PyTorch wheel when you don't have system CUDA installed.

Our extension library links against cudart and pulls in the symbols. Use
LoadLibrary(None) to use the same symbols as the _C extension.

This fixes the PyTorch wheel when you don't have system CUDA installed.
@soumith
soumith merged commit 704ee3c into pytorch:master Mar 13, 2017
jjsjann123 pushed a commit to jjsjann123/pytorch that referenced this pull request Aug 5, 2021
pedronaugusto added a commit to pedronaugusto/pytorch that referenced this pull request Aug 7, 2026
…declines

TORCH_IMPL_FUNC(ufunc_add_CUDA) carried a Sprint F.1 bypass: when `out` or
either input was non-contiguous it contiguified the inputs, computed into a
fresh buffer through haganeOpsAdd directly -- skipping add_stub and the whole
vendor route -- then did out.set_(fresh). That was two silent-wrongs.

torch.add(a, b, out=base[::2]) left `base` entirely untouched, because set_
rebinds the caller's tensor to the fresh storage; an explicit out= never
received the result and the view's stride silently changed 2 -> 1. Measured
all-zeros where CPU gives [3,0,3,0,3,0,3,0]. Separately add(x.t(), y).stride()
returned (4,1) against CPU/CUDA's (1,6), since torch's meta function assigns the
output the first input's strides and a contiguous substitute is an observable
layout change.

The bypass was not load-bearing: sub/mul/div never had it and are correct, and
Double already took add_stub while non-contiguous. Removing it makes the wrapper
the thin add_stub call its own header describes, and lets bin_g route the
non-contiguous inputs it was hiding -- 60 stashes/step on ARDY, 579 -> 519, with
zero bin_g out_not_contiguous declines. The capture-tape concern it was written
for is pytorch#1003's, which is fixed; the conformance suite (pytorch#994) is unchanged by
this commit (its one red row, retagged_activation_backward, is pre-existing and
filed as pytorch#1028).

note_general_alpha closes the instrument gap that made this hard to find: the
alpha bridge recorded nothing on its MLX path, so those 60 stashes arrived with
no named reason. It reports compute dtype, whether operand 2 is a cpu scalar,
and whether alpha*b is exactly representable -- the three facts that decide
whether a caller could be folded. On ARDY it fires zero times, which is what
established that the general-alpha fold this slice was planned around is worth
no stashes at all (pytorch#1029).

Authored with Claude.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants