[triton-ext] Pass a single PluginInfo * pointer#9748
Merged
ThomasRaoux merged 8 commits intoMar 25, 2026
Conversation
abrown
commented
Mar 17, 2026
abrown
added a commit
to abrown/triton-ext
that referenced
this pull request
Mar 17, 2026
In [#9748], I took a stab at reworking the Triton API with some of the proposals in the [RFCv2] document. This change adapts triton-ext to use that new API. The crux of this is that we return a `PluginInfo *` pointer from `Export.cpp` with all of the plugin metadata in one place. This leaves a couple of items in-progress for future commits: - this keeps the internal `unordered_map` registration which is dynamic enough that we need to heap-allocate the `struct PluginInfo`; ideally we should be doing this all statically - we do not have a great way to pass through the plugin name and version to the `TritonExtensionSupport` library; we could do this dynamically with another internal `exportPluginName` function but, again, it feels like there must be some way to do this more statically. [#9748]: triton-lang/triton#9748 [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4
abrown
added a commit
to abrown/triton-ext
that referenced
this pull request
Mar 17, 2026
In [#9748], I took a stab at reworking the Triton API with some of the proposals in the [RFCv2] document. This change adapts triton-ext to use that new API. The crux of this is that we return a `PluginInfo *` pointer from `Export.cpp` with all of the plugin metadata in one place. This leaves a couple of items in-progress for future commits: - this keeps the internal `unordered_map` registration which is dynamic enough that we need to heap-allocate the `struct PluginInfo`; ideally we should be doing this all statically - we do not have a great way to pass through the plugin name and version to the `TritonExtensionSupport` library; we could do this dynamically with another internal `exportPluginName` function but, again, it feels like there must be some way to do this more statically. [#9748]: triton-lang/triton#9748 [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4
peterbell10
reviewed
Mar 17, 2026
This changes how we pass data between Triton plugins and Triton. Instead of implementing multiple functions with various signatures, we collect all the pointers into a single `struct PluginInfo` and pass this as a pointer across the host-plugin boundary when `tritonGetPluginInfo` is called. This simplifies things on both the host side (Triton has less ABI surface to worry about) and on the plugin side (less intermediate registration into maps). It also ensures that what we pass is `extern "C"`: we now fully rely on the C ABI, which should avoid a whole category of potential problems down the line. This approach--passing a single struct across the API--is taken from how LLVM implements plugins. E.g., MLIR's [`DialectPlugin`] and [`PassPlugin`] do exactly this. Triton's case is a bit more tricky since we can export multiple passes and dialects from a single plugin. But since libraries are loaded via LLVM's `DynamicLibrary::getPermanentLibrary`, we expect these plugins to have a lifetime spanning the entire program. In other words, the `PluginInfo*` pointer would be leaked if we attempted to teardown Triton mid-process (?) but we simply don't do this. This change also allows us to pass multiple plugins to Triton: we replace `TRITON_PASS_PLUGIN_PATH` with a colon-separated `TRITON_PLUGIN_PATHS`. I tested this over in `triton-ext` and it works as expected. For the rationale behind these changes, see the Triton Extensions [RFCv2] document. [`DialectPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/DialectPlugin.h [`PassPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/PassPlugin.h [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4
4d29cf9 to
39c1482
Compare
peterbell10
reviewed
Mar 18, 2026
ThomasRaoux
reviewed
Mar 18, 2026
This replaces the existing custom ops registration with `TritonPlugin::listOps`.
ThomasRaoux
approved these changes
Mar 24, 2026
Collaborator
ThomasRaoux
left a comment
There was a problem hiding this comment.
Looks like a good clean up to me
Contributor
Author
|
Looks like an unrelated build failure... can someone re-run? |
abrown
added a commit
to triton-lang/triton-ext
that referenced
this pull request
Mar 26, 2026
In [#9748], I took a stab at reworking the Triton API with some of the proposals in the [RFCv2] document. This change adapts triton-ext to use that new API. The crux of this is that we return a `PluginInfo *` pointer from `Export.cpp` with all of the plugin metadata in one place. This leaves a couple of items in-progress for future commits: - this keeps the internal `unordered_map` registration which is dynamic enough that we need to heap-allocate the `struct PluginInfo`; ideally we should be doing this all statically - we do not have a great way to pass through the plugin name and version to the `TritonExtensionSupport` library; we could do this dynamically with another internal `exportPluginName` function but, again, it feels like there must be some way to do this more statically. [#9748]: triton-lang/triton#9748 [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4
abrown
added a commit
to abrown/triton
that referenced
this pull request
Mar 26, 2026
In triton-lang#9748, the ability to return the created custom op was accidentally removed. This change allows us to fallibly return the created `mlir::Value` without altering the vector of passed `args`.
ThomasRaoux
pushed a commit
that referenced
this pull request
Mar 26, 2026
#9748 introduced some changes to the custom ops API and dropped the return value. But the plugin convention expects operands[0] to be a writable result slot. This adds that return value for the added op back.
jvican
pushed a commit
to jvican/triton
that referenced
this pull request
Mar 27, 2026
This changes how we pass data between Triton plugins and Triton. Instead of implementing multiple functions with various signatures, we collect all the pointers into a single `struct PluginInfo` and pass this as a pointer across the host-plugin boundary when `tritonGetPluginInfo` is called. This simplifies things on both the host side (Triton has less ABI surface to worry about) and on the plugin side (less intermediate registration into maps). It also ensures that what we pass is `extern "C"`: we now fully rely on the C ABI, which should avoid a whole category of potential problems down the line. This approach--passing a single struct across the API--is taken from how LLVM implements plugins. E.g., MLIR's [`DialectPlugin`] and [`PassPlugin`] do exactly this. Triton's case is a bit more tricky since we can export multiple passes and dialects from a single plugin. But since libraries are loaded via LLVM's `DynamicLibrary::getPermanentLibrary`, we expect these plugins to have a lifetime spanning the entire program. In other words, the `PluginInfo*` pointer would be leaked if we attempted to teardown Triton mid-process (?) but we simply don't do this. This change also allows us to pass multiple plugins to Triton: we replace `TRITON_PASS_PLUGIN_PATH` with a colon-separated `TRITON_PLUGIN_PATHS`. I tested this over in `triton-ext` and it works as expected. For the rationale behind these changes, see the Triton Extensions [RFCv2] document. [`DialectPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/DialectPlugin.h [`PassPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/PassPlugin.h [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4
jvican
pushed a commit
to jvican/triton
that referenced
this pull request
Mar 27, 2026
…n-lang#9864) triton-lang#9748 introduced some changes to the custom ops API and dropped the return value. But the plugin convention expects operands[0] to be a writable result slot. This adds that return value for the added op back.
plotfi
pushed a commit
to plotfi/triton
that referenced
this pull request
Apr 8, 2026
This changes how we pass data between Triton plugins and Triton. Instead of implementing multiple functions with various signatures, we collect all the pointers into a single `struct PluginInfo` and pass this as a pointer across the host-plugin boundary when `tritonGetPluginInfo` is called. This simplifies things on both the host side (Triton has less ABI surface to worry about) and on the plugin side (less intermediate registration into maps). It also ensures that what we pass is `extern "C"`: we now fully rely on the C ABI, which should avoid a whole category of potential problems down the line. This approach--passing a single struct across the API--is taken from how LLVM implements plugins. E.g., MLIR's [`DialectPlugin`] and [`PassPlugin`] do exactly this. Triton's case is a bit more tricky since we can export multiple passes and dialects from a single plugin. But since libraries are loaded via LLVM's `DynamicLibrary::getPermanentLibrary`, we expect these plugins to have a lifetime spanning the entire program. In other words, the `PluginInfo*` pointer would be leaked if we attempted to teardown Triton mid-process (?) but we simply don't do this. This change also allows us to pass multiple plugins to Triton: we replace `TRITON_PASS_PLUGIN_PATH` with a colon-separated `TRITON_PLUGIN_PATHS`. I tested this over in `triton-ext` and it works as expected. For the rationale behind these changes, see the Triton Extensions [RFCv2] document. [`DialectPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/DialectPlugin.h [`PassPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/PassPlugin.h [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4 (cherry picked from commit 283dc31)
plotfi
pushed a commit
to plotfi/triton
that referenced
this pull request
Apr 8, 2026
This changes how we pass data between Triton plugins and Triton. Instead of implementing multiple functions with various signatures, we collect all the pointers into a single `struct PluginInfo` and pass this as a pointer across the host-plugin boundary when `tritonGetPluginInfo` is called. This simplifies things on both the host side (Triton has less ABI surface to worry about) and on the plugin side (less intermediate registration into maps). It also ensures that what we pass is `extern "C"`: we now fully rely on the C ABI, which should avoid a whole category of potential problems down the line. This approach--passing a single struct across the API--is taken from how LLVM implements plugins. E.g., MLIR's [`DialectPlugin`] and [`PassPlugin`] do exactly this. Triton's case is a bit more tricky since we can export multiple passes and dialects from a single plugin. But since libraries are loaded via LLVM's `DynamicLibrary::getPermanentLibrary`, we expect these plugins to have a lifetime spanning the entire program. In other words, the `PluginInfo*` pointer would be leaked if we attempted to teardown Triton mid-process (?) but we simply don't do this. This change also allows us to pass multiple plugins to Triton: we replace `TRITON_PASS_PLUGIN_PATH` with a colon-separated `TRITON_PLUGIN_PATHS`. I tested this over in `triton-ext` and it works as expected. For the rationale behind these changes, see the Triton Extensions [RFCv2] document. [`DialectPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/DialectPlugin.h [`PassPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/PassPlugin.h [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4 (cherry picked from commit 283dc31) (cherry picked from commit 52372e7)
Merged
atalman
pushed a commit
that referenced
this pull request
Apr 10, 2026
[triton-ext] Update plugin extension changes for release 3.7.x cherry-picking the following plugin extension changes since January: - **[triton-ext] Fix garbage string in reported errors (#9687)** - **[triton-ext] add string arguments to addPass API (#9691)** - **[triton-ext][FrontEnd] Custom DSL Plugin Ops (#9626)** - **[triton-ext] Drop LLVM_BUILD_SHARED_LIBS, enable libtriton visibility through TRITON_EXT_ENABLED (#9783)** - **[triton-ext] Pass a single `PluginInfo *` pointer (#9748)** - **[triton-ext] plugin extension's version check (#9937)** --------- Co-authored-by: Andrew Brown <andrew@kernelize.ai> Co-authored-by: Corbin Robeck <robeck@meta.com>
plognjen
pushed a commit
to plognjen/triton
that referenced
this pull request
Apr 14, 2026
This changes how we pass data between Triton plugins and Triton. Instead of implementing multiple functions with various signatures, we collect all the pointers into a single `struct PluginInfo` and pass this as a pointer across the host-plugin boundary when `tritonGetPluginInfo` is called. This simplifies things on both the host side (Triton has less ABI surface to worry about) and on the plugin side (less intermediate registration into maps). It also ensures that what we pass is `extern "C"`: we now fully rely on the C ABI, which should avoid a whole category of potential problems down the line. This approach--passing a single struct across the API--is taken from how LLVM implements plugins. E.g., MLIR's [`DialectPlugin`] and [`PassPlugin`] do exactly this. Triton's case is a bit more tricky since we can export multiple passes and dialects from a single plugin. But since libraries are loaded via LLVM's `DynamicLibrary::getPermanentLibrary`, we expect these plugins to have a lifetime spanning the entire program. In other words, the `PluginInfo*` pointer would be leaked if we attempted to teardown Triton mid-process (?) but we simply don't do this. This change also allows us to pass multiple plugins to Triton: we replace `TRITON_PASS_PLUGIN_PATH` with a colon-separated `TRITON_PLUGIN_PATHS`. I tested this over in `triton-ext` and it works as expected. For the rationale behind these changes, see the Triton Extensions [RFCv2] document. [`DialectPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/DialectPlugin.h [`PassPlugin`]: https://github.com/llvm/llvm-project/blob/80d6e0b8/mlir/include/mlir/Tools/Plugins/PassPlugin.h [RFCv2]: https://docs.google.com/document/d/1XlxNYahzpHgU3gg0Y8ayopTWK7GRy8eQ5ExDtXt6GZ4
plognjen
pushed a commit
to plognjen/triton
that referenced
this pull request
Apr 14, 2026
…n-lang#9864) triton-lang#9748 introduced some changes to the custom ops API and dropped the return value. But the plugin convention expects operands[0] to be a writable result slot. This adds that return value for the added op back.
CRobeck
added a commit
to CRobeck/triton
that referenced
this pull request
May 5, 2026
…n-lang#9864) triton-lang#9748 introduced some changes to the custom ops API and dropped the return value. But the plugin convention expects operands[0] to be a writable result slot. This adds that return value for the added op back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes how we pass data between Triton plugins and Triton. Instead of implementing multiple functions with various signatures, we collect all the pointers into a single
struct PluginInfoand pass this as a pointer across the host-plugin boundary whentritonGetPluginInfois called. This simplifies things on both the host side (Triton has less ABI surface to worry about) and on the plugin side (less intermediate registration into maps). It also ensures that what we pass isextern "C": we now fully rely on the C ABI, which should avoid a whole category of potential problems down the line.This approach--passing a single struct across the API--is taken from how LLVM implements plugins. E.g., MLIR's
DialectPluginandPassPlugindo exactly this. Triton's case is a bit more tricky since we can export multiple passes and dialects from a single plugin. But since libraries are loaded via LLVM'sDynamicLibrary::getPermanentLibrary, we expect these plugins to have a lifetime spanning the entire program. In other words, thePluginInfo*pointer would be leaked if we attempted to teardown Triton mid-process (?) but we simply don't do this.This change also allows us to pass multiple plugins to Triton: we replace
TRITON_PASS_PLUGIN_PATHwith a colon-separatedTRITON_PLUGIN_PATHS. I tested this over intriton-extand it works as expected.For the rationale behind these changes, see the Triton Extensions RFCv2 document.