vllm.models.inkling2.nvidia.ops.norm
¶
Inkling2 row-wise kernels: RMSNorm and the q/r L2 clipping (fused into the
attention prologue in ops/sconv.py).
All math is fp32; each output is rounded once to its storage dtype.
Functions:
-
qr_clip_rel_tokens–For tokens
[t0, t0 + num_t): per-head L2 clipping ofq * q_scale -
rms_norm–RMSNorm over the last dim of a row-major (possibly row-strided) tensor.
qr_clip_rel_tokens(t0, num_t, chunk, T, Q, R, QScale, RScale, Tau, RelProj, QOut, RelOut, SeqIdx, CuSeqlensQ, SeqLens, stride_q, stride_r, q_threshold, r_threshold, eps, H, D, D_REL, E, W, HAS_TAU, BLOCK_H, BLOCK_E)
¶
For tokens [t0, t0 + num_t): per-head L2 clipping of q * q_scale
(chunk < 0) or of r * r_scale and the BLOCK_E columns chunk
of the relative logits r @ rel_proj (fp32 accumulate; rel_proj
read from the shift_rel_proj table RelProj). Clipped values are
rounded, then scaled by the fp32 per-token tau.
The logits are written sheared, as tml_fa4's ShearingBias does for
128-token query tiles: E + 256 columns per head, column c holding
key c + (n_block_max - 10) * 128, where n_block_max bounds the key
blocks of the token's tile, plus the table's padding (keys right of the
diagonal, and for window layers those past the extent, are -inf).
Source code in vllm/models/inkling2/nvidia/ops/norm.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
rms_norm(x, weight, eps, out_dtype=None)
¶
RMSNorm over the last dim of a row-major (possibly row-strided) tensor.