Skip to content

python3Packages.nvidia-cutlass-dsl: 4.5.0 -> 4.6.1 - #739

Merged
danieldk merged 5 commits into
mainfrom
nvidia-cutlass-dsl-4.6.1
Aug 3, 2026
Merged

danieldk merged 5 commits into
mainfrom
nvidia-cutlass-dsl-4.6.1

Conversation

@danieldk

@danieldk danieldk commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

Needs to be tested with flash-attn4, etc.

sayakpaul
sayakpaul previously approved these changes Jul 30, 2026

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update about the FA4 build.

Comment on lines -39 to +43
pname =
if cudaPackages.cudaAtLeast "13.0" then
"nvidia_cutlass_dsl_libs_cu13"
else
"nvidia_cutlass_dsl_libs_base";
pname = "nvidia_cutlass_dsl_libs_base";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for standardizing the pname?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cu12/cu13 are now in sync with the package naming/splits, so we can give this the common name.

Comment on lines +32 to +35
hash =
hashes."${pyShortVersion}-${stdenv.system}-cu${cudaMajor}"
or (throw "Unsupported Python version: ${pyShortVersion}-${stdenv.system}-cu${cudaMajor}");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@IlyasMoutawwakil IlyasMoutawwakil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks !

@drbh drbh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@danieldk
danieldk merged commit a6564d1 into main Aug 3, 2026
50 checks passed
IlyasMoutawwakil added a commit to NanoCode012/kernels-community that referenced this pull request Aug 3, 2026
IlyasMoutawwakil added a commit to huggingface/kernels-community that referenced this pull request Aug 4, 2026
* chore: pick changes Dao-AILab/sonic-moe#66

* feat: update quack to 0.5.0

* feat: update quack to 0.6.1

* fix: correct vendored quack _ops_compat import depth in transform/hadamard

* refactor: re-vendor clean upstream sonicmoe, drop EP divergence

* fix: missed triton op namespace

* chore: update major version + remove branch for clean push

* use cutedsl 4.6 and update lock

* updated lock

* revert changes from main

