[KMCompiler][TLERaw] Support nvshmem#787
Merged
i3wanna2 merged 17 commits intoJul 18, 2026
Merged
Conversation
lizhangyu258
requested review from
Galaxy1458,
i3wanna2,
menchunlei,
sunnycase and
zhzhcookie
as code owners
July 14, 2026 00:00
lizhangyu258
marked this pull request as draft
July 14, 2026 00:01
lizhangyu258
force-pushed
the
triton_v3.6.x_support_nvshmem_by_region
branch
from
July 14, 2026 00:16
48c25a8 to
52da041
Compare
Collaborator
|
An alternative approach is in PR #682: compile TLE-raw NVSHMEM device code to LLVM bitcode (.bc) and invoke it via extern_call. That path is frozen and kept for reference only; official NVSHMEM support will use this PR. |
lizhangyu258
force-pushed
the
triton_v3.6.x_support_nvshmem_by_region
branch
from
July 15, 2026 07:30
52da041 to
a3ace68
Compare
lizhangyu258
force-pushed
the
triton_v3.6.x_support_nvshmem_by_region
branch
from
July 16, 2026 00:28
a3ace68 to
23bc351
Compare
Contributor
Author
|
All cases uniformly use torchrun for launching. If you want to use nvshmrun to launch, you need to install it by referring to https://developer.nvidia.com/nvshmem-downloads and then adjust the corresponding case accordingly. |
lizhangyu258
force-pushed
the
triton_v3.6.x_support_nvshmem_by_region
branch
from
July 16, 2026 09:26
5cb3b98 to
ac3948a
Compare
i3wanna2
marked this pull request as ready for review
July 16, 2026 15:09
…t registry Avoid pulling cuda-python/nvshmem on import dialect or ordinary CUDA compile paths (fixes nvidia unit/cuda and enflame collect failures). Register cuda backend with try/except like other dialects, and align tops_mlir with extern_func_name API.
Align tops dialect with the multi-function raw call API so tle_raw.call does not AttributeError on Enflame tops tutorials.
Match deferred handling so backends without the attribute still work. Drop redundant extern_func_name fields from tops/tops_mlir; keep the create_region_by_llvm parameter for API compatibility.
Share extern_func_name/deferred and default create_region_by_llvm so cuda/mlir/tops stay aligned without duplicating dialect kwargs.
zhzhcookie
reviewed
Jul 17, 2026
Discover clang>=20 and pip NVSHMEM when unset, wire knobs for optional overrides, and extend nv3.6 workflow with cuda/nvshmem tutorials including smem.
zhzhcookie
reviewed
Jul 17, 2026
zhzhcookie
reviewed
Jul 17, 2026
i3wanna2
self-requested a review
July 17, 2026 06:10
…ments nvcc rejects versioned .so as a positional input; use -L/-l: and rpath. Add optional nvidia-nvshmem-cu12/cu13 requirement files for tle raw.
zhzhcookie
reviewed
Jul 17, 2026
NVSHMEM 3.7+ wheels drop unified libnvshmem_device.bc; fall back to libnvshmem_device_sm_XX.bc using the compile arch.
Only link libnvshmem_device when library=nvshmem enables a utils flag, so ordinary CUDA compiles do not inject nvshmem into extern_libs.
zhzhcookie
pushed a commit
that referenced
this pull request
Jul 19, 2026
* [KMCompiler][TLERaw] Fix cuda device-side not supporting multiple functions * [KMCompiler][TLERaw] Support nvshmem * [KMCompiler][TLERaw] Unify launcher to torchrun * [KMCompiler][TLERaw] Lazy-load nvshmem/cuda imports and harden dialect registry Avoid pulling cuda-python/nvshmem on import dialect or ordinary CUDA compile paths (fixes nvidia unit/cuda and enflame collect failures). Register cuda backend with try/except like other dialects, and align tops_mlir with extern_func_name API. * [KMCompiler][TLERaw] Fix extra blank line in nvshmem utils * [KMCompiler][TLERaw] Add extern_func_name to TOPSJITFunction Align tops dialect with the multi-function raw call API so tle_raw.call does not AttributeError on Enflame tops tutorials. * [KMCompiler][TLERaw] Use getattr for extern_func_name in raw call Match deferred handling so backends without the attribute still work. Drop redundant extern_func_name fields from tops/tops_mlir; keep the create_region_by_llvm parameter for API compatibility. * [KMCompiler][TLERaw] Extract RawJITFunction base for dialect backends Share extern_func_name/deferred and default create_region_by_llvm so cuda/mlir/tops stay aligned without duplicating dialect kwargs. * [KMCompiler][TLERaw] Add tle cuda and nvshmem test * [KMCompiler][TLERaw] Replace os.getenv with knobs * [KMCompiler][TLERaw] Auto-resolve clang and NVSHMEM for raw CUDA CI Discover clang>=20 and pip NVSHMEM when unset, wire knobs for optional overrides, and extend nv3.6 workflow with cuda/nvshmem tutorials including smem. * [KMCompiler][TLERaw] Address review: knobs comment and CI clang-22 path * [KMCompiler][TLERaw] Shorten flagtree knobs comment * [KMCompiler][TLERaw] Link nvshmem host via -L/-l and add CUDA requirements nvcc rejects versioned .so as a positional input; use -L/-l: and rpath. Add optional nvidia-nvshmem-cu12/cu13 requirement files for tle raw. * [KMCompiler][TLERaw] Resolve per-SM NVSHMEM device bitcode NVSHMEM 3.7+ wheels drop unified libnvshmem_device.bc; fall back to libnvshmem_device_sm_XX.bc using the compile arch. * [KMCompiler][TLERaw] Gate nvshmem device bc on @dialect library Only link libnvshmem_device when library=nvshmem enables a utils flag, so ordinary CUDA compiles do not inject nvshmem into extern_libs. --------- Co-authored-by: i3wanna2 <15910307812@163.com> Co-authored-by: iwanna-lxy <37344393+i3wanna2@users.noreply.github.com>
Galaxy1458
pushed a commit
that referenced
this pull request
Jul 20, 2026
* [KMCompiler][TLERaw] Fix cuda device-side not supporting multiple functions * [KMCompiler][TLERaw] Support nvshmem * [KMCompiler][TLERaw] Unify launcher to torchrun * [KMCompiler][TLERaw] Lazy-load nvshmem/cuda imports and harden dialect registry Avoid pulling cuda-python/nvshmem on import dialect or ordinary CUDA compile paths (fixes nvidia unit/cuda and enflame collect failures). Register cuda backend with try/except like other dialects, and align tops_mlir with extern_func_name API. * [KMCompiler][TLERaw] Fix extra blank line in nvshmem utils * [KMCompiler][TLERaw] Add extern_func_name to TOPSJITFunction Align tops dialect with the multi-function raw call API so tle_raw.call does not AttributeError on Enflame tops tutorials. * [KMCompiler][TLERaw] Use getattr for extern_func_name in raw call Match deferred handling so backends without the attribute still work. Drop redundant extern_func_name fields from tops/tops_mlir; keep the create_region_by_llvm parameter for API compatibility. * [KMCompiler][TLERaw] Extract RawJITFunction base for dialect backends Share extern_func_name/deferred and default create_region_by_llvm so cuda/mlir/tops stay aligned without duplicating dialect kwargs. * [KMCompiler][TLERaw] Add tle cuda and nvshmem test * [KMCompiler][TLERaw] Replace os.getenv with knobs * [KMCompiler][TLERaw] Auto-resolve clang and NVSHMEM for raw CUDA CI Discover clang>=20 and pip NVSHMEM when unset, wire knobs for optional overrides, and extend nv3.6 workflow with cuda/nvshmem tutorials including smem. * [KMCompiler][TLERaw] Address review: knobs comment and CI clang-22 path * [KMCompiler][TLERaw] Shorten flagtree knobs comment * [KMCompiler][TLERaw] Link nvshmem host via -L/-l and add CUDA requirements nvcc rejects versioned .so as a positional input; use -L/-l: and rpath. Add optional nvidia-nvshmem-cu12/cu13 requirement files for tle raw. * [KMCompiler][TLERaw] Resolve per-SM NVSHMEM device bitcode NVSHMEM 3.7+ wheels drop unified libnvshmem_device.bc; fall back to libnvshmem_device_sm_XX.bc using the compile arch. * [KMCompiler][TLERaw] Gate nvshmem device bc on @dialect library Only link libnvshmem_device when library=nvshmem enables a utils flag, so ordinary CUDA compiles do not inject nvshmem into extern_libs. --------- Co-authored-by: i3wanna2 <15910307812@163.com> Co-authored-by: iwanna-lxy <37344393+i3wanna2@users.noreply.github.com>
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.
Reuse the dsl_region implementation of tle_raw to implement the nvshmem extension, and use anonymous compilation to defer the linking of CUDA device-side nvshmem calls until after dsl_region_inline.
The user needs to complete three parts when writing an nvshmem program:
run
performance
config
FlagTree
Triton-distributed