Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions clean/dx12/kernels/encoder.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,35 @@ void pixel_values(int mode, Uni U, int x, int y, float4 c, float2 mn, float2 mf,
[unroll] for (uint i2 = 15; i2 < 20; ++i2) v[i2] = 0.0f;
return;
}
#if WG_ENC_Q20
// Model L's q20 encoders: near / far at the bit pattern of center (no motion change between the three vectors, the
// common case) read the same history texels with the same weights, so their values are center's, bit for bit; the
// history read and the transfer of that position run only when the whole wave needs them.
{
float3 h1 = hist_values(mode, U, qx[1], qy[1], valid[1], gc);
bool same0 = asuint(qx[0]) == asuint(qx[1]) && asuint(qy[0]) == asuint(qy[1]);
bool same2 = asuint(qx[2]) == asuint(qx[1]) && asuint(qy[2]) == asuint(qy[1]);
float3 h0 = h1, h2 = h1;
[branch] if (WaveActiveAnyTrue(!same0)) {
float3 t = hist_values(mode, U, qx[0], qy[0], valid[0], gc);
h0 = same0 ? h1 : t;
}
[branch] if (WaveActiveAnyTrue(!same2)) {
float3 t = hist_values(mode, U, qx[2], qy[2], valid[2], gc);
h2 = same2 ? h1 : t;
}
float3 h3 = hist_values(mode, U, qx[3], qy[3], valid[3], gc);
v[3] = h0.x; v[4] = h0.y; v[5] = h0.z;
v[6] = h1.x; v[7] = h1.y; v[8] = h1.z;
v[9] = h2.x; v[10] = h2.y; v[11] = h2.z;
v[12] = h3.x; v[13] = h3.y; v[14] = h3.z;
}
#else
[unroll] for (uint k2 = 0; k2 < 4; ++k2) {
float3 h = hist_values(mode, U, qx[k2], qy[k2], valid[k2], gc);
v[3 + 3 * k2] = h.x; v[4 + 3 * k2] = h.y; v[5 + 3 * k2] = h.z;
}
#endif