* sonic-moe: track kernel-builder main now that cutlass-dsl 4.6.1 landed (huggingface/kernels#739)

---------

Co-authored-by: NanoCode012 <nano@axolotl.ai>
IlyasMoutawwakil added a commit to huggingface/kernels-community that referenced this pull request Aug 4, 2026
* chore: pick changes Dao-AILab/sonic-moe#66

* feat: update quack to 0.5.0

* feat: update quack to 0.6.1

* fix: correct vendored quack _ops_compat import depth in transform/hadamard

* refactor: re-vendor clean upstream sonicmoe, drop EP divergence

* fix: missed triton op namespace

* chore: update major version + remove branch for clean push

* use cutedsl 4.6 and update lock

* updated lock

* revert changes from main

* sonic-moe: EP support (#770)

Co-authored-by: IlyasMoutawwakil <moutawwakil.ilyas.tsi@gmail.com>

* sonic-moe: fix ep backward (#824)

* added ep support

* backward fix

* sonic-moe: never scatter the uninitialized tail of the colvec reduce … (#1056)

* sonic-moe: never scatter the uninitialized tail of the colvec reduce into ds

Port of IlyasMoutawwakil/sonic-moe#1 to the vendored kernel. Under expert
parallelism the router marks non-local slots with a sentinel expert id, the
metadata stage drops them from the histogram, and cu_seqlens_m therefore covers
only the sum_valid entries routed to a local expert. QuACK allocates
colvec_reduce_partial with torch.empty and only the covered tiles write it, so
rows [sum_valid, TK) of ds_scattered are uninitialized memory. s_scatter_idx's
tail is zero-filled, so

    ds[s_scatter_idx] = ds_scattered

aliases every one of those rows onto ds[0], with duplicate indices, leaving the
surviving value unspecified. ds is the gradient of the routing weights, consumed
only by the router, so freed GPU memory becomes mlp.gate's gradient.

_scatter_valid_rows redirects the rows no tile wrote to a scratch slot instead of
slot 0, and the zero-filled scratch buffer is copied over ds in full, so slots
owning no row end at a defined zero. The bound is compared on device: an
int(expert_frequency_offset[-1]) would stall the host once per MoE layer per step.
Without EP, sum_valid == TK, every row is valid, and this reduces to the scatter
it replaces.

Also drops a duplicated ds scatter, and zero-inits old_ds_partial/new_ds_partial
in the expert-bias path for consistency — untested, as no model exercised here
has an expert bias.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* sonic-moe: gather ds through the inverse permutation instead of a guarded scatter

Per review: `s_reverse_scatter_idx` already carries everything the guarded scatter
reconstructed — the general-routing metadata writes each valid lane's grouped row
and `TK` at every sentinel lane. So append one zero row to the colvec-reduce
output and gather, instead of masking a scatter.

Both hazards then go away by construction rather than by masking. A gather writes
each output element exactly once, so no duplicate index can reach ds; and no lane
addresses [sum_valid, TK), so the uninitialized tail is unreachable rather than
merely redirected. Drops the arange, the torch.where and the int64 index
temporary — three passes over TK instead of five — and old_ds_partial goes back to
torch.empty since every element is now written.

Requires s_reverse_scatter_idx in the backward: _DownProjection had it in forward
but was not saving it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* sonic-moe: trim comments

* sonic-moe: drop the torch.compiler.is_compiling asserts

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* sonic-moe: publish the EP build to the ep-support branch

* sonic-moe: track kernel-builder main now that cutlass-dsl 4.6.1 landed (huggingface/kernels#739)

* sonic-moe: EP support (#770)

Co-authored-by: IlyasMoutawwakil <moutawwakil.ilyas.tsi@gmail.com>

* sonic-moe: fix ep backward (#824)

* added ep support

* backward fix

* sonic-moe: never scatter the uninitialized tail of the colvec reduce … (#1056)

* sonic-moe: never scatter the uninitialized tail of the colvec reduce into ds

Port of IlyasMoutawwakil/sonic-moe#1 to the vendored kernel. Under expert
parallelism the router marks non-local slots with a sentinel expert id, the
metadata stage drops them from the histogram, and cu_seqlens_m therefore covers
only the sum_valid entries routed to a local expert. QuACK allocates
colvec_reduce_partial with torch.empty and only the covered tiles write it, so
rows [sum_valid, TK) of ds_scattered are uninitialized memory. s_scatter_idx's
tail is zero-filled, so

    ds[s_scatter_idx] = ds_scattered

aliases every one of those rows onto ds[0], with duplicate indices, leaving the
surviving value unspecified. ds is the gradient of the routing weights, consumed
only by the router, so freed GPU memory becomes mlp.gate's gradient.

_scatter_valid_rows redirects the rows no tile wrote to a scratch slot instead of
slot 0, and the zero-filled scratch buffer is copied over ds in full, so slots
owning no row end at a defined zero. The bound is compared on device: an
int(expert_frequency_offset[-1]) would stall the host once per MoE layer per step.
Without EP, sum_valid == TK, every row is valid, and this reduces to the scatter
it replaces.

Also drops a duplicated ds scatter, and zero-inits old_ds_partial/new_ds_partial
in the expert-bias path for consistency — untested, as no model exercised here
has an expert bias.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* sonic-moe: gather ds through the inverse permutation instead of a guarded scatter

Per review: `s_reverse_scatter_idx` already carries everything the guarded scatter
reconstructed — the general-routing metadata writes each valid lane's grouped row
and `TK` at every sentinel lane. So append one zero row to the colvec-reduce
output and gather, instead of masking a scatter.

Both hazards then go away by construction rather than by masking. A gather writes
each output element exactly once, so no duplicate index can reach ds; and no lane
addresses [sum_valid, TK), so the uninitialized tail is unreachable rather than
merely redirected. Drops the arange, the torch.where and the int64 index
temporary — three passes over TK instead of five — and old_ds_partial goes back to
torch.empty since every element is now written.

Requires s_reverse_scatter_idx in the backward: _DownProjection had it in forward
but was not saving it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* sonic-moe: trim comments

* sonic-moe: drop the torch.compiler.is_compiling asserts

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* sonic-moe: publish the EP build to the ep-support branch

* sonic-moe: drop _up_projection_backward_weight from the EP port

Re-added by mistake when resolving the #1056 cherry-pick against the re-vendored
tree: the whole conflict hunk was taken wholesale, but #1023 removed this function
upstream and nothing calls it. Not EP-related either way.

* address comments

---------

Co-authored-by: NanoCode012 <nano@axolotl.ai>
Co-authored-by: Daniël de Kok <me@danieldk.eu>
Co-authored-by: AmineDiro <aminedirhoussi1@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants