diff --git a/libr4d/r4d_gemm_mxfp4a8_decode.hip b/libr4d/r4d_gemm_mxfp4a8_decode.hip index 06b2cbb1..65a8bc10 100644 --- a/libr4d/r4d_gemm_mxfp4a8_decode.hip +++ b/libr4d/r4d_gemm_mxfp4a8_decode.hip @@ -26,7 +26,7 @@ // blocks (see mxd_plan). A K not a multiple of 128 takes 64 (and a 2-way split widens to 4). // The rule was tuned when the weight was staged through LDS too, (16*DTM + 128) * (DBK+8) // bytes a block; the multi-fragment kernel now takes 2 * 16*DTM * (DBK+8). -// - past 64 rows, re-tuned for the register kernel (r4d_selftest --perfmx, warmed, every split +// - past 64 rows, re-tuned for the register kernel (r4d_selftest --perfmxd, warmed, every split // 1..8 at both slabs on the 27B's and TranslateGemma's per-rank shapes at 96 and 128 rows): the // 128-wide slab always (it never lost to 64), and a split only while every split keeps 16 slabs, // towards a 48-block grid or, at K >= 8192, regardless, up to ks*M = 512 split rows. Against the @@ -213,7 +213,7 @@ constexpr int mxd_waves(int dbk, int dtm, bool ablk) { // activation and weight are loaded while this slab computes. The arithmetic -- the fold, the k-step // and slab order, the scale carry and the epilogue -- is the one the kernel staging the weight through // LDS had, so the bits are its own (checked byte for byte when it was replaced). r4d_selftest -// --perfmx, clocks warmed, LDS-staged -> registers: 17408 x 5120 at 64 rows 149 -> 129 us, at 96 +// --perfmxd, clocks warmed, LDS-staged -> registers: 17408 x 5120 at 64 rows 149 -> 129 us, at 96 // 205 -> 159, at 128 245 -> 214; 5120 x 8704 at 128 169 -> 139; 6144 x 5120 at 128 121 -> 92. template __global__ __launch_bounds__(R4D_MXD_DWN * 32) R4D_WAVES(mxd_waves(DBK, DTM, ABLK)) diff --git a/libr4d/r4d_gemm_mxfp4a8_gemv.hip b/libr4d/r4d_gemm_mxfp4a8_gemv.hip index 363b95ae..d81c7c08 100644 --- a/libr4d/r4d_gemm_mxfp4a8_gemv.hip +++ b/libr4d/r4d_gemm_mxfp4a8_gemv.hip @@ -161,7 +161,7 @@ void r4d_gemm_mxfp4a8_gemv_kernel( // // TN: the activation is read per block, so one column tile a block reads all of it N/16 times (356 MB // from L2 at M = 64 on a 27B's 17408-row gate_up, against its 47 MB weight). Two tiles a block load -// each activation fragment once for both. r4d_selftest --perfmx, clocks warmed, TN 1 -> 2: 17408 x 5120 +// each activation fragment once for both. r4d_selftest --perfmxd, clocks warmed, TN 1 -> 2: 17408 x 5120 // at 32 rows 125 -> 85 us, at 64 157 -> 122; 5120 x 8704 75 -> 56, 95 -> 75; 21504 x 5376 154 -> 111, // 183 -> 150; at 16 to 24 rows within a few percent either way. Four tiles spill past 32 rows. // Narrow or shallow weights lose with two (fewer blocks than the part has units, a short K a wave): diff --git a/libr4d/r4d_selftest.cpp b/libr4d/r4d_selftest.cpp index 462d38d3..5931bfac 100644 --- a/libr4d/r4d_selftest.cpp +++ b/libr4d/r4d_selftest.cpp @@ -12835,11 +12835,11 @@ static void perf_row(const Plugin& pl, const char* name, std::vector std::printf(" %-22s %8.1f us %6.1f GB/s\n", name, us, bytes / (us * 1e3)); } -/* --perfmx: every MXFP4 GEMM row at one shape, the weight streamed from DRAM (rotated copies), on +/* --perfmxd: every dense MXFP4 GEMM row at one shape, the weight streamed from DRAM (rotated copies), on * the per-(row, 128) activation grid. A row that does not serve the shape says so. */ static void mx_perf(const Plugin& pl, int64_t N, int64_t K, int64_t M, int iters) { if (M < 1 || N < 16 || N % 16 || K < 64 || K % 64) { - std::printf("--perfmx: N must be a multiple of 16, K of 64, and M >= 1\n"); + std::printf("--perfmxd: N must be a multiple of 16, K of 64, and M >= 1\n"); return; } const char* rows[] = { "gemm_mxfp4a8_gemv", "gemm_mxfp4a8_decode", "gemm_mxfp4a8_nt_m64", @@ -28152,7 +28152,7 @@ static void usage(void) { " u64 at byte 0> + the tensor's own data_offsets[0].\n" " --perf N K M [iters]: time the fp8 decode GEMMs at one shape and print the\n" " weight bandwidth each reaches.\n" - " --perfmx N K M [iters]: the MXFP4 GEMM rows (gemv, decode, skinny, tiled) at\n" + " --perfmxd N K M [iters]: the dense MXFP4 GEMM rows (gemv, decode, skinny, tiled) at\n" " one shape, with the weight bandwidth each reaches.\n" " --perfbf16 N K M [iters]: the bf16 skinny GEMM at every variant it has.\n" " --perff32 N K M [iters]: gemm_nt_f32 at the tile form its rule picks, compared\n" @@ -28327,7 +28327,7 @@ int main(int argc, char** argv) { perf_k = std::strtoll(argv[++i], nullptr, 0); perf_m = std::strtoll(argv[++i], nullptr, 0); if (i + 1 < argc && argv[i + 1][0] != '-') perf_it = (int)std::strtol(argv[++i], nullptr, 0); - } else if (!std::strcmp(argv[i], "--perfmx")) { + } else if (!std::strcmp(argv[i], "--perfmxd")) { if (i + 3 >= argc) { usage(); return 2; } perf_mx = 1; perf_n = std::strtoll(argv[++i], nullptr, 0);