vllm.models.common.ops.moe_tail_fusion.primitives
¶
CuTe DSL primitives shared by the fused MoE-tail kernels: PTX loads and stores, NVLS multicast stores, Lamport mailbox helpers, BF16 packing, block reductions and launch helpers. This module defines no kernel.
Classes:
-
CUDAGraphCompatibleWrapper–DLPack view that does not synchronize with the producer stream.
Functions:
-
fragment_has_negative_zero–Whether a BF16 fragment still holds the BF16 sentinel in any lane.
-
fragment_is_dirty–Whether an FP32 fragment still holds the FP32 sentinel in any word.
-
group_leader_block_sum–Block sum of the values held by every
leader_stride-th lane. -
load_global_u32x4–Load one 128-bit fragment as four u32 registers.
-
load_shared_f32x2–Load two aligned FP32 partials from local shared memory.
-
load_shared_f32x4–Load four aligned FP32 partials from local shared memory.
-
map_shared_to_peer–Map a local shared-memory slot to the same slot in a peer CTA.
-
red_async_release_gpu_add_u32–The SM100 arrival primitive FlashInfer's LamportFlags use.
-
sanitize_negative_zero_u32x4–Turn real BF16 -0 into +0 so it cannot equal the empty sentinel.
-
stmc_bf16x8–Publish eight BF16 values (four packed words) through NVLS multicast.
-
store_global_u32x4–Store four packed words to an ordinary or NVLS multicast global VA.
-
store_lamport_sentinel_128–Reset one FP32 Lamport fragment to four FP32 negative-zero bit patterns.
-
store_lamport_sentinel_u32x4–Reset one BF16 Lamport fragment to BF16 negative zeros.
-
to_cute_dynamic–A 1-D view whose length is a runtime shape divisible by
divisibility. -
to_cute_dynamic_m–Expose exactly one compact tensor mode as a runtime shape.
-
warp_sum_specialized–Warp sum supporting a compile-time partial final warp.
CUDAGraphCompatibleWrapper
¶
DLPack view that does not synchronize with the producer stream.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
fragment_has_negative_zero(packed)
¶
Whether a BF16 fragment still holds the BF16 sentinel in any lane.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
fragment_is_dirty(packed)
¶
Whether an FP32 fragment still holds the FP32 sentinel in any word.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
group_leader_block_sum(value, warp_sums, warps, leader_stride)
¶
Block sum of the values held by every leader_stride-th lane.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
load_global_u32x4(pointer, *, volatile=False, loc=None, ip=None)
¶
Load one 128-bit fragment as four u32 registers.
The volatile form is the Lamport polling load. Marking the asm side-effecting prevents loop-invariant motion and common-subexpression elimination across polling iterations.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
load_shared_f32x2(pointer, *, loc=None, ip=None)
¶
Load two aligned FP32 partials from local shared memory.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
load_shared_f32x4(pointer, *, loc=None, ip=None)
¶
Load four aligned FP32 partials from local shared memory.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
map_shared_to_peer(smem_pointer, peer_rank, *, loc=None, ip=None)
¶
Map a local shared-memory slot to the same slot in a peer CTA.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
red_async_release_gpu_add_u32(pointer, value, *, loc=None, ip=None)
¶
The SM100 arrival primitive FlashInfer's LamportFlags use.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
sanitize_negative_zero_u32x4(packed)
¶
Turn real BF16 -0 into +0 so it cannot equal the empty sentinel.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
stmc_bf16x8(address, packed, *, loc=None, ip=None)
¶
Publish eight BF16 values (four packed words) through NVLS multicast.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
store_global_u32x4(address, packed, *, volatile=False, loc=None, ip=None)
¶
Store four packed words to an ordinary or NVLS multicast global VA.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
store_lamport_sentinel_128(pointer, *, loc=None, ip=None)
¶
Reset one FP32 Lamport fragment to four FP32 negative-zero bit patterns.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
store_lamport_sentinel_u32x4(address, *, loc=None, ip=None)
¶
Reset one BF16 Lamport fragment to BF16 negative zeros.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
to_cute_dynamic(tensor, alignment, *, divisibility)
¶
A 1-D view whose length is a runtime shape divisible by divisibility.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
to_cute_dynamic_m(tensor, *, mode, assumed_align=16)
¶
Expose exactly one compact tensor mode as a runtime shape.
Model dimensions remain part of the compiled tensor type. Only the token mode is symbolic, so changing M within an op's capacity reuses the same compiled kernel.
Source code in vllm/models/common/ops/moe_tail_fusion/primitives.py
warp_sum_specialized(value, warp_idx, lane, warps, last_warp_lanes, last_warp_mask)
¶
Warp sum supporting a compile-time partial final warp.