diff --git a/src/kernels/cuda/fused_gr.cu b/src/kernels/cuda/fused_gr.cu index 210cf228..23aeedd7 100644 --- a/src/kernels/cuda/fused_gr.cu +++ b/src/kernels/cuda/fused_gr.cu @@ -1,5 +1,6 @@ // src/kernels/cuda/fused_gr.cu - see include/strata/kernels/fused_gr.hpp. #include "strata/core/emulate.hpp" +#include "strata/kernels/q8_1_finite.hpp" // #606: q8_1_ds #include "strata/kernels/fused_gr.hpp" #include "strata/kernels/bf16_bits.hpp" #include "strata/kernels/verify_kernels.hpp" @@ -199,7 +200,7 @@ __device__ __forceinline__ void gr_q8_tail(const GrMulti& m, int d0) { const int8_t q = amax == 0.0f ? 0 : roundf(xi / d); GrQ81* y = reinterpret_cast(m.a[warp].q8_mixed) + c0 / 32; y->qs[lane] = q; - if (lane == 0) y->ds = make_half2(d, sum); + if (lane == 0) y->ds = q8_1_ds(d, sum); // #606: clamped scale/sum - an unclamped pair NaN-poisons the dot path } // Step 1 of `gr_down_kernel`, one block per token, same threads and reduction order: rs[t] and xn[t] to global. __global__ void __launch_bounds__(THREADS) gr_norm_multi_kernel(GrMulti m) { diff --git a/src/kernels/cuda/iq_kernels.cu b/src/kernels/cuda/iq_kernels.cu index 1c20986d..05dac2ff 100644 --- a/src/kernels/cuda/iq_kernels.cu +++ b/src/kernels/cuda/iq_kernels.cu @@ -2327,7 +2327,7 @@ __global__ void s26_swiglu_q8_1_kernel(const float* __restrict__ gate, const flo const int8_t q = amax == 0.0f ? 0 : roundf(xi / d); const long long ib = i / 32, iqs = i % 32; y[ib].qs[iqs] = q; - if (iqs == 0) y[ib].ds = make_half2(d, sum); + if (iqs == 0) y[ib].ds = q8_1_ds(d, sum); // #606: clamped scale/sum (the S26 path bypassed the finite helper) } template void s26_launch_l(const NativeExpertLayout& L, int64_t cap_groups, cudaStream_t s, const unsigned long long* grp_ptr, diff --git a/src/kernels/cuda/verify_kernels.cu b/src/kernels/cuda/verify_kernels.cu index 122db997..525c24b2 100644 --- a/src/kernels/cuda/verify_kernels.cu +++ b/src/kernels/cuda/verify_kernels.cu @@ -4,6 +4,7 @@ // elementwise.cu) with the same operation order, so a verify window reproduces plain decode bit for bit. #include "strata/kernels/verify_kernels.hpp" #include "strata/core/emulate.hpp" +#include "strata/kernels/q8_1_finite.hpp" // #606: q8_1_ds #include "strata/kernels/dp4a.hpp" #include "strata/kernels/pdl.hpp" @@ -199,7 +200,7 @@ __device__ __forceinline__ void gdn_q8_1_store(GdnQ81* __restrict__ xq, size_t i const float d = amax / 127.0f; const int8_t q = amax == 0.0f ? 0 : roundf(xi / d); xq[idx / 32].qs[idx % 32] = q; - if (idx % 32 == 0) xq[idx / 32].ds = make_half2(d, sum); + if (idx % 32 == 0) xq[idx / 32].ds = q8_1_ds(d, sum); // #606: clamped (the QFUSE path bypassed the finite helper) } template