Split Triton library in two: libtriton.so and libtritoncore.so#10288
Split Triton library in two: libtriton.so and libtritoncore.so#10288abrown wants to merge 3 commits into
libtriton.so and libtritoncore.so#10288Conversation
This change proposes a split into two libraries: - `libtritoncore.so` which would (eventually) contain only Triton code, nothing vendor-specific; all of these symbols are exported - `libtriton.so` which `RPATH`-depends on `libtritoncore.so` and includes all of vendor-specific code with the Python bindings; these symbols are all hidden (see triton-lang#9922).
One side effect of splitting the libraries is that plugins can always be compiled and run because they depend on `libtritoncore.so`; there is no special build necessary.
`gluon_ir.cc` depends directly on internal, third-party AMD headers. The separation of `libtriton` and `libtritoncore` brings some of these core-to-plugin dependencies to light. This is a workaround until some more complete refactoring can be attempted (TODO).
libtriton.so and libtritoncore.so
libtriton.so and libtritoncore.solibtriton.so and libtritoncore.so
|
Splitting the libraries in this way has some significant downsides:
I recall the key issue here is that |
|
I think @ThomasRaoux is also going to have issues with eliminating TRITON_EXT_ENABLED. One of agreements was to allow for enforcing layering between Triton core and the plugins mechanism. We agreed to have this enabled for the release by default but for upstream builds it had to explicitly be set by the user. |
@neildhar, @CRobeck: removing
I agree. This split could have a follow-on change to check that no symbol in
This change isn't a terribly huge one to the build configuration (?) and depending on a library via |
|
This looks like a clean structural separation of Triton MLIR and the python front-end, harder to hide wrong-way dependencies. And simplifies lit testing in +1 to keeping the TRITON_EXT_ENABLED build flag and default to static linkage as @abrown suggests. |
|
I don't understand what this is trying to solve. |
Over time, Triton has accumulated dependencies from its core files
toward the plugins that implement vendor-specific functionality. This is
not ideal: (a) Triton can only be compiled with vendor-specific plugins
enabled and (b) this could encourage Triton extensions to depend on
vendor-specific symbols. This change proposes a split into two
libraries:
libtritoncore.sowhich would (eventually) contain only Triton code,nothing vendor-specific; all of these symbols are exported
libtriton.sowhichRPATH-depends onlibtritoncore.soandincludes all of vendor-specific code with the Python bindings; these
symbols are all hidden (see #9922).
This split ensures Triton extensions have a clear, minimal target to
link to: the exported symbols in
libtritoncore.so. It also avoids (a)relying on hacks to avoid the missing
pybindsymbols fortriton-optand other binaries used with extensions (e.g., #51) and (b) eliminates
the
TRITON_EXT_ENABLEDconfiguration entirely. This last resultnormalizes how Triton is built: the built artifacts are now the same
whether Triton extensions are enabled or not.
What this PR does not do:
things up to make these decisions. A next step for sorting out what
libraries go where is to add a
COREargument toadd_triton_libraryto split dependent libraries into
TRITON_CORE_LIBRARIESorTRITON_PYTHON_LIBRARIESTriton is used with extensions, the extensions need access to exported
symbols. This change limits the number of exported symbols to those in
libtritoncore.so(and the single symbol that #9922 exports fromlibtriton.so), but does not fully resolve the opportunity forconflicts. I had hoped that
libtriton.sodepending onlibtritoncore.sowould prevent the core symbols from polluting theglobal symbol scope but, IIUC, system loaders will just dump
everything there. I would be happy to be corrected on this by someone
more familiar; maybe there is something additional that can be done at
the system loading level to do the equivalent of
RTLD_LOCAL(?).This change should not alter any Triton functionality, but the change in
symbol location requires careful review. I can provide dumps of symbol
lists if that helps.