Stream: git-wasmtime

Topic: wasmtime / PR #15273 bench-api: Fix compilation caching


view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 20:52):

fitzgen opened PR #15273 from fitzgen:bench-api-caching to bytecodealliance:main:

Two local builds of Wasmtime will have the same version, so we need to differentiate the cache keys on something else. This commit hashes the bench API dynamic library's own bytes.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 20:52):

fitzgen removed the review request for wasmtime-core-reviewers from PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 20:52):

fitzgen requested pchickey for a review on PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 20:53):

fitzgen requested wasmtime-core-reviewers for a review on PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 21:18):

alexcrichton commented on PR #15273:

Would it make sense to maybe use the git hash? I'm hesitant to take a gob of platform-specific code for a relatively niche thing

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 21:27):

fitzgen commented on PR #15273:

Would it make sense to maybe use the git hash? I'm hesitant to take a gob of platform-specific code for a relatively niche thing

The git hash is often the same as well though if you haven't made any commits, just stashed or whatever.

FWIW, I don't think the platform-specific code is that bad, given how confined/encapsulated it is. I wish we could just use std::env::current_exe, but unfortunately that doesn't work for dylibs.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 21:43):

alexcrichton commented on PR #15273:

To me at least the platform-specific bits are pretty bad, they're redefining structures that I'd expect to be sourced from windows-sys or libc, assuming it's the same across all unix platforms, which history has shown is rarely the case in the full limit of time, and on Windows this is doing manual path filling/manipulations which we've historically also gotten wrong and/or had bugs with in this repo too.

I'd personally be more comfortable with a mostly-works-even-if-not-always solution that's easier to integrate and more portable (like the git hash) which at least fixes the sightglass use case if not the local-testing-before-builds-are-made. For the latter use case caching is off-by-default (right?) so you'd have to otherwise opt-in explicitly to enabling it, and we might be able to document that it shouldn't be enabled in such a situation.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:32):

fitzgen commented on PR #15273:

I'm happy to rewrite this code to use stuff from windows-sys and libc if you prefer.

And I can also limit the dladdr version to cfg(any(target_os = "linux", target_os = "macos")) instead of cfg(unix) if you're concerned about someone running sightglass on freebsd or something, and that maybe failing (weirdly, but at least likely fairly loudly due to heap corruption, fwiw).

But I really don't want to use git hash because I personally will sometimes benchmark uncommitted changes vs stashing those changes. If we used a git hash, then everything would seem to have worked, but you silently get bogus results, which is just about the worst thing that a dev tool can do for you.

And I also want to point out that this is Wasmtime-developers-only code on the fringe of the project and is only used for the bench API and Sightglass. It doesn't affect anything core to Wasmtime at all. Code in crates/bench-api simply shouldn't need to meet the same bar that code in cranelift/codegen or crates/wasmtime/ need to meet.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:42):

fitzgen removed the review request for wasmtime-default-reviewers from PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:42):

fitzgen updated PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:42):

fitzgen requested wasmtime-default-reviewers for a review on PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:42):

fitzgen requested alexcrichton for a review on PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:44):

fitzgen commented on PR #15273:

caching is off-by-default (right?)

Not quite: caching is off if you are benchmarking compilation (either specifically just the compilation phase or if you are benchmarking all phases); otherwise it is enabled.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 22:45):

fitzgen commented on PR #15273:

I'm happy to rewrite this code to use stuff from windows-sys and libc if you prefer.

And I can also limit the dladdr version to cfg(any(target_os = "linux", target_os = "macos")) instead of cfg(unix)

Both done in the latest commit pushed.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 23:01):

:thumbs_up: alexcrichton submitted PR review:

Well, I suppose. I don't really want to let the quality of everything non-wasmtime/cranelift to slip in the repo, but at the same time I agree that this isn't worth spending a lot of time on. Can this at least include a fallback for other platforms to ensure it at least compiles, albeit fails at runtime?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 23:27):

fitzgen updated PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 23:27):

fitzgen has enabled auto merge for PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 23:37):

fitzgen added PR #15273 bench-api: Fix compilation caching to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 23:59):

:check: fitzgen merged PR #15273.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 23:59):

fitzgen removed PR #15273 bench-api: Fix compilation caching from the merge queue.


Last updated: Nov 19 2026 at 20:05 UTC