Repository navigation
Conversation
polvalente
reviewed
Sep 30, 2026
| @@ -0,0 +1,125 @@ | |||
| # CPU benchmark of an f32 matmul. Cold, warm, and shape-cache phases are timed | |||
Member
There was a problem hiding this comment.
I think we could turn this into an example livebook instead?
Seems like a good opportunity to teach about compiler cache hits and misses, and how that can affect benchmarks.
Also, Benchee.run has a warm time option, so any compilation times can be separated out using that instead of forcing compilation before running
Contributor
Author
There was a problem hiding this comment.
Moved it to guides/compilation-cache.livemd. The first cells time a miss, a hit, and a new shape. Benchee uses warmup for 1024, so that compile stays out of the samples without a call beforehand.
Cold, shape-cache miss, and shape-cache hit are one-shot timings. Warm runs go through Benchee. A new shape emits one compilation event; repeating it does not.
The notebook shows a cache miss, a hit, and a new shape, then measures the warm matmul with Benchee's warmup so the compile stays out of the samples.
Chapaman
force-pushed
the
exla-matmul-bench
branch
from
October 6, 2026 15:39
6aaba28 to
f476942
Compare
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.
mix run bench/matmul.exstimes an f32 matmul at 64, 256, and 1024 on the host client. Cold, shape-cache miss, and shape-cache hit are single calls. Warm runs go through Benchee after that shape has already been compiled. Inputs are on device before the timer starts, and the executable waits for the result buffer, so a sample is not just a launch.On this machine the first shape compiled in 334 ms. The next two compiled in 18 ms and 12 ms, and each emitted one
[:exla, :compilation]event. Warm runs and the hits emitted none. Steady state was about 79 μs, 1.6 ms, and 27 ms. Nothing in that suggested a cache change.