Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
8d8f8dd
Add a PyTorch EP=1 backend for MoE dispatch and combine
0z5a Sep 28, 2026
6ce761b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 28, 2026
b57646c
[Common] row-scaled nvfp4 path: add single-launch group fused amax (…
cael-ling Sep 30, 2026
f6d1ecb
Isolate FlashAttention 2/3 imports so a broken install cannot break T…
0z5a Sep 30, 2026
08ba459
[common] Reject mismatched bias/out dtype for non-FP8/FP4 GEMM (#3565)
dundysm Sep 30, 2026
ef2bf75
[Docs] Fix broken links (#3597)
sbhavani Sep 30, 2026
5e8a899
MOE Sequential Block with Dispatch and Combine as Basic Ops (#3503)
vthumbe1503 Oct 1, 2026
a16bce3
[Common] row-scaled nvfp4 path: fuse row/col amax into a single TMA-t…
cael-ling Oct 1, 2026
6cc9271
Merge main and resolve upstream conflicts
0z5a Oct 1, 2026
68ee5a9
Merge nccl_ep_ops and resolve upstream conflicts
0z5a Oct 1, 2026
dabf33e
[PyT] Prefer Flash Attn 2 instead of Fused Attn for THD dropout on Bl…
bzantium Oct 1, 2026
b0f0ecd
Fix `test_context_parallel_allgather_attn` test failure (#3598)
fheinecke Oct 1, 2026
0838ecb
Reduce the memory usage of the permutation reference implementation (…
fheinecke Oct 1, 2026
f38a1fc
[PyTorch] Support FA3/FA4 with pad_between_seqs=True (#3205)
xiaoyao0115 Oct 2, 2026
ae56bbc
[Common] Fix CUDA 12.8 build: use an L2 policy in the 128-bit evict_f…
ravimajeti Oct 2, 2026
db759b2
Fix JAX distributed unit test failure (#3611)
fheinecke Oct 2, 2026
4fcb7ca
Produce BOLT-compatible libraries (#3383)
fheinecke Oct 2, 2026
8920bbe
[JAX] Add MoE checkpoint names (#3589)
jberchtold-nvidia Oct 2, 2026
5759fa0
[JAX] Initialize softmax custom calls before execution (#3612)
KshitijLakhani Oct 2, 2026
d0b4b32
Prototype NVFP4 with FP8 UE5M3 block scales (#3325)
timmoon10 Oct 4, 2026
8cd5e20
Bump NCCL EP submodule commit (#3619)
phu0ngng Oct 5, 2026
f68a64a
Fix AArch64 NCCL EP linking with BOLT enabled (#3627)
aybchan Oct 5, 2026
2cd6893
[JAX] Add Triton dependency to JAX extension (#3610)
jberchtold-nvidia Oct 5, 2026
b47a356
[Common] Add launch bounds to multi-tensor swizzle kernels (#3622)
ravimajeti Oct 6, 2026
9d4bd38
Fix MXFP8 ONNX block quantization attributes (#3592)
pggPL Oct 6, 2026
6d6a500
Skip FA4 for deterministic backward on SM12x (#3595)
janbernloehr Oct 6, 2026
ce29d24
[Common] Remove CuTeDSL first launch protection (#3620)
kainzhong Oct 6, 2026
bba2d2b
Support building docs for publishing via GHA (#3515)
fheinecke Oct 7, 2026
6eb41bd
[PyTorch] Enable LayerNormLinear UB AG overlap under no_grad (#3546)
ravimajeti Oct 7, 2026
5e99464
Preserve tiny sigmoid scores in biased fused routing (#3637)
philipcmonk Oct 7, 2026
14be43f
Build FP8 recipe quantizer params per instance (#3605)
Varun-51 Oct 8, 2026
c25fa27
[PyTorch] Allow deterministic dprob for the GLU fused grouped MLP (#3…
ZhiyuLi-Nvidia Oct 8, 2026
62b1389
[Common] Fall back from gated TMA kernels when shared memory does not…
ravimajeti Oct 8, 2026
45223d7
[PyTorch] Compile Linear and Bias operations with forward fusion (#3547)
pggPL Oct 8, 2026
7e7898f
[PyTorch] torch.compile support for FusedAttention (#3472)
pggPL Oct 8, 2026
39c30c5
[Common] Fix TMA synchronization in quantization kernels (#3417)
Oleg-Goncharov Oct 9, 2026
d9beab1
[Common] Fuse RMSNorm forward with MXFP8 quantization (#3657)
sraman-rgb Oct 9, 2026
074eb5d
[Common] Link python to C++ dist tests with CuTeDSL enabled (#3648)
kainzhong Oct 9, 2026
f57b8b8
[Common] Enable all activations for MXFP8 C++ Unittest (#3616)
kainzhong Oct 9, 2026
16580f9
[PyTorch][CP][CI] Reset all CP process pools before retrying a failed…
sudhakarsingh27 Oct 9, 2026
15dcc84
[Common] Requantize grouped MXFP8 tensors with 128x128 tiles (#3656)
sraman-rgb Oct 9, 2026
76ae4b0
[Common] Fix grouped MXFP8 quantization with varying last dim & swizz…
kainzhong Oct 9, 2026
33e7ff3
[Common] Swizzle MXFP8 scaling factors with one CTA per scale tile (#…
sraman-rgb Oct 11, 2026
2e959f3
[PyTorch] Fix NVFP4 weight views of the single-group fused grouped ML…
sraman-rgb Oct 12, 2026
81775f2
[PyTorch] Interpolate the class name in six op error messages (#3667)
v0ropaev Oct 12, 2026
1c9f6f8
[PyTorch][CP] Support D=256 THD metadata with FA4 b33 (#3540)
sudhakarsingh27 Oct 12, 2026
459dedc
[Common][PyTorch] Fuse the MLA key/value RoPE with MXFP8 quantization…
sraman-rgb Oct 12, 2026
20e97da
Bump nccl ep (#3677)
phu0ngng Oct 13, 2026
e394b12
[PyTorch] Distributed tests set device in NCCL init and manually shut…
timmoon10 Oct 13, 2026
fc48751
[PyTorch] Allow ZeroTensor dummy weight gradients (#3670)
sraman-rgb Oct 13, 2026
39a8b87
[PyTorch] Return the argmax from parallel_cross_entropy (#3671)
sraman-rgb Oct 13, 2026
0c4d961
Change to enable CuteDSL DenseGEMM for eval (#3666)
vasunvidia Oct 13, 2026
e6afa9d
[PyTorch] Refactor GroupedLinear forward and backward (#3606)
pggPL Oct 13, 2026
53e241c
[PyTorch] Fix deferred initialization in fusible ops (#3327)
denera Oct 13, 2026
6ca7b5a
[Common][JAX] Reconstruct EpHandle via ncclEpImportHandle (#3639)
phu0ngng Oct 14, 2026
cfdd228
[PyTorch] Set device ID in distributed cross entropy + argmax test (#…
timmoon10 Oct 14, 2026
c72db38
Bump flash attention 2 (#3403)
francesco-bertolotti Oct 14, 2026
66ba897
Update VERSION.txt to 2.22.0.dev0
fheinecke Oct 14, 2026
b9715e5
KDA attention (#3548)
ksivaman Oct 14, 2026
c3081a5
[All] Guard THD learnable dSink on older cuDNN (#3470)
KshitijLakhani Oct 14, 2026
9d9bd9e
[PyTorch] Deprecate grouped linear and MLP environment gates (#3584)
zhongbozhu Oct 15, 2026
33f3b35
Fix ONNX custom-op metadata and LayerNorm execution (#3659)
sanjana658 Oct 15, 2026
049e79b
[PyTorch] Skip torch.compile tests when required PyTorch APIs are una…
pggPL Oct 16, 2026
b7db08f
[JAX] EP with Fused Prepare and Dispatch (NVL Only) (#3674)
phu0ngng Oct 16, 2026
564e8b0
[PyTorch] Remove multi-layer TransformerLayer cases from comm+GEMM ov…
denera Oct 16, 2026
eb3c860
[JAX] MoE block optimization (#3638)
jberchtold-nvidia Oct 16, 2026
4a3a8a8
[Common] Forward the RHT matrix in NVFP4 quantize dispatch (#3669)
janbernloehr Oct 19, 2026
f4a69dc
[Common/PyTorch] Enable FP8BS for Grouped GEMM on Blackwell via MXFP8…
denera Oct 19, 2026
f382622
[JAX] Fix undefined sr_rng_state that breaks --dry-run in two encoder…
Anai-Guo Oct 19, 2026
a7b6c0c
[JAX] Disable NCCL communicator splitting for attention CI (#3681)
KshitijLakhani Oct 19, 2026
f0b1096
[PyTorch] Fix NVFP4 metadata in compiled Linear operations (#3628)
pggPL Oct 20, 2026
fd7d03b
Bound symmetric all-reduce scratch storage across input sizes (#3709)
Sunt-ing Oct 20, 2026
1aaede2
Reuse cuBLASMp's all-gathered grad_output in the wgrad GEMM (#3629)
almogsegal Oct 20, 2026
5eeb62a
[PyTorch] Fix full-graph compilation of linear attention (#3685)
pggPL Oct 20, 2026
6b5cd7e
cuBLASMp NVFP4 support (#3634)
almogsegal Oct 21, 2026
95b69f7
Merge main and preserve local EP alignment defaults
0z5a Oct 21, 2026
53d1a3c
Integrating TE Triton mHC kernels into JAX (#3680)
dinodeep Oct 21, 2026
9ea05cf
[PyTorch] Support FP8 weight caching in compiled Linear (#3505)
pggPL Oct 22, 2026
c9c9225
[PyTorch] Make the Triton mask-map permute respect num_out_tokens (#3…
truong-v Oct 22, 2026
2199b71
Support GroupedTensor autograd views and stream tracking (#3701)
vthumbe1503 Oct 23, 2026
3d87818
Use `get_device_compute_capability` from te jax extension; Fix GH doc…
ksivaman Oct 23, 2026
dd02f3f
Remove unused CustomClassHolder bases from Userbuffers wrappers (#3732)
pggPL Oct 23, 2026
491d557
Fix GitHub PyTorch lint on Ubuntu 26.04 (#3736)
pggPL Oct 23, 2026
e32e123
[PyTorch] Type the grouped wgrad from main_grad for distributed weigh…
fanshiqing Oct 26, 2026
f2be56a
[PyTorch] Fix distributed BF16 weights and trim NVFP4 saved state in …
xrennvidia Oct 26, 2026
5d7bbd8
[PyTorch] Keep None sentinels on the custom op device (#3739)
pggPL Oct 26, 2026
fac8d4a
Run minimum-versions build on pushes to main to warm sccache (#3721)
agarg21 Oct 26, 2026
3850986
Support row-only MXFP8 distributed master-weight casts (#3488)
xiuhu17 Oct 27, 2026
0f8d92f
[PyTorch] Set device during NCCL init in symmetric memory test (#3744)
timmoon10 Oct 27, 2026
89668d9
[Common][PyTorch] Add NVFP4 row-scaled grouped cast with graph-safe p…
cael-ling Oct 27, 2026
83d8c4e
TE MoE Return Expert Counts and Custom Routing for DSv4 Support (#3596)
dinodeep Oct 27, 2026
dd628d3
[Common] Don't call CUDA from static destructors at exit (#3733)
ConnorBaker Oct 27, 2026
fa4b30f
Fix DistributedWeight handling under saved-tensor hooks (#3730)
ksivaman Oct 27, 2026
96c0fb0
Remove device side validation of QB bounds (#3734)
ksivaman Oct 27, 2026
d7cd302
[PyTorch] FP8BS grouped GEMM test reference fix (#3722)
denera Oct 27, 2026
f8f34c6
Abstract CUDA hardcodes into configurable te_device_type / te_platfor…
lxd-cumt Oct 27, 2026
268fdd5
Guard fused MoE auxiliary loss integer offsets (#3569)
arcusbuilds Oct 27, 2026
9b7e959
Rely on Recipe object for fusion (#3717)
vthumbe1503 Oct 27, 2026
e614b7a
[Common] Optimized kernels for swizzling and remove obsolete narrow s…
vthumbe1503 Oct 28, 2026
390cd03
Fix GH CI documenation (#3770)
ksivaman Oct 28, 2026
e619cea
[PyTorch][CP] Make THD CP helper kernels to be shared memory size awa…
sudhakarsingh27 Oct 28, 2026
54ecaab
[PyT] Guard for buggy quack version (#3762)
KshitijLakhani Oct 28, 2026
dfc4158
Link tests executables against libpython when CuTeDSL is enabled (#3769)
fheinecke Oct 28, 2026
a0a7e92
[Docs] Add Mixture of Experts guide (#3494)
pggPL Oct 29, 2026
6f6b8f7
[PyTorch]Validate grouped split alignment on device (#3745)
vthumbe1503 Oct 29, 2026
5f3abe1
[PyTorch] Skip FA 2.8.4 for unsupported arches in L3 (#3772)
cyanguwa Oct 29, 2026
c83e856
[JAX] Disable TE C API CuTeDSL backend at import time (#3784)
jberchtold-nvidia Oct 29, 2026
43f61f7
Add code quality guidelines to AGENTS.md (#3773)
timmoon10 Oct 30, 2026
45a6d7c
[PyT] Disable TE torch compilation in KV-cache CI tests (#3781)
KshitijLakhani Oct 30, 2026
aac5cb4
Grouped Linear CPU Overhead Reductions By Removing Unnecessary Python…
zhongbozhu Oct 30, 2026
fd2ab0c
Deterministic MoE Router Kernel By Removing Global Atomic Ops (#3587)
zhongbozhu Oct 30, 2026
6320b5f
[PyTorch] Remove EP handle cache and reconstructing handle on the fly…
phu0ngng Oct 30, 2026
d3a16e5
[Common] Make it easier to debug C++ UT failures (#3783)
kainzhong Oct 30, 2026
35a8e2f
Accumulate delayed wgrads into shared (tied) parameters (#3552)
0z5a Oct 30, 2026
be880cc
Fix LayerNormLinear dummy gradients for sharded weights (#3748)
zhongbozhu Oct 31, 2026
70ee2bb
[PyTorch] Pass canonical layouts to cuDNN grouped GEMM in fused group…
hwanseoc Oct 31, 2026
9ad8fd0
[PyTorch] Fix grouped split validation for GroupedLinear/GroupedMLP o…
vthumbe1503 Oct 31, 2026
63451d6
[PyTorch] Add BF16 fused grouped MLP support (#3646)
tingyangk Oct 31, 2026
3df8821
Merge remote-tracking branch 'upstream/main' into ep1-pytorch-dispatc…
0z5a Nov 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ name: 'Documentation'
on:
pull_request:
workflow_dispatch:
inputs:
enable_public_features:
# Disabling this blocks the cookie banner from appearing on localhost and other domains
description: 'Enable public features (required for public publishing)'
default: false
required: true
type: boolean
workflow_call:
concurrency:
# Group by workflow name + PR number (for PRs) or ref (for branch/tag pushes)
Expand All @@ -27,7 +34,7 @@ jobs:
export GIT_SHA=$(git show-ref --hash HEAD)
- name: 'Build docs'
env:
NVTE_DOCS_DISABLE_PUBLIC_FEATURES: '1'
NVTE_DOCS_DISABLE_PUBLIC_FEATURES: ${{ inputs.enable_public_features && '0' || '1' }}
NVTE_DOCS_SWITCHER_JSON_URL: 'versions1.json'
run: | # SPHINXOPTS="-W" errors out on warnings
doxygen docs/Doxyfile
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ jobs:
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 'Lint'
run: |
sudo apt-get update
sudo apt-get install pip -y
pip install torch numpy
pip install torch numpy wheel
export PYTHON_ONLY=1
export TE_PATH=.
bash ./qa/L0_pytorch_lint/test.sh
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/minimum_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
name: 'Minimum supported versions'
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/nccl-extensions
Submodule nccl-extensions updated 62 files
+12 −1 nccl_ep/CMakeLists.txt
+13 −3 nccl_ep/Makefile
+34 −2 nccl_ep/README.md
+9 −0 nccl_ep/ci/run_nccl_ep_ci_tests.sh
+432 −0 nccl_ep/device/cft.cuh
+3 −3 nccl_ep/device/count_kernel.cuh
+25 −0 nccl_ep/device/device_primitives.cuh
+718 −319 nccl_ep/device/ht_ep.cuh
+477 −45 nccl_ep/device/ht_ep_adapter.cu
+84 −15 nccl_ep/device/ht_ep_adapter.cuh
+2 −0 nccl_ep/device/ht_ep_configs.cuh
+64 −10 nccl_ep/device/jit/ht_combine_jit.cuh
+3 −1 nccl_ep/device/jit/ht_dispatch_jit.cuh
+92 −0 nccl_ep/device/jit/ht_lsa_sync_jit.cuh
+41 −19 nccl_ep/device/jit/jit_runtime.cc
+4 −0 nccl_ep/device/jit/jit_runtime.hpp
+83 −0 nccl_ep/device/jit/ll_clean_jit.cuh
+98 −37 nccl_ep/device/jit/ll_combine_jit.cuh
+186 −24 nccl_ep/device/jit/ll_dispatch_jit.cuh
+780 −0 nccl_ep/device/ll/ll_combine_lsa.cuh
+163 −0 nccl_ep/device/ll/ll_common.cuh
+1,151 −0 nccl_ep/device/ll/ll_dispatch_lsa.cuh
+131 −0 nccl_ep/device/ll/ll_dispatch_recipe.cuh
+216 −0 nccl_ep/device/ll/ll_ep_smem.cuh
+92 −0 nccl_ep/device/ll/ll_gin.cuh
+188 −0 nccl_ep/device/ll/ll_logfmt.cuh
+68 −0 nccl_ep/device/ll/ll_lsa_primitives.cuh
+209 −0 nccl_ep/device/ll/ll_mask.cuh
+511 −879 nccl_ep/device/ll_ep.cuh
+97 −51 nccl_ep/device/ll_ep_adapter.cu
+110 −30 nccl_ep/device/ll_ep_adapter.cuh
+474 −0 nccl_ep/device/ll_ep_cft.cuh
+0 −103 nccl_ep/device/ll_ep_smem.cuh
+25 −5 nccl_ep/device/macros.cuh
+38 −1 nccl_ep/docs/documentation/api_reference.md
+6 −0 nccl_ep/docs/documentation/quantization.md
+12 −5 nccl_ep/docs/documentation/zero_copy.md
+619 −154 nccl_ep/ep_bench.cu
+56 −0 nccl_ep/ht_compact_prob.h
+2 −6 nccl_ep/include/common.hpp
+53 −0 nccl_ep/include/nccl_ep.h
+1,129 −372 nccl_ep/nccl_ep.cc
+687 −0 nccl_ep/nccl_ep_cft.cc
+165 −0 nccl_ep/nccl_ep_cft.h
+95 −1 nccl_ep/nccl_ep_env.cc
+26 −0 nccl_ep/nccl_ep_env.h
+6 −0 nccl_ep/nccl_ep_test_internal.h
+14 −1 nccl_ep/tests/Makefile
+39 −2 nccl_ep/tests/run_tests.sh
+169 −0 nccl_ep/tests/test_cft_driver_api.cu
+347 −6 nccl_ep/tests/test_ht_bwd.cu
+115 −0 nccl_ep/tests/test_ht_chunk_config.cu
+215 −0 nccl_ep/tests/test_ht_chunk_handle.cu
+550 −0 nccl_ep/tests/test_ht_compact_prob.cu
+680 −0 nccl_ep/tests/test_ht_dispatch_async.cu
+274 −0 nccl_ep/tests/test_lifecycle.cu
+71 −0 nccl_ep/tests/test_ll_kernel_selection.cu
+12 −0 nccl_ep/tests/test_public_struct_abi.cu
+234 −0 nccl_ep/tests/test_quantization_recipe.cu
+30 −0 python/nccl/m2n/README.md
+379 −0 python/nccl/m2n/examples/reshard_jax.py
+1 −0 python/pyproject.toml
27 changes: 27 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,33 @@ requirements, or performance-relevant behavior.
- Standalone examples live under `examples/pytorch/` and `examples/jax/`.
- Tutorials and notebooks live under `docs/examples/`.

## Code Quality

It is not sufficient for code to be correct and performant: it must be
human-readable as well. Human review is the bottleneck in TE
development, and PRs that are unpleasant to read are more likely to be
neglected by reviewers. These guidelines are defaults, not substitutes
for judgment.

- Public APIs, including the C API, must be backward compatible. Design
new ones to be clean, general, and extensible. Within reason, generalize
existing APIs rather than adding new ones.
- Limit changes to the task's scope; do not refactor unrelated code.
- Within that scope, restructure abstractions when needed to keep the code
coherent rather than adding workarounds that minimize the diff. Avoid
overengineering and unnecessary indirection.
- Write code that is understandable without its comments, and add
comments where they aid understanding. Keep them concise, since
humans skim long comments. Describe the code as it is for a reader
without context, not its edit history. Treat an incorrect comment
like incorrect code.
- Use descriptive names that read naturally. Follow the conventions of the
surrounding code and domain, and avoid inventing idiosyncratic
terminology.
- Extend existing infrastructure rather than building parallel systems.
For example, add cases to an existing test suite instead of creating
a new test file for each change.

## Contribution Requirements

Follow `CONTRIBUTING.rst` and `.github/PULL_REQUEST_TEMPLATE.md`.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ News
====

* **[09/2026]** `Transformer Engine v2.19 <https://github.com/NVIDIA/TransformerEngine/releases/tag/v2.19>`_ adds Rubin support, hybrid quantization, MXFP8 EP communication, and expanded FP8 attention support.
* **[09/2026]** `Accelerating Dropless MoE Training in JAX with NVIDIA Transformer Engine <https://developer.nvidia.com/blog/accelerating-dropless-moe-training-in-jax-with-nvidia-transform-engine/>`_ describes optimized JAX MoE training on GB200 and GB300 systems.
* **[09/2026]** `Accelerating Dropless MoE Training in JAX with NVIDIA Transformer Engine <https://developer.nvidia.com/blog/accelerating-dropless-moe-training-in-jax-with-nvidia-transformer-engine/>`_ describes optimized JAX MoE training on GB200 and GB300 systems.
* **[08/2026]** `Transformer Engine v2.18 <https://github.com/NVIDIA/TransformerEngine/releases/tag/v2.18>`_ adds FP8 block scaling in PyTorch, zero-copy EP, and CUDA Graph support for THD attention.
* **[07/2026]** `Transformer Engine v2.17 <https://github.com/NVIDIA/TransformerEngine/releases/tag/v2.17>`_ introduces NCCL-backed EP for PyTorch and JAX, faster MoE routing, and a JAX Flax MoE block.
* **[06/2026]** `Boosting MoE Training Throughput with Advanced Fusion Kernels <https://developer.nvidia.com/blog/boosting-moe-training-throughput-with-advanced-fusion-kernels/>`_ shows how fused Transformer Engine operations accelerate MoE training.
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/linear/benchmark_graph_safe_grouped_mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

os.environ.setdefault("CUDA_DEVICE_MAX_CONNECTIONS", "1")
os.environ.setdefault("NVTE_ALLOW_NONDETERMINISTIC_ALGO", "1")
os.environ.setdefault("NVTE_CUTEDSL_FUSED_GROUPED_MLP", "1")
os.environ.setdefault("CUDNN_FE_GROUPED_GEMM_DYNAMIC_MNKL", "1")

import argparse
Expand Down Expand Up @@ -91,6 +90,7 @@ def build_grouped_mlp(
dtype=dtype,
single_grouped_weight=single_grouped_weight,
accumulate_into_main_grad=accumulate_into_main_grad,
split_alignment=256,
)
fc2 = te_ops.GroupedLinear(
num_groups,
Expand All @@ -101,6 +101,7 @@ def build_grouped_mlp(
dtype=dtype,
single_grouped_weight=single_grouped_weight,
accumulate_into_main_grad=accumulate_into_main_grad,
split_alignment=256,
)
return te_ops.Sequential(
fc1,
Expand Down Expand Up @@ -318,7 +319,6 @@ def main() -> None:
for name in (
"CUDA_DEVICE_MAX_CONNECTIONS",
"NVTE_ALLOW_NONDETERMINISTIC_ALGO",
"NVTE_CUTEDSL_FUSED_GROUPED_MLP",
"CUDNN_FE_GROUPED_GEMM_DYNAMIC_MNKL",
):
print(f" {name}={os.environ.get(name)}")
Expand Down
2 changes: 1 addition & 1 deletion build_tools/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.21.0.dev0
2.22.0.dev0
7 changes: 6 additions & 1 deletion build_tools/jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
all_files_in_dir,
cudnn_frontend_include_path,
debug_build_enabled,
get_bolt_build_flags,
setup_mpi_flags,
nccl_include_path,
nccl_lib_path,
Expand All @@ -26,7 +27,7 @@

def install_requirements() -> List[str]:
"""Install dependencies for TE/JAX extensions."""
return ["jax", "flax>=0.7.1", "nvidia-cudnn-frontend>=1.25.0"]
return ["jax", "flax>=0.7.1", "nvidia-cudnn-frontend>=1.25.0", "triton"]


def test_requirements() -> List[str]:
Expand Down Expand Up @@ -122,6 +123,9 @@ def setup_jax_extension(
else:
cxx_flags.append("-g0")

bolt_cxx_flags, linker_flags = get_bolt_build_flags()
cxx_flags.extend(bolt_cxx_flags)

setup_mpi_flags(include_dirs, cxx_flags)

if bool(int(os.getenv("NVTE_WITH_CUBLASMP", 0))):
Expand All @@ -144,5 +148,6 @@ def setup_jax_extension(
sources=[str(path) for path in sources],
include_dirs=[str(path) for path in include_dirs],
extra_compile_args=cxx_flags,
extra_link_args=linker_flags,
**kwargs,
)
5 changes: 5 additions & 0 deletions build_tools/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
cuda_version,
get_cuda_include_dirs,
debug_build_enabled,
get_bolt_build_flags,
nccl_ep_enabled,
setup_mpi_flags,
)
Expand Down Expand Up @@ -76,6 +77,9 @@ def setup_pytorch_extension(
else:
cxx_flags.append("-g0")

bolt_cxx_flags, linker_flags = get_bolt_build_flags()
cxx_flags.extend(bolt_cxx_flags)

# Version-dependent CUDA options
try:
version = cuda_version()
Expand Down Expand Up @@ -127,6 +131,7 @@ def setup_pytorch_extension(
sources=[str(src) for src in sources],
include_dirs=[str(inc) for inc in include_dirs],
extra_compile_args={"cxx": cxx_flags},
extra_link_args=linker_flags,
libraries=[str(lib) for lib in libraries],
library_dirs=[str(lib_dir) for lib_dir in library_dirs],
)
67 changes: 67 additions & 0 deletions build_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import importlib
import os
import re
import shlex
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -43,6 +44,72 @@ def debug_build_enabled() -> bool:
return bool(int(os.getenv("NVTE_BUILD_DEBUG", "0")))


@functools.lru_cache(maxsize=None)
def _cxx_compiler_predefined_macros() -> Tuple[str, ...]:
"""Predefined macros from the configured C++ compiler."""
cxx = shlex.split(os.getenv("CXX", "c++"))
if not cxx:
return ()
try:
result = subprocess.run(
[*cxx, "-dM", "-E", "-x", "c++", "-"],
input="",
capture_output=True,
text=True,
)
except OSError:
return ()
if result.returncode != 0:
return ()
return tuple(
fields[1]
for line in result.stdout.splitlines()
if len(fields := line.split(maxsplit=2)) >= 2 and fields[0] == "#define"
)


@functools.lru_cache(maxsize=None)
def cxx_compiler_supports_flag(flag: str) -> bool:
"""Whether the configured C++ compiler accepts a command-line flag."""
cxx = shlex.split(os.getenv("CXX", "c++"))
if not cxx:
return False
try:
result = subprocess.run(
[*cxx, flag, "-x", "c++", "-fsyntax-only", "-"],
input="",
capture_output=True,
text=True,
)
except OSError:
return False
return result.returncode == 0


def cxx_compiler_targets_arm64() -> bool:
"""Whether the configured C++ compiler targets Arm64."""
macros = _cxx_compiler_predefined_macros()
return any(macro in macros for macro in ("__aarch64__", "__arm64__", "_M_ARM64"))


def get_bolt_build_flags() -> Tuple[List[str], List[str]]:
"""BOLT-compatible host compiler and linker flags."""
compiler_flags = ["-fno-jump-tables"]
if cxx_compiler_supports_flag("-fno-reorder-blocks-and-partition"):
compiler_flags.append("-fno-reorder-blocks-and-partition")
linker_flags = ["-Wl,--emit-relocs", "-Wl,-z,now"]
if cxx_compiler_targets_arm64():
compiler_flags.extend(
[
"-mno-fix-cortex-a53-835769",
"-mno-fix-cortex-a53-843419",
]
)
# The Cortex-A53 843419 workaround is applied by the linker.
linker_flags.append("-mno-fix-cortex-a53-843419")
return compiler_flags, linker_flags


@functools.lru_cache(maxsize=None)
def get_max_jobs_for_parallel_build() -> int:
"""Number of parallel jobs for Nina build"""
Expand Down
32 changes: 32 additions & 0 deletions docs/_static/css/diagram-colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,38 @@ html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .memory-label { fill: #e0e0e0; }
html[data-theme="dark"] .connector { stroke: #bdbdbd; }

/* mixture_of_experts diagrams */
html[data-theme="dark"] .small-label,
html[data-theme="dark"] .tiny-label,
html[data-theme="dark"] .row-label,
html[data-theme="dark"] .rank-label { fill: #bdbdbd; }
html[data-theme="dark"] .grid-title,
html[data-theme="dark"] .brace-label,
html[data-theme="dark"] .row-label-l,
html[data-theme="dark"] .row-label-r,
html[data-theme="dark"] .mono { fill: #e0e0e0; }
html[data-theme="dark"] .expert-e0 { fill: #10375c; stroke: #64b5f6; }
html[data-theme="dark"] .expert-e1 { fill: #1e4620; stroke: #81c784; }
html[data-theme="dark"] .expert-e2 { fill: #5c3a10; stroke: #ffb74d; }
html[data-theme="dark"] .expert-e3 { fill: #5c1f38; stroke: #f48fb1; }
html[data-theme="dark"] .stage,
html[data-theme="dark"] .grouped,
html[data-theme="dark"] .a2a,
html[data-theme="dark"] .fused-mlp { fill: #3a2f5c; stroke: #b39ddb; }
html[data-theme="dark"] .moe-op { fill: #10375c; stroke: #64b5f6; }
html[data-theme="dark"] .act,
html[data-theme="dark"] .sel { fill: #1e4620; stroke: #81c784; }
html[data-theme="dark"] .linear,
html[data-theme="dark"] .param,
html[data-theme="dark"] .hbm,
html[data-theme="dark"] .cell,
html[data-theme="dark"] .box { fill: #2b2b2b; stroke: #9e9e9e; }
html[data-theme="dark"] .unsel,
html[data-theme="dark"] .pad { fill: #1f1f1f; stroke: #616161; }
html[data-theme="dark"] .soft-arrow,
html[data-theme="dark"] .brace { stroke: #bdbdbd; }
html[data-theme="dark"] .skip,
html[data-theme="dark"] .farrow { stroke: #b39ddb; }

/* fine_grained_quantization diagrams */
html[data-theme="dark"] .fmt-mxfp8 { fill: #10375c; stroke: #64b5f6; }
Expand Down
24 changes: 24 additions & 0 deletions docs/api/jax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,27 @@ Modules
:members: __call__

.. autoapifunction:: transformer_engine.jax.flax.extend_logical_axis_rules


Mixture of Experts
------------------
Router, routing kernels, and grouped dense for MoE layers. See
:doc:`Mixture of Experts <../features/mixture_of_experts/mixture_of_experts>` for an overview.

.. autoapifunction:: transformer_engine.jax.router.fused_topk_with_score_function

.. autoapifunction:: transformer_engine.jax.router.fused_moe_aux_loss

.. autoapifunction:: transformer_engine.jax.permutation.sort_chunks_by_index

.. autoapifunction:: transformer_engine.jax.dense.grouped_dense

.. autoapifunction:: transformer_engine.jax.moe.moe

.. autoapifunction:: transformer_engine.jax.ep.ep_bootstrap

.. autoapifunction:: transformer_engine.jax.ep.ep_finalize

.. autoapifunction:: transformer_engine.jax.ep.ep_dispatch

.. autoapifunction:: transformer_engine.jax.ep.ep_combine
Loading