Skip to content
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

Allow third-party backends to add submodules to triton.language.extra #4503

Merged

Conversation

Alfie-Edwards
Copy link
Contributor

@Alfie-Edwards Alfie-Edwards commented Aug 12, 2024

Add an optional language directory to backends. The contents of the directory is added to triton.language.extra when the wheel is built.
Update the existing triton.language.extra.cuda and triton.language.extra.hip modules to use the new mechanism.

The core Triton is a small number of people, and we receive many PRs (thank
you!). To help us review your code more quickly, if you are a new
contributor (less than 3 PRs merged) we ask that you complete the following
tasks and include the filled-out checklist in your PR description.

Complete the following tasks before sending your PR, and replace [ ] with
[x] to indicate you have done them.

  • 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.

    • I have added tests.
      • /test for lit tests
      • /unittest for C++ tests
      • /python/test for end-to-end tests
    • This PR does not need a test because It is already tested by python/test/unit/language/test_core.py::test_math_extern.
  • Select one of the following.

    • I have not added any lit tests.
    • The 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.)

@Alfie-Edwards
Copy link
Contributor Author

The tests should pass now.

@Alfie-Edwards
Copy link
Contributor Author

Alfie-Edwards commented Aug 13, 2024

Tests passed but I forgot to re-run pre-commit, I've run it now.

@Alfie-Edwards
Copy link
Contributor Author

Alfie-Edwards commented Aug 13, 2024

For some reason there were more pre-commit changes after the running it a second time. Looks like everything is passing pre-commit now.

@Alfie-Edwards Alfie-Edwards force-pushed the alfiee/third-party-libdevice branch from 07b17df to 304f579 Compare August 14, 2024 17:35
@Alfie-Edwards
Copy link
Contributor Author

Rebased

@Alfie-Edwards Alfie-Edwards force-pushed the alfiee/third-party-libdevice branch from 304f579 to 962620d Compare August 15, 2024 13:21
@Alfie-Edwards
Copy link
Contributor Author

Rebased

@ThomasRaoux
Copy link
Collaborator

Would #4539 solve your problem?

@Alfie-Edwards
Copy link
Contributor Author

Would #4539 solve your problem?

Yes, that solves the issue of dispatching to third-party libdevice functions 👍.
Maybe the rest of this change is still nice to have though to improve parity between the in-tree backends and third-party backends?

With the current third-party backend mechanism, it's possible for a backend to be entirely out of tree. The only caveat is that without in-tree changes you can only get python files into triton.backends.x, and even that feels slightly hacky since the compiler.py and driver.py in that namespace are generally loaded via a separate mechanism.

@Alfie-Edwards Alfie-Edwards changed the title Allow triton.language.extra.libdevice to dispatch to third-party backends Allow third-party backends to add submodules to triton.language.extra Aug 20, 2024
@Alfie-Edwards Alfie-Edwards force-pushed the alfiee/third-party-libdevice branch from 962620d to 3ae707b Compare August 27, 2024 08:27
@ThomasRaoux
Copy link
Collaborator

Sorry for the delay. Do you still want to push this? The changes seem reasonable. Could you resolve conflicts if you still need this PR

@Alfie-Edwards Alfie-Edwards force-pushed the alfiee/third-party-libdevice branch from 3ae707b to aef71cc Compare October 7, 2024 09:53
Add an optional language directory to backends. The contents of the
directory is added to the `triton.language.extra` namespace when the
wheel is built.
Change the existing `triton.language.extra.cuda` and
`triton.language.extra.hip` modules to use the new mechanism.
@Alfie-Edwards Alfie-Edwards force-pushed the alfiee/third-party-libdevice branch from aef71cc to 03aa528 Compare October 7, 2024 09:56
@Alfie-Edwards
Copy link
Contributor Author

Sorry for the delay. Do you still want to push this? The changes seem reasonable. Could you resolve conflicts if you still need this PR

Hi, no worries about the delay. Yes I'm still keen to push this. I've rebased the changes onto main.

@ThomasRaoux ThomasRaoux merged commit 53166ef into triton-lang:main Oct 7, 2024
7 checks passed
sfzhu93 pushed a commit to sfzhu93/triton that referenced this pull request Oct 11, 2024
…a` (triton-lang#4503)

Add an optional language directory to backends. The contents of the
directory is added to `triton.language.extra` when the wheel is built.
Update the existing `triton.language.extra.cuda` and
`triton.language.extra.hip` modules to use the new mechanism.

The core Triton is a small number of people, and we receive many PRs
(thank
you!).  To help us review your code more quickly, **if you are a new
contributor (less than 3 PRs merged) we ask that you complete the
following
tasks and include the filled-out checklist in your PR description.**

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them.

- [x] I am not making a trivial change, such as fixing a typo in a
comment.

- [x] I have written a PR description following these
  [rules](https://cbea.ms/git-commit/#why-not-how).

- [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`.

- Select one of the following.
  - [ ] I have added tests.
    - `/test` for `lit` tests
    - `/unittest` for C++ tests
    - `/python/test` for end-to-end tests
- [x] This PR does not need a test because `It is already tested by
python/test/unit/language/test_core.py::test_math_extern`.

- Select one of the following.
  - [x] I have not added any `lit` tests.
- [ ] The `lit` tests I have added follow these [best
practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices),
including the "tests should be minimal" section. (Usually running Python
code
    and using the instructions it generates is not minimal.)
Luosuu pushed a commit to Luosuu/triton that referenced this pull request Nov 13, 2024
…a` (triton-lang#4503)

Add an optional language directory to backends. The contents of the
directory is added to `triton.language.extra` when the wheel is built.
Update the existing `triton.language.extra.cuda` and
`triton.language.extra.hip` modules to use the new mechanism.

The core Triton is a small number of people, and we receive many PRs
(thank
you!).  To help us review your code more quickly, **if you are a new
contributor (less than 3 PRs merged) we ask that you complete the
following
tasks and include the filled-out checklist in your PR description.**

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them.

- [x] I am not making a trivial change, such as fixing a typo in a
comment.

- [x] I have written a PR description following these
  [rules](https://cbea.ms/git-commit/#why-not-how).

- [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`.

- Select one of the following.
  - [ ] I have added tests.
    - `/test` for `lit` tests
    - `/unittest` for C++ tests
    - `/python/test` for end-to-end tests
- [x] This PR does not need a test because `It is already tested by
python/test/unit/language/test_core.py::test_math_extern`.

- Select one of the following.
  - [x] I have not added any `lit` tests.
- [ ] The `lit` tests I have added follow these [best
practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices),
including the "tests should be minimal" section. (Usually running Python
code
    and using the instructions it generates is not minimal.)
guacamoleo pushed a commit to guacamoleo/triton that referenced this pull request Nov 14, 2024
…a` (triton-lang#4503)

Add an optional language directory to backends. The contents of the
directory is added to `triton.language.extra` when the wheel is built.
Update the existing `triton.language.extra.cuda` and
`triton.language.extra.hip` modules to use the new mechanism.

The core Triton is a small number of people, and we receive many PRs
(thank
you!).  To help us review your code more quickly, **if you are a new
contributor (less than 3 PRs merged) we ask that you complete the
following
tasks and include the filled-out checklist in your PR description.**

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them.

- [x] I am not making a trivial change, such as fixing a typo in a
comment.

- [x] I have written a PR description following these
  [rules](https://cbea.ms/git-commit/#why-not-how).

- [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`.

- Select one of the following.
  - [ ] I have added tests.
    - `/test` for `lit` tests
    - `/unittest` for C++ tests
    - `/python/test` for end-to-end tests
- [x] This PR does not need a test because `It is already tested by
python/test/unit/language/test_core.py::test_math_extern`.

- Select one of the following.
  - [x] I have not added any `lit` tests.
- [ ] The `lit` tests I have added follow these [best
practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices),
including the "tests should be minimal" section. (Usually running Python
code
    and using the instructions it generates is not minimal.)
bertmaher pushed a commit to bertmaher/triton that referenced this pull request Dec 10, 2024
…a` (triton-lang#4503)

Add an optional language directory to backends. The contents of the
directory is added to `triton.language.extra` when the wheel is built.
Update the existing `triton.language.extra.cuda` and
`triton.language.extra.hip` modules to use the new mechanism.

The core Triton is a small number of people, and we receive many PRs
(thank
you!).  To help us review your code more quickly, **if you are a new
contributor (less than 3 PRs merged) we ask that you complete the
following
tasks and include the filled-out checklist in your PR description.**

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them.

- [x] I am not making a trivial change, such as fixing a typo in a
comment.

- [x] I have written a PR description following these
  [rules](https://cbea.ms/git-commit/#why-not-how).

- [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`.

- Select one of the following.
  - [ ] I have added tests.
    - `/test` for `lit` tests
    - `/unittest` for C++ tests
    - `/python/test` for end-to-end tests
- [x] This PR does not need a test because `It is already tested by
python/test/unit/language/test_core.py::test_math_extern`.

- Select one of the following.
  - [x] I have not added any `lit` tests.
- [ ] The `lit` tests I have added follow these [best
practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices),
including the "tests should be minimal" section. (Usually running Python
code
    and using the instructions it generates is not minimal.)
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