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:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen removed the review request for wasmtime-core-reviewers from PR #15273.
fitzgen requested pchickey for a review on PR #15273.
fitzgen requested wasmtime-core-reviewers for a review on PR #15273.
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
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.
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-sysorlibc, 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.
fitzgen commented on PR #15273:
I'm happy to rewrite this code to use stuff from
windows-sysandlibcif you prefer.And I can also limit the
dladdrversion tocfg(any(target_os = "linux", target_os = "macos"))instead ofcfg(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-apisimply shouldn't need to meet the same bar that code incranelift/codegenorcrates/wasmtime/need to meet.
fitzgen removed the review request for wasmtime-default-reviewers from PR #15273.
fitzgen updated PR #15273.
fitzgen requested wasmtime-default-reviewers for a review on PR #15273.
fitzgen requested alexcrichton for a review on PR #15273.
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.
fitzgen commented on PR #15273:
I'm happy to rewrite this code to use stuff from
windows-sysandlibcif you prefer.And I can also limit the
dladdrversion tocfg(any(target_os = "linux", target_os = "macos"))instead ofcfg(unix)Both done in the latest commit pushed.
: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?
fitzgen updated PR #15273.
fitzgen has enabled auto merge for PR #15273.
fitzgen added PR #15273 bench-api: Fix compilation caching to the merge queue.
:check: fitzgen merged PR #15273.
fitzgen removed PR #15273 bench-api: Fix compilation caching from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC