vllm.models.muse_spark.nvidia.specialized_decode.cutedsl.common.primitives
¶
PTX building blocks and launch helpers of the Muse Spark specialized decode.
Every Lamport kernel of the package (the boundary gathers, the attention
boundary, the MoE tail and the unpooler's zero-copy epilogue) is built from
these. BF16 negative zero (0x8000) marks a slot that has not been written yet;
a three-generation stage state (NEXT_STAGE written by the consumer,
ACTIVE_STAGE by the publisher) lets a fast rank publish the next call while
a slow one still reads the current one.
Functions:
-
add_ftz_f32–A + b, round to nearest, subnormal inputs and result flushed to a zero
-
add_rn–A + b, round to nearest, subnormals kept.
-
atomic_add1_acq_rel_u32–Add 1 to the global word at
pointerand return its value before -
atomic_add1_acq_rel_u32_address–atomic_add1_acq_rel_u32of the global word ataddress. -
atomic_add1_u32_address–atomicAdd(address, 1)(relaxed, GPU scope): the word before. -
atomic_exch_zero_u32_address–atomicExch(address, 0)(relaxed, GPU scope). -
bf16x2_to_f32x2–The BF16 pair in
wordwidened to FP32 (exact): (bits 0-15, 16-31). -
cp_async_cg_16–Copy 16 bytes from global
sourceto this CTA's shared -
cp_async_wait–Wait until at most
pendingof this thread's cp.async groups are in -
div_full_f32–A / b as
div.full.f32(Triton's FP32 division). -
ex2_approx_ftz–2 ** a by ex2.approx, subnormals flushed.
-
f32_bits–The bit pattern of an FP32 value.
-
fence_mbarrier_init_cluster–Release this CTA's mbarrier initializations to the cluster.
-
fma_ftz_f32–A * b + c with one rounding, subnormals flushed.
-
fma_rn–A * b + c with one rounding.
-
fms_rn–A * b - c with one rounding (the negation is exact, -0 included).
-
global_timer_ns–The GPU's global nanosecond timer (bounds the Lamport spins).
-
ldmc_bf16x8–Reduce-load eight BF16s; an omitted predicate loads, false returns zeros.
-
load_f16x8_as_f32–8 FP16 elements from element
offsetofbase(one 16-byte -
load_global_cg_f32_address–An FP32 load cached in L2 only (another CTA's store, after a fence).
-
load_global_cg_f32x2_address–load_global_cg_f32_addressof two FP32. -
load_global_f32x4_address–Four FP32 at the 16-byte aligned
addressin one load;ordered -
load_global_nc_f32_address–A read-only FP32 load through the non-coherent path, in program order.
-
load_global_nc_s32_or–The read-only word at
addressifpredicate, elseother. -
load_global_nc_u32x4_address–Four words of data no thread of the grid writes (the read-only path),
-
load_global_u32x4–Load four words; an omitted predicate loads normally, false returns zeros.
-
load_shared_f32_or–The FP32 at shared
addressifpredicate, elseother. -
load_shared_u32x4_address–load_shared_u32x4by address. -
load_shared_u32x4_unpacked–load_shared_u32x4_addressas a tuple of four Uint32. -
lowest_set_bit–The index of the lowest set bit of a nonzero
mask(CUDA's -
map_shared_address_to_peer–The shared::cluster address of this CTA's shared
addressin the -
max_ftz_f32–The larger of a and b (a NaN operand yields the other), subnormals
-
mbarrier_arrive_expect_tx_address–Arrive on the shared mbarrier at
barexpectingnum_bytes -
mbarrier_init_address–Initialize the shared mbarrier at
barforcountarrivals (a -
mbarrier_try_wait_phase0_cluster–1 once phase 0 of the shared mbarrier at
addresshas completed -
mbarrier_wait_address–Spin until the phase of
paritycompletes (acquire, CTA scope). -
mbarrier_wait_cluster_address–mbarrier_wait_addresswith cluster-scope acquire: for a phase that -
membar_gl–The fence of
__threadfence(). -
mma_m16n8k16_bf16–mma.sync m16n8k16 row.col with BF16 operands and FP32 accumulation: the
-
movmatrix_trans_b16–This lane's word of the warp's 8x8 b16 matrix, transposed.
-
mul_ftz_f32–A * b, round to nearest, subnormals flushed; never contracted.
-
mul_rn–A * b, round to nearest, subnormals kept; never contracted.
-
pack_bf16x2_rn–Two FP32 rounded to nearest-even BF16, lo in bits 0-15, hi in bits 16-31.
-
pack_bf16x8_rn–8 FP32 scalars rounded to nearest-even BF16, as 4 packed words (an
-
rcp_approx_ftz–1 / a by rcp.approx, subnormals flushed (the fast-math 1 / a).
-
regs–An 8-wide FP32 TensorSSA (
load_f32x8,load_bf16x8_as_f32) as -
round_bf16–A rounded to BF16 (nearest even), widened back.
-
rsqrt_approx_f32–rsqrt.approx with subnormal inputs kept (
rsqrtfwithout fast math). -
rsqrt_approx_ftz–rsqrt.approx with subnormals flushed (libdevice's rsqrt under FTZ).
-
scale_or_neg_inf–scale * x(round to nearest, subnormals flushed) for akeyin -
sigmoid_f32–tl.sigmoid(x): x * -log2(e), ex2.approx, + 1, then 1 / that with -
stmc_bf16x8–Multicast-store eight BF16s; an omitted predicate stores, false skips.
-
store_async_cluster_f32x2–Store (lo, hi) at cluster address
remote -
store_async_cluster_f32x4–Four FP32 into a cluster CTA's shared memory
-
store_bf16x8_rn–8 FP32 scalars rounded to nearest-even BF16 and stored as one 16-byte
-
store_global_f32_address–Store
valueat globaladdressifpredicate. -
store_shared_f32_address–Store
valueat sharedaddressifpredicate. -
sub_ftz_f32–A - b, round to nearest, subnormals flushed.
-
tma_load_2d–The box of
tensor_mapat (c0, c1) (inner coordinate first) into -
tma_prefetch_2d_l2–Prefetch the box of
tensor_mapat (c0, c1) into L2. -
trap–Abort the kernel: the launch fails instead of hanging.
_clobbered(constraints, clobber_memory)
¶
constraints with a memory clobber added when clobber_memory.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
_load_shared_u32x4(address, loc, ip)
¶
Four words at the shared address, the struct of one ld.shared.v4;
side-effecting, so it does not move across the barriers and mbarrier waits
that guard the data.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
_ordered(text, constraints, operands, loc, ip, result=None)
¶
Side-effecting asm: kept in program order with the other side-effecting operations.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
add_ftz_f32(a, b, *, loc=None, ip=None)
¶
A + b, round to nearest, subnormal inputs and result flushed to a zero of the same sign (the add of code built with fast math).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
add_rn(a, b, *, loc=None, ip=None)
¶
A + b, round to nearest, subnormals kept.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
atomic_add1_acq_rel_u32(pointer, *, loc=None, ip=None)
¶
Add 1 to the global word at pointer and return its value before
(acquire-release, GPU scope): a ticket.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
atomic_add1_acq_rel_u32_address(address, *, loc=None, ip=None)
¶
atomic_add1_acq_rel_u32 of the global word at address.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
atomic_add1_u32_address(address, *, loc=None, ip=None)
¶
atomicAdd(address, 1) (relaxed, GPU scope): the word before.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
atomic_exch_zero_u32_address(address, *, loc=None, ip=None)
¶
atomicExch(address, 0) (relaxed, GPU scope).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
bf16x2_to_f32x2(word, *, loc=None, ip=None)
¶
The BF16 pair in word widened to FP32 (exact): (bits 0-15, 16-31).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
cp_async_cg_16(destination, source, predicate, *, loc=None, ip=None)
¶
Copy 16 bytes from global source to this CTA's shared
destination asynchronously, bypassing L1, if predicate.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
cp_async_wait(pending, *, loc=None, ip=None)
¶
Wait until at most pending of this thread's cp.async groups are in
flight.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
div_full_f32(a, b, *, loc=None, ip=None)
¶
A / b as div.full.f32 (Triton's FP32 division).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
ex2_approx_ftz(a, *, loc=None, ip=None)
¶
2 ** a by ex2.approx, subnormals flushed.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
f32_bits(value, *, loc=None, ip=None)
¶
The bit pattern of an FP32 value.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
fence_mbarrier_init_cluster(*, loc=None, ip=None)
¶
Release this CTA's mbarrier initializations to the cluster.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
fma_ftz_f32(a, b, c, *, loc=None, ip=None)
¶
A * b + c with one rounding, subnormals flushed.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
fma_rn(a, b, c, *, loc=None, ip=None)
¶
A * b + c with one rounding.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
fms_rn(a, b, c, *, loc=None, ip=None)
¶
A * b - c with one rounding (the negation is exact, -0 included).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
global_timer_ns(*, loc=None, ip=None)
¶
The GPU's global nanosecond timer (bounds the Lamport spins).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
ldmc_bf16x8(address, predicate=None, *, loc=None, ip=None)
¶
Reduce-load eight BF16s; an omitted predicate loads, false returns zeros.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_f16x8_as_f32(base, offset)
¶
8 FP16 elements from element offset of base (one 16-byte
access), converted exactly to FP32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_cg_f32_address(address, *, loc=None, ip=None)
¶
An FP32 load cached in L2 only (another CTA's store, after a fence).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_cg_f32x2_address(address, *, loc=None, ip=None)
¶
load_global_cg_f32_address of two FP32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_f32x4_address(address, *, ordered=False, loc=None, ip=None)
¶
Four FP32 at the 16-byte aligned address in one load; ordered
as for load_global_u32_address. A coherent load, not ld.global.nc:
ptxas moves read-only-path loads across griddepcontrol.wait either way,
so they cannot read what the PDL primary grid writes.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_nc_f32_address(address, *, loc=None, ip=None)
¶
A read-only FP32 load through the non-coherent path, in program order.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_nc_s32_or(address, predicate, other, *, loc=None, ip=None)
¶
The read-only word at address if predicate, else other.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_nc_u32x4_address(address, *, loc=None, ip=None)
¶
Four words of data no thread of the grid writes (the read-only path), in program order with the other side-effecting operations.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_global_u32x4(pointer, predicate=None, *, volatile=False, loc=None, ip=None)
¶
Load four words; an omitted predicate loads normally, false returns zeros.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_shared_f32_or(address, predicate, other, *, loc=None, ip=None)
¶
The FP32 at shared address if predicate, else other.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_shared_u32x4_address(address, *, loc=None, ip=None)
¶
load_shared_u32x4 by address.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
load_shared_u32x4_unpacked(address, *, loc=None, ip=None)
¶
load_shared_u32x4_address as a tuple of four Uint32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
lowest_set_bit(mask, *, loc=None, ip=None)
¶
The index of the lowest set bit of a nonzero mask (CUDA's
__ffs(mask) - 1).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
map_shared_address_to_peer(address, peer_rank, *, loc=None, ip=None)
¶
The shared::cluster address of this CTA's shared address in the
cluster's CTA peer_rank.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
max_ftz_f32(a, b, *, loc=None, ip=None)
¶
The larger of a and b (a NaN operand yields the other), subnormals flushed.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mbarrier_arrive_expect_tx_address(bar, num_bytes, *, clobber_memory=False, loc=None, ip=None)
¶
Arrive on the shared mbarrier at bar expecting num_bytes
transaction bytes.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mbarrier_init_address(bar, count, *, clobber_memory=False, loc=None, ip=None)
¶
Initialize the shared mbarrier at bar for count arrivals (a
Python int is an immediate operand, an Int32 a register).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mbarrier_try_wait_phase0_cluster(address, *, loc=None, ip=None)
¶
1 once phase 0 of the shared mbarrier at address has completed
(acquire at cluster scope: the stores that completed it are visible), 0
when the bounded wait ends first.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mbarrier_wait_address(bar, parity, *, loc=None, ip=None)
¶
Spin until the phase of parity completes (acquire, CTA scope).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mbarrier_wait_cluster_address(bar, parity, *, loc=None, ip=None)
¶
mbarrier_wait_address with cluster-scope acquire: for a phase that
peers complete (st.async complete_tx, release at cluster scope).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
membar_gl(*, loc=None, ip=None)
¶
mma_m16n8k16_bf16(a, b0, b1, c, *, ordered=False, loc=None, ip=None)
¶
mma.sync m16n8k16 row.col with BF16 operands and FP32 accumulation: the
four accumulators of A (four words) x B (b0, b1) + C (four FP32).
ordered makes it side-effecting asm, kept in program order with the
other side-effecting operations; otherwise the compiler schedules it.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
movmatrix_trans_b16(word, *, loc=None, ip=None)
¶
This lane's word of the warp's 8x8 b16 matrix, transposed.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mul_ftz_f32(a, b, *, loc=None, ip=None)
¶
A * b, round to nearest, subnormals flushed; never contracted.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
mul_rn(a, b, *, loc=None, ip=None)
¶
A * b, round to nearest, subnormals kept; never contracted.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
pack_bf16x2_rn(lo, hi, *, loc=None, ip=None)
¶
Two FP32 rounded to nearest-even BF16, lo in bits 0-15, hi in bits 16-31.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
pack_bf16x8_rn(values)
¶
8 FP32 scalars rounded to nearest-even BF16, as 4 packed words (an rmem tensor; traced inline).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
rcp_approx_ftz(a, *, loc=None, ip=None)
¶
1 / a by rcp.approx, subnormals flushed (the fast-math 1 / a).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
regs(values)
¶
An 8-wide FP32 TensorSSA (load_f32x8, load_bf16x8_as_f32) as
its 8 scalars (traced inline).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
round_bf16(a, *, loc=None, ip=None)
¶
A rounded to BF16 (nearest even), widened back.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
rsqrt_approx_f32(a, *, loc=None, ip=None)
¶
rsqrt.approx with subnormal inputs kept (rsqrtf without fast math).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
rsqrt_approx_ftz(a, *, loc=None, ip=None)
¶
rsqrt.approx with subnormals flushed (libdevice's rsqrt under FTZ).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
scale_or_neg_inf(x, scale, key, last, first=None, *, loc=None, ip=None)
¶
scale * x (round to nearest, subnormals flushed) for a key in
[first, last] (no lower bound without first), else -inf.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
sigmoid_f32(x, *, loc=None, ip=None)
¶
tl.sigmoid(x): x * -log2(e), ex2.approx, + 1, then 1 / that with
div.full.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
stmc_bf16x8(address, values, predicate=None, *, loc=None, ip=None)
¶
Multicast-store eight BF16s; an omitted predicate stores, false skips.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
store_async_cluster_f32x2(remote, lo, hi, remote_bar, predicate=None, *, clobber_memory=False, loc=None, ip=None)
¶
Store (lo, hi) at cluster address remote
(map_shared_address_to_peer), completing 8 transaction bytes on the
peer's mbarrier at cluster address remote_bar; with a predicate,
only if it is true.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
store_async_cluster_f32x4(address, values, mbarrier, *, loc=None, ip=None)
¶
Four FP32 into a cluster CTA's shared memory
(map_shared_address_to_peer), completing 16 transaction bytes on that
CTA's mbarrier (mbarrier, mapped the same way).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
store_bf16x8_rn(base, offset, values)
¶
8 FP32 scalars rounded to nearest-even BF16 and stored as one 16-byte
access at element offset of the BF16 base (traced inline).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
store_global_f32_address(address, value, predicate, *, loc=None, ip=None)
¶
Store value at global address if predicate.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
store_shared_f32_address(address, value, predicate, *, loc=None, ip=None)
¶
Store value at shared address if predicate.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
sub_ftz_f32(a, b, *, loc=None, ip=None)
¶
A - b, round to nearest, subnormals flushed.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
tma_load_2d(dst, tensor_map, c0, c1, bar, *, loc=None, ip=None)
¶
The box of tensor_map at (c0, c1) (inner coordinate first) into
shared dst, its bytes completing on mbarrier bar.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
tma_prefetch_2d_l2(tensor_map, c0, c1, *, loc=None, ip=None)
¶
Prefetch the box of tensor_map at (c0, c1) into L2.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/primitives.py
trap(*, loc=None, ip=None)
¶
Abort the kernel: the launch fails instead of hanging.