feat(matmul): route DefaultCpuOpsJvm FP32 matmul through KernelRegistry#561
Merged
michalharakal merged 1 commit intodevelopfrom Apr 28, 2026
Merged
feat(matmul): route DefaultCpuOpsJvm FP32 matmul through KernelRegistry#561michalharakal merged 1 commit intodevelopfrom
michalharakal merged 1 commit intodevelopfrom
Conversation
Replaces the direct JvmVectorKernels.matmulFloat / matmulFloatBlocked calls in DefaultCpuOpsJvm.chooseMatmul with a single fp32MatmulKernel.matmul(...) call, where fp32MatmulKernel is resolved via KernelRegistry.bestAvailable() and lazily falls back to KernelServiceLoader.installAll() on first use. After PR #560 the SPI's PanamaVectorMatmulKernel is on par with the existing matmulFloatBlocked path within JMH noise (8.5% faster at 256/512, 2% slower within noise at 1024) — so this is purely a plumbing change with no expected production regression. JMH numbers will be appended to the PR body once the bench run completes. Tests: ./gradlew :skainet-backends:skainet-backend-cpu:jvmTest passes 213/213 with the routed kernel. Closes the production-routing piece of M5; remaining M5 work is the quantized kernel SPI extension (Q4_K SIMD). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the direct
JvmVectorKernels.matmulFloat/matmulFloatBlockedcalls inDefaultCpuOpsJvm.chooseMatmulwith a singlefp32MatmulKernel.matmul(...)call. The kernel is resolved viaKernelRegistry.bestAvailable(), lazily auto-installing ServiceLoader-discovered providers on first use.After PR #560 (cache-blocked Panama) the SPI's
PanamaVectorMatmulKernelis on par with the existingmatmulFloatBlockedpath, so this is purely a plumbing change with no production regression.Numbers (JDK 21.0.10, M-series macOS)
MatmulBench(production routing,vectorEnabled=true):Production routing now lands in the same ballpark as direct
KernelMatmulBenchpanama (1.101 / 8.677 / 72.492 ms at 256/512/1024) — confirming the routing path is taking the SPI kernel as expected.Test plan
./gradlew :skainet-backends:skainet-backend-cpu:jvmTest— 213/213 tests pass../gradlew :skainet-backends:benchmarks:jvm-cpu-jmh:jmh— full bench run, numbers above.Closes
Closes the production-routing piece of M5; remaining M5 work is the quantized kernel SPI extension (Q4_K SIMD — separate PR off develop).
🤖 Generated with Claude Code