diff --git a/libr3d/r3d_gemm_fp8a8_tiled.hip b/libr3d/r3d_gemm_fp8a8_tiled.hip index d6628d08..07ff4dbb 100644 --- a/libr3d/r3d_gemm_fp8a8_tiled.hip +++ b/libr3d/r3d_gemm_fp8a8_tiled.hip @@ -467,9 +467,25 @@ int launch(long av, long asv, long bvc, long bsv, long yv, int M, int N, int K, const dim3 blk(kBlockThreads); const dim3 grd((unsigned)((N + kTN - 1) / kTN), (unsigned)((M + kTM - 1) / kTM)); - ActQ aq{ (const float*)(uintptr_t)asv, (long long)as_ld, as_ld != 1 }; - WQ h{ (const uint8_t*)(uintptr_t)bvc, (const uint8_t*)(uintptr_t)bsv, - (const uint8_t*)(uintptr_t)zv, b_row, bs_row, z_row, sdt, cdt, srows }; + /* Value-init (not aggregate-init): the tape audit byte-compares the serialized kernel + * arguments, and aggregate-init leaves a struct's trailing padding indeterminate. A padding + * byte that differs between a pass's recording and its audit is read as "the key does not + * carry" this argument and stops the engine (the ActQ/WQ holes are 4 bytes each). Zero the + * whole struct so the padding is deterministic; the kernel reads none of it. */ + ActQ aq{}; + aq.scale = (const float*)(uintptr_t)asv; + aq.row = as_ld; + aq.gmode = as_ld != 1; + WQ h{}; + h.codes = (const uint8_t*)(uintptr_t)bvc; + h.scale = (const uint8_t*)(uintptr_t)bsv; + h.zero = (const uint8_t*)(uintptr_t)zv; + h.code_row = b_row; + h.scale_row = bs_row; + h.zero_row = z_row; + h.sdt = sdt; + h.cdt = cdt; + h.srows = srows; hipStream_t s = (hipStream_t)(uintptr_t)stream; #define R3D_RUN(NT, ARM, CD, AL) \ fp8a8_tiled_kernel<<>>( \ diff --git a/libr3d/r3d_gemm_mxfp4a8.hip b/libr3d/r3d_gemm_mxfp4a8.hip index e1f1a02c..dc3d1213 100644 --- a/libr3d/r3d_gemm_mxfp4a8.hip +++ b/libr3d/r3d_gemm_mxfp4a8.hip @@ -482,8 +482,18 @@ int launch_mxfp4a8_tiled(long av, long asv, long bvc, long bsv, long yv, int M, const dim3 blk(kBlockThreads); const dim3 grd((unsigned)((N + kTN - 1) / kTN), (unsigned)((M + kTM - 1) / kTM)); - ActQ aq{(const float*)(uintptr_t)asv, (long long)as_ld, 1}; - MxWQ h{(const uint8_t*)(uintptr_t)bvc, (const uint8_t*)(uintptr_t)bsv, b_row, e8_row}; + /* Value-init so the ActQ's 4-byte padding hole is deterministic: the tape audit byte-compares + * the serialized kernel arguments, and aggregate-init leaves that padding indeterminate, which + * reads as "the key does not carry" the argument and stops the engine. See fp8a8's launcher. */ + ActQ aq{}; + aq.scale = (const float*)(uintptr_t)asv; + aq.row = as_ld; + aq.gmode = 1; + MxWQ h{}; + h.codes = (const uint8_t*)(uintptr_t)bvc; + h.e8 = (const uint8_t*)(uintptr_t)bsv; + h.code_row = b_row; + h.e8_row = e8_row; hipStream_t s = (hipStream_t)(uintptr_t)stream; if (alu) { if (nt) mxfp4a8_tiled_kernel<1,1><<>>(