-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce runtime dependency on torch #205
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! I think it looks good.
As you know TritonCPU is forked from Triton. And we periodically rebase onto the latest Triton. We always see many merge conflicts. While this PR is a small change, it's still highly likely to cause future merge conflicts.
So, can you also make a PR in the upstream?
I agree that this change is not specific to the Triton CPU backend and should go through the original repo. |
4c27dff
to
36fd4ca
Compare
Opened triton-lang#5490. The 6 test failures are due to accidentally keeping the device parameter which works in numpy 2.0.0 or later which is what I was testing on. This has been fixed and now this PR only includes the cpu backend specific changes. |
36fd4ca
to
e8d7023
Compare
Arg, there's now a synchronization issue with upstream. Hopefully it's ok to make these modifications to get it to work. Sorry about the back-and-forth, third time's the charm. Haven't been running the tests due to some (unrelated) segfaults.
|
Fixes #204. It is now possible to import triton, execute a kernel, and autotune, all without torch.
Relatively straightforward translation of
torch.tensor
->np.array
,torch.float
->np.float32
,np.quantile
->torch.quantile
(note the default method for both islinear
), and so on. Luckily numpy hasnp.min
,np.max
,np.mean
,np.median
, andnp.all
with the same semantics as the respective torch functions, so the samegetattr(np, return_mode)(times)
trick can be used.I was getting
which was fixed either by importing torch or by adding
omp
tolibraries
in the cpu driver,triton-cpu/third_party/cpu/backend/driver.py
Line 28 in daa7eb0
but I can't seem to replicate this anymore.
New contributor declaration
I am not making a trivial change, such as fixing a typo in a comment.
I have written a PR description following these
rules.
I have run
pre-commit run --from-ref origin/main --to-ref HEAD
.Select one of the following.
/test
forlit
tests/unittest
for C++ tests/python/test
for end-to-end testsSelect one of the following.
lit
tests.lit
tests I have added follow these best practices,including the "tests should be minimal" section. (Usually running Python code
and using the instructions it generates is not minimal.)