// Motion disagreement (value 15)
{
Expand Down
35 changes: 35 additions & 0 deletions clean/dx12/kernels/fused_swin.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,20 @@ void load_frags_g(uint base, uint off, out uint2 f[KC])
#define COEF_PACK12 1
#include "l_coef_px.hlsli"
#endif
// SW_COEF_ROWS 1 (the hybrid C32 decoder with the coefficient epilogue): the epilogue reads channels 0..15 only, so the
// W2 chain runs one 16-row tile instead of two: rows 0..7 = channels 0..7 (tile 0's rows 0..7, the hh = 0 lanes), rows
// 8..15 = channels 8..15 (tile 1's rows 0..7: the A fragment's lanes t >= 8 read 24 LDS slots further, no repack; the
// hh = 1 lanes), in place of channels 16..23 and with channels 24..31 dropped. Each output element is the same chain of
// the same products from the same start (RN16(b2 + z) moved to the hh = 1 lane), so the same bytes; the epilogue takes
// channels 8..15 back from lane ^ 16.
#ifndef SW_COEF_ROWS
#define SW_COEF_ROWS 0
#endif
#if SW_COEF_ROWS && (!SW_OUT_COEF12 || !SW_HYB || SW_C != 32 || SW_Q7_CHUNK || SW_HYB_MUT_ORDER || SW_HYB_DUMP || SW_REV_PHI)
#error "SW_COEF_ROWS: the plain hybrid C32 decoder block with SW_OUT_COEF12 only"
#endif
#if SW_OUT_COEF12
#endif
#if SW_SRC == 1
// LHaloF16Src: the lane's channels hh * C/2 + 8 k + j of the member at grid position (pr, pc) (inside the 2-pixel halo),
// from the FP16 map [H + 4][W + 4][C]
Expand Down Expand Up @@ -1568,6 +1582,12 @@ WG_KERNEL(SW_ENTRY)
acc[k3b] = hyb_add16(hyb_h2f8(acc_h2[k3b]), wg_load8f(b2, 64u * k3b));
#endif
}
#if SW_COEF_ROWS
[unroll] for (uint vr = 0; vr < 8; ++vr) { // channels 8..15 (acc[1] of the hh = 0 lane) to the hh = 1 lane
const float ar = asfloat(wg_xor16_u(asuint(acc[1].v[vr])));
acc[0].v[vr] = hh != 0u ? ar : acc[0].v[vr];
}
#endif
}
#else
{
Expand Down Expand Up @@ -1785,6 +1805,15 @@ WG_KERNEL(SW_ENTRY)
hf[0] = hyb_gelu_fin(gp0);
hf[1] = hyb_gelu_fin(gp1);
}
#if SW_COEF_ROWS
{
const uint fbr = fb + ((t & 8u) != 0u ? 24u : 0u); // rows 8..15: tile 1's rows 0..7
[unroll] for (uint g4 = 0; g4 < GROUP; ++g4) {
const uint2 f2r = sw_lfrag_b(fbr, g4 * 2u * KC + KC);
acc[0] = wg_wmma_fp8(f2r, hf[g4], acc[0]);
}
}
#else
uint2 f2[GROUP][KC];
[unroll] for (uint g4 = 0; g4 < GROUP; ++g4)
[unroll] for (uint m = 0; m < KC; ++m) f2[g4][m] = sw_lfrag_b(fb, g4 * 2u * KC + KC + m);
Expand All @@ -1807,6 +1836,7 @@ WG_KERNEL(SW_ENTRY)
[unroll] for (uint m2 = 0; m2 < KC; ++m2)
[unroll] for (uint g6 = 0; g6 < GROUP; ++g6) acc[m2] = wg_wmma_fp8(f2[g6][m2], hf[g6], acc[m2]);
#endif
#endif // SW_COEF_ROWS
[unroll] for (uint g8 = 0; g8 < GROUP; ++g8) hcur_h[g8] = hnext_h[g8];
#if SW_COMMIT_EARLY
if (more && j0 == GROUP * (SW_COMMIT_EARLY - 1)) st_commit(stage, (buf ^ 1u) * MAXU + 8u * SW_MDZ, MLP_BYTES / 16, tid);
Expand Down Expand Up @@ -1952,7 +1982,12 @@ WG_KERNEL(SW_ENTRY)
#if SW_OUT_COEF12 && COEF_CVT_HW
// the driver's conversions (the same bits as wg_to_f16 / the software forms): every lane computes, the hh = 0 lanes
// of real pixels inside the render rectangle store (the conversions need wave-uniform control flow)
#if SW_COEF_ROWS
o16[0] = wg_to_f16_ags(acc[0]); // hh = 0: channels 0..7; hh = 1: channels 8..15 of the same pixel
o16[1] = uint4(wg_xor16_u(o16[0].x), wg_xor16_u(o16[0].y), wg_xor16_u(o16[0].z), wg_xor16_u(o16[0].w));
#else
[unroll] for (uint kh = 0; kh < KC; ++kh) o16[kh] = wg_to_f16_ags(acc[kh]);
#endif
{
g_z = wg_grid_ >> 31;
const float S = wg_ldf(coefW, 320u), T = wg_ldf(coefW, 324u);
Expand Down
4 changes: 2 additions & 2 deletions clean/dx12/kernels/hyb_swin.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// @wg-kernel swin_block_c64_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u defines=SW_C=64,SW_HEADS=2,SW_MLP=256,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HYB=1,SW_HEAD_UNROLL=1,SW_MLP_STEP=2,SW_COMMIT_EARLY=1,SW_NORM1_EARLY=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c64_hyb,WG_REV_ORDER=1
// @wg-kernel swin_block_c64_add_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u defines=SW_C=64,SW_HEADS=2,SW_MLP=256,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HYB=1,SW_HEAD_UNROLL=1,SW_MLP_STEP=2,SW_COMMIT_EARLY=1,SW_NORM1_EARLY=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c64_add_hyb
// @wg-kernel swin_block_c96_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u defines=SW_C=96,SW_HEADS=4,SW_MLP=384,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HYB=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c96_hyb,WG_REV_ORDER=1
// @wg-kernel swin_block_c96_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u defines=SW_C=96,SW_HEADS=4,SW_MLP=384,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HYB=1,SW_MLP_PAIRS=1,SW_COMMIT_EARLY=1,SW_NORM2_EARLY=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c96_hyb,WG_REV_ORDER=1
// @wg-kernel swin_block_c96_add_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u defines=SW_C=96,SW_HEADS=4,SW_MLP=384,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HYB=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c96_add_hyb
// @wg-kernel swin_block_c128_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u defines=SW_C=128,SW_HEADS=4,SW_MLP=512,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HYB=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c128_hyb
// swin_block_c64_hyb_scanmut / _c128_hyb_scanmut the fused-square scan's mutants (probe=1, outside the manifest; see
Expand All @@ -34,7 +34,7 @@
// (L_TAIL) holds the expand weights (the section expand_c128_hyb / expand_c96_hyb read), aux unused (null). Byte for byte
// expand_c128_hyb + swin_block_c96_add_hyb / expand_c96_hyb + swin_block_c64_add_hyb (the expanded map is never stored).
// swin_block_c96_add_ex_hyb dec2 (SW_ECL 128) swin_block_c64_add_ex_hyb dec1 (SW_ECL 96)
// @wg-kernel swin_block_c96_add_ex_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u,p defines=SW_C=96,SW_HEADS=4,SW_MLP=384,SW_ADD=1,SW_SAFE=1,SW_ECL=128,SW_HYB=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c96_add_ex_hyb
// @wg-kernel swin_block_c96_add_ex_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u,p defines=SW_C=96,SW_HEADS=4,SW_MLP=384,SW_ADD=1,SW_SAFE=1,SW_ECL=128,SW_HYB=1,SW_MLP_PAIRS=1,SW_COMMIT_EARLY=1,SW_NORM2_EARLY=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c96_add_ex_hyb
// @wg-kernel swin_block_c64_add_ex_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u,p defines=SW_C=64,SW_HEADS=2,SW_MLP=256,SW_ADD=1,SW_SAFE=1,SW_ECL=96,SW_HYB=1,SW_HEAD_UNROLL=1,SW_MLP_STEP=2,SW_COMMIT_EARLY=1,SW_NORM1_EARLY=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=swin_block_c64_add_ex_hyb
// @wg-kernel swin_block_c96_add_ex_hyb_scanmut co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p defines=SW_C=96,SW_HEADS=4,SW_MLP=384,SW_ADD=1,SW_SAFE=1,SW_ECL=128,SW_HYB=1,SW_MLP_PAIRS=1,SW_COMMIT_EARLY=1,SW_NORM2_EARLY=1,WG_LD_A16=1,HYB_SCAN_MUTANT=1,SW_ENTRY_OVERRIDE=swin_block_c96_add_ex_hyb_scanmut
// @wg-kernel swin_block_c64_add_ex_hyb_scanmut co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p defines=SW_C=64,SW_HEADS=2,SW_MLP=256,SW_ADD=1,SW_SAFE=1,SW_ECL=96,SW_HYB=1,SW_HEAD_UNROLL=1,SW_MLP_STEP=2,SW_COMMIT_EARLY=1,SW_NORM1_EARLY=1,WG_LD_A16=1,HYB_SCAN_MUTANT=1,SW_ENTRY_OVERRIDE=swin_block_c64_add_ex_hyb_scanmut
Expand Down
7 changes: 6 additions & 1 deletion clean/dx12/kernels/l_post_core.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,14 @@ void l_post_core(LGather g, int x, int y, int fx, int fy, float mx[3], float my[
const float X = (float)x + 0.5f, Y = (float)y + 0.5f;
const int ncand = w2 != 0.0f ? 2 : 1;
float L[2][3];
// the second candidate at the first one's motion bits (the common case where the motion candidates agree): the same
// position, so the same history (or colour) values, bit for bit; copied instead of a second 12-tap read
const bool dup2 = asuint(m2x) == asuint(m1x) && asuint(m2y) == asuint(m1y);
[unroll] for (int n = 0; n < 2; ++n) {
L[n][0] = 0.0f; L[n][1] = 0.0f; L[n][2] = 0.0f;
if (n < ncand) {
if (n == 1 && n < ncand && dup2) {
L[1][0] = L[0][0]; L[1][1] = L[0][1]; L[1][2] = L[0][2];
} else if (n < ncand) {
const float qx = X + (n == 0 ? m1x : m2x);
const float qy = Y + (n == 0 ? m1y : m2y);
#if LP_MUT == 5
Expand Down
4 changes: 2 additions & 2 deletions clean/dx12/kernels/l_swin.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
// form, enc0.Win1, enc0.Win2 as the last arguments) and _dec_hyb with l_coef_pack12 as its
// epilogue (SW_OUT_COEF12, COEF_CVT_HW); the same bytes as the launches they replace
// @wg-kernel l_swin_block_c32_enc_lin_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_SRC=3,SW_HYB=1,SW_HEAD_UNROLL=1,SW_NORM1_EARLY=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_enc_lin_hyb,WG_REV_ORDER=1
// @wg-kernel l_swin_block_c32_dec_coef12_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p,p,p,u,u defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_OUT_F16=1,SW_OUT_COEF12=1,COEF_CVT_HW=1,SW_HYB=1,SW_HEAD_UNROLL=1,WG_LD_A16=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_dec_coef12_hyb,WG_REV_ORDER=1
// @wg-kernel l_swin_block_c32_dec_coef12_hyb co=- block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p,p,p,u,u defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_OUT_F16=1,SW_OUT_COEF12=1,COEF_CVT_HW=1,SW_HYB=1,SW_HEAD_UNROLL=1,WG_LD_A16=1,SW_COEF_ROWS=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_dec_coef12_hyb,WG_REV_ORDER=1
// ..._enc_lin_hyb_dump / _dec_coef12_hyb_dump (+ _mutdump: SW_HYB_MUT_ORDER=4) their stage dumps (probe=1, check only:
// l_hyb_stage_check.py --set fused, the oracle per stage); _scanmut: the fused-square scan's
// mutants (no contraction barrier, built beside every hybrid build, outside the manifest)
Expand All @@ -54,7 +54,7 @@
// @wg-kernel l_swin_block_c32_enc_lin_hyb_scanmut co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_SRC=3,SW_HYB=1,SW_HEAD_UNROLL=1,SW_NORM1_EARLY=1,WG_LD_A16=1,HYB_SCAN_MUTANT=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_enc_lin_hyb_scanmut,WG_REV_ORDER=1
// @wg-kernel l_swin_block_c32_dec_coef12_hyb_dump co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p,p,p,u,u,p defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_OUT_F16=1,SW_OUT_COEF12=1,COEF_CVT_HW=1,SW_HYB=1,SW_HYB_DUMP=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_dec_coef12_hyb_dump
// @wg-kernel l_swin_block_c32_dec_coef12_hyb_mutdump co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p,p,p,u,u,p defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_OUT_F16=1,SW_OUT_COEF12=1,COEF_CVT_HW=1,SW_HYB=1,SW_HYB_DUMP=1,SW_HYB_MUT_ORDER=4,SW_ENTRY_OVERRIDE=l_swin_block_c32_dec_coef12_hyb_mutdump
// @wg-kernel l_swin_block_c32_dec_coef12_hyb_scanmut co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p,p,p,u,u defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_OUT_F16=1,SW_OUT_COEF12=1,COEF_CVT_HW=1,SW_HYB=1,SW_HEAD_UNROLL=1,WG_LD_A16=1,HYB_SCAN_MUTANT=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_dec_coef12_hyb_scanmut
// @wg-kernel l_swin_block_c32_dec_coef12_hyb_scanmut co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p,p,p,p,u,u defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=1,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_OUT_F16=1,SW_OUT_COEF12=1,COEF_CVT_HW=1,SW_HYB=1,SW_HEAD_UNROLL=1,WG_LD_A16=1,HYB_SCAN_MUTANT=1,SW_COEF_ROWS=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_dec_coef12_hyb_scanmut
// l_swin_block_c32_enc_hyb_dump / _dec_hyb_dump check variants (probe=1, never in a model build): the same kernels plus
// the stage dump (SW_HYB_DUMP, the extra pointer argument; l_hyb_stage_check.py)
// @wg-kernel l_swin_block_c32_enc_hyb_dump co=- probe=1 block=256 wave=32 args=p,p,p,p,u,u,u,u,p defines=SW_C=32,SW_HEADS=2,SW_MLP=128,SW_ADD=0,SW_SAFE=1,SW_ECL=0,SW_HPU=8,SW_GELU=0,SW_SRC=1,SW_HYB=1,SW_HYB_DUMP=1,SW_ENTRY_OVERRIDE=l_swin_block_c32_enc_hyb_dump,WG_REV_ORDER=1
Expand Down
35 changes: 35 additions & 0 deletions clean/dx12/kernels/swin_block.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,20 @@ void load_frags_g(uint base, uint off, out uint2 f[KC])
#define COEF_PACK12 1
#include "l_coef_px.hlsli"
#endif
// SW_COEF_ROWS 1 (the hybrid C32 decoder with the coefficient epilogue): the epilogue reads channels 0..15 only, so the
// W2 chain runs one 16-row tile instead of two: rows 0..7 = channels 0..7 (tile 0's rows 0..7, the hh = 0 lanes), rows
// 8..15 = channels 8..15 (tile 1's rows 0..7: the A fragment's lanes t >= 8 read 24 LDS slots further, no repack; the
// hh = 1 lanes), in place of channels 16..23 and with channels 24..31 dropped. Each output element is the same chain of
// the same products from the same start (RN16(b2 + z) moved to the hh = 1 lane), so the same bytes; the epilogue takes
// channels 8..15 back from lane ^ 16.
#ifndef SW_COEF_ROWS
#define SW_COEF_ROWS 0
#endif
#if SW_COEF_ROWS && (!SW_OUT_COEF12 || !SW_HYB || SW_C != 32 || SW_Q7_CHUNK || SW_HYB_MUT_ORDER || SW_HYB_DUMP || SW_REV_PHI)
#error "SW_COEF_ROWS: the plain hybrid C32 decoder block with SW_OUT_COEF12 only"
#endif
#if SW_OUT_COEF12
#endif
#if SW_SRC == 1
// LHaloF16Src: the lane's channels hh * C/2 + 8 k + j of the member at grid position (pr, pc) (inside the 2-pixel halo),
// from the FP16 map [H + 4][W + 4][C]
Expand Down Expand Up @@ -1420,6 +1434,12 @@ WG_KERNEL(SW_ENTRY)
acc[k3b] = hyb_add16(hyb_h2f8(acc_h2[k3b]), wg_load8f(b2, 64u * k3b));
#endif
}
#if SW_COEF_ROWS
[unroll] for (uint vr = 0; vr < 8; ++vr) { // channels 8..15 (acc[1] of the hh = 0 lane) to the hh = 1 lane
const float ar = asfloat(wg_xor16_u(asuint(acc[1].v[vr])));
acc[0].v[vr] = hh != 0u ? ar : acc[0].v[vr];
}
#endif
}
#else
{
Expand Down Expand Up @@ -1637,6 +1657,15 @@ WG_KERNEL(SW_ENTRY)
hf[0] = hyb_gelu_fin(gp0);
hf[1] = hyb_gelu_fin(gp1);
}
#if SW_COEF_ROWS
{
const uint fbr = fb + ((t & 8u) != 0u ? 24u : 0u); // rows 8..15: tile 1's rows 0..7
[unroll] for (uint g4 = 0; g4 < GROUP; ++g4) {
const uint2 f2r = sw_lfrag_b(fbr, g4 * 2u * KC + KC);
acc[0] = wg_wmma_fp8(f2r, hf[g4], acc[0]);
}
}
#else
uint2 f2[GROUP][KC];
[unroll] for (uint g4 = 0; g4 < GROUP; ++g4)
[unroll] for (uint m = 0; m < KC; ++m) f2[g4][m] = sw_lfrag_b(fb, g4 * 2u * KC + KC + m);
Expand All @@ -1659,6 +1688,7 @@ WG_KERNEL(SW_ENTRY)
[unroll] for (uint m2 = 0; m2 < KC; ++m2)
[unroll] for (uint g6 = 0; g6 < GROUP; ++g6) acc[m2] = wg_wmma_fp8(f2[g6][m2], hf[g6], acc[m2]);
#endif
#endif // SW_COEF_ROWS
[unroll] for (uint g8 = 0; g8 < GROUP; ++g8) hcur_h[g8] = hnext_h[g8];
#if SW_COMMIT_EARLY
if (more && j0 == GROUP * (SW_COMMIT_EARLY - 1)) st_commit(stage, (buf ^ 1u) * MAXU + 8u * SW_MDZ, MLP_BYTES / 16, tid);
Expand Down Expand Up @@ -1804,7 +1834,12 @@ WG_KERNEL(SW_ENTRY)
#if SW_OUT_COEF12 && COEF_CVT_HW
// the driver's conversions (the same bits as wg_to_f16 / the software forms): every lane computes, the hh = 0 lanes
// of real pixels inside the render rectangle store (the conversions need wave-uniform control flow)
#if SW_COEF_ROWS
o16[0] = wg_to_f16_ags(acc[0]); // hh = 0: channels 0..7; hh = 1: channels 8..15 of the same pixel
o16[1] = uint4(wg_xor16_u(o16[0].x), wg_xor16_u(o16[0].y), wg_xor16_u(o16[0].z), wg_xor16_u(o16[0].w));
#else
[unroll] for (uint kh = 0; kh < KC; ++kh) o16[kh] = wg_to_f16_ags(acc[kh]);
#endif
{
g_z = wg_grid_ >> 31;
const float S = wg_ldf(coefW, 320u), T = wg_ldf(coefW, 324u);
Expand Down
Loading