microsoft / triton-shared

Shared Middle-Layer for Triton Compilation
MIT License
134 stars 26 forks source link

[Bug]: Triton shared does not build "out of the box" #91

Closed aaronsm closed 5 months ago

aaronsm commented 5 months ago

The instructions for building Triton shared in the README are wrong --

"This repo doesn't build by itself and must instead by built from within a Triton repo where it is included as a submodule. To add the shared middle-layer in your Triton build do export TRITON_CODEGEN_TRITON_SHARED=1 before invoking your build."

To build Triton shared you need to do two things --

1) Third party backends are commented out in triton/python/setup.py and will not be built unless lines 312-315 are uncommented.

2) The environment variable TRITON_CODEGEN_TRITON_SHARED is used by get_codegen_backends() in setup.py to determine the directory name for the plugin. The environment variable uses an underscore, "triton_shared", while the git repo uses a dash, "triton-shared". The directory must be renamed to "triton_shared" or it will not be built.

nhat-nguyen commented 5 months ago

This issue can probably be merged with #76. Since early December last year, triton refactored 3rd party plugin integrations. The triton commit that will work with what we have is 56c284cf7e39f249cdf1d8d5dba7892deb0286d6. We used to be a submodule of triton and got removed as part of that refactor. With the old build step, you won't have this issue since triton-shared is already named as triton_shared under triton/third_party.

All of this will get resolved once these two PRs are merged:

zhaoshiz commented 5 months ago
* [Update CPU backend to work with latest triton #87](https://github.com/microsoft/triton-shared/pull/87)

* [Support building out of tree plugins openai/triton#3007](https://github.com/openai/triton/pull/3007)

Are we expecting both to be merged soon?

nhat-nguyen commented 5 months ago
* [Update CPU backend to work with latest triton #87](https://github.com/microsoft/triton-shared/pull/87)

* [Support building out of tree plugins openai/triton#3007](https://github.com/openai/triton/pull/3007)

Are we expecting both to be merged soon?

@zhaoshiz The PR to support building 3rd party plugin hasn't been merged yet. But I have gone ahead and use a temporary branch as the current triton submodule to unblock the project for now. The reference CPU backend has been merged. Everything is back to green now. You can take a look at the new README for instructions on how to build. The steps might change slightly in the future depending on the direction we decide to go in the ongoing PR. Thank you!

nhat-nguyen commented 5 months ago

Fixed by #87