Skip to content

Add a WASM SIMD128 4x4 DTRMM microkernel - #5986

Merged
martin-frbg merged 1 commit into
OpenMathLib:developfrom
jjerphan:wasm128-dtrmm
Aug 20, 2026
Merged

Add a WASM SIMD128 4x4 DTRMM microkernel#5986
martin-frbg merged 1 commit into
OpenMathLib:developfrom
jjerphan:wasm128-dtrmm

Conversation

@jjerphan

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #5983 / #5680 / #4023: replace the generic scalar 4×4 DTRMM kernel used by WASM128_GENERIC with a WASM SIMD128 microkernel. Double only.

  • Generic DTRMM was the remaining Level-3 gap versus DGEMM after Add a 4x4 WASM SIMD128 GEMM microkernel #5983. DTRMMKERNEL now uses kernel/wasm/trmmkernel_4x4_wasm128.c; packing stays gemm_{n,t}copy_4.
  • STRMM stays ../generic/trmmkernel_4x4.c. Single-precision TRMM already auto-vectorizes, and a shared S+D SIMD kernel previously slowed SGEMM.
  • Relaxed madd is used in the TRMM inner k-loop only (same as GEMM in Add a 4x4 WASM SIMD128 GEMM microkernel #5983). ifndef DTRMMKERNEL in kernel/wasm/KERNEL already keeps the target file from being overwritten.

Benchmarks

Node / Emscripten, TARGET=WASM128_GENERIC, USE_THREAD=0, COMMON_OPT=-O2. Same machine, 5 warmup + 10 timed samples (median). Speedup > 1 means this branch is faster than develop.

Geomean vs develop: DTRMM 2.42x. STRMM 1.02x, SGEMM 1.03x, DGEMM 1.03x (unchanged within noise).

op n develop MFLOPS SIMD MFLOPS speedup
dtrmm 32 5891.7 17215.2 2.922
dtrmm 64 6262.5 19206.8 3.067
dtrmm 128 7241.3 20610.8 2.846
dtrmm 256 11069.7 21880.9 1.977
dtrmm 512 14937.4 24349.6 1.630

Test plan

  • Node CBLAS odd-size GEMM/TRSM/TRMM check
  • utest under node (106/106)
  • CBLAS ctest L1/L2/L3 (x{s,d,c,z}cblat{1,2,3}) under node, including STRMM/DTRMM

Generic scalar DTRMM was the remaining Level-3 gap (~15 GFLOPS vs
~23 DGEMM). Keep SIMD for double only; single-precision TRMM already
auto-vectorized and a shared S+D kernel slowed SGEMM.

Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
@martin-frbg martin-frbg added this to the 0.3.35 milestone Aug 20, 2026
@martin-frbg
martin-frbg merged commit 4e2ab1f into OpenMathLib:develop Aug 20, 2026
106 checks passed
@jjerphan
jjerphan deleted the wasm128-dtrmm branch August 20, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants