From 6124c35e39e65aa73740821eeeebbe4871a80ed3 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 28 Oct 2026 16:00:39 +0100 Subject: [PATCH] [Engine] SYCL: native_expert_bench reports microseconds, not milliseconds Problem: the timing lambda measured milliseconds per iteration and returned them, while the printout labels the value "us" and derives its GB/s as `bytes / us / 1e3` - so every number this bench has printed was 1000x too small in time and 1000x too large in bandwidth. A launch that moves 19.7 MB in ~140 us was reported as 0.1 us and 148,713 GB/s, which is why the tool looked broken rather than mislabelled. The wall clock always agreed with the real work (200 iterations 618 ms, 2,000 iterations 3,566 ms). Result, 2x Arc Pro B65, shard 1 (Qwen3.8-Flash-Next IQ3_S experts, 10 groups), before and after the one-line fix: | case | before | after | | --- | ---: | ---: | | 2 tokens | 0.1 "us", 148,713 "GB/s" | **143.4 us: gate/up 84.5 us (148 GB/s), down 59.4 us (78 GB/s)** | | 8 tokens | 0.3 "us" | **340.8 us: gate/up 217.4 us (58 GB/s), down 126.0 us (37 GB/s)** | and the model's own layers at two tokens: layer 30 iq3_xxs/q2_0 143.6 us, 31 iq3_xxs/iq4_nl 140.4 us, 32 iq2_s/iq4_nl 135.5 us, 33 iq3_xxs/iq4_nl 140.2 us - gate/up 131-149 GB/s, down 78-168 GB/s, results bitwise equal to the reference in every case. Approach: return microseconds (`ms * 1e3 / iters`), which is what the printout, the minimum-of-three logic and the bandwidth formula already assume. No kernel, no timing path and no measurement logic changed. Validation: the same run before and after; the wall-clock scaling that exposed the bug; bitwise equality retained in all four model layers and both token counts. Not run: CUDA/HIP (this file is the port's own), other shards. Limits: this fixes the units only. The numbers are per-call costs with the bench's own synthetic groups, so a rate taken from it still has to be matched to the real window (48 calls per layer step). --- sycl/src/kernels/native_expert_bench.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sycl/src/kernels/native_expert_bench.cpp b/sycl/src/kernels/native_expert_bench.cpp index c75726c9..a32d8116 100644 --- a/sycl/src/kernels/native_expert_bench.cpp +++ b/sycl/src/kernels/native_expert_bench.cpp @@ -171,7 +171,12 @@ int main(int argc, char** argv) { sync("timing loop"); const double ms = std::chrono::duration(std::chrono::steady_clock::now() - t0).count(); - return ms / iters; + // SYCL port: the printout below and the GB/s it derives both assume MICROseconds ("all %7.1f us", + // bytes / us / 1e3), but this returned milliseconds - so every published number was 1000x too small in + // time and 1000x too large in bandwidth (0.1 "us" and 148,713 GB/s for a launch that takes ~100 us and + // moves 19.7 MB at ~198 GB/s). The wall clock always agreed with the real work: 200 iterations 618 ms, + // 2,000 iterations 3,566 ms. Return microseconds. + return ms * 1e3 / iters; }; const double gu_b = (double) G * 2 * f.up_off, d_b = (double) G * dsz; double us[2][3] = {{1e30, 1e30, 1e30}, {1e30, 1e30, 1e30}};