CMakeLists.txt: AOTRITON_INHERIT_SYSTEM_SITE_TRITON flag#116
CMakeLists.txt: AOTRITON_INHERIT_SYSTEM_SITE_TRITON flag#116xinyazhang merged 1 commit intoROCm:mainfrom
Conversation
There was a problem hiding this comment.
I don't think this PR will work as intended.
A dedicated venv is created under the build directory regardless the value of AOTRITON_USE_EXTERNAL_TRITON, and the import triton under this venv will not work unless you have already installed one.
If a dedicated Triton is preferred, I suggest let this variable point to a .whl file and install the wheel file into the venv, which is easier to deal with and more flexible.
|
Another problem is: aotriton has extended the Triton language a little bit for NPOT head dimension optimization, and consequently its kernel cannot be compiled by stock Triton. |
It works in the nixpkgs context but maybe nixpkgs is customizing something to default venvs to ineriting from site-wide packages.
Does this apply for 0.10 or only current HEAD? Not getting any compile errors on 0.10b with upstream triton 3.3. |
I don't think this would help at all with how nixpkgs' python packaging works. Even if we have to pin a specific ROCm/triton sha it's a lot easier on our end if our aotriton build can inherit a site-packages triton that was built from that sha, otherwise we have to duplicate code needed to get triton to work for our aotriton package. |
|
Sample configure log https://gist.github.com/LunNova/b8d22fa28ec7ccfe822c766011b2de58 |
0e84e7f to
ddab9e2
Compare
Please double check the actual Triton version you are using to compile. In current code framework the only way to use upstream Triton is to call
If that's true the problem is the python -m venv build/venv
build/venv/bin/pip install -r requirements.txt
build/venv/bin/python -c "import triton; import triton.language; print('Triton found: ', triton.__version__)"Unless nixos hacked In addition, to make the code above work, the standard practice is to use The supposed logic of python -m venv build/venv
build/venv/bin/pip install -r requirements.txt
build/venv/bin/pip install ${AOTRITON_USE_EXTERNAL_TRITON}
# Skip triton build later |
Yeah - it looks like nixos hacked venv creation to implicitly inherit global site-packages, hence it working earlier. I've pushed an additional commit which adds a flag to enable inheriting site packages when creating the venv so the external triton option is usable on other distros. |
|
To confirm, you'd be ok with a single flag |
Yes. The only concern is unlike its name it inherits everything. But the other naming scheme is also problematic: users are not informed this option expects Triton from system site and they may prefer a "clean" system site and avoid installing triton there. Compared with the second option I think the first one's risk is lower: |
AOTRITION_INHERIT_SYSTEM_SITE_TRITON creates the venv with --system-site-packages set and verifies triton is pre-installed instead of building it from source. This is useful for hermetic build environments where the triton setup process will fail due to its online components, such as nixpkgs.
ddab9e2 to
e20af1d
Compare
|
Updated to use |
|
Thanks! |
Closes #114
Motivation
Reusing an existing triton install allows building it separately from aotriton.
This is useful for nixpkgs' packaging of aotriton as we would prefer to build triton in a separate derivation and import it in aotriton.
Technical Details
Added a new CMake flag that's off by default that enables the
--system-site-packagesflag when creating the venv and checks an existing triton can be imported instead of building it from the submodule.Test Plan
Build with and without the flag enabled.
Test Result
Works for both cases.
Submission Checklist