alexcrichton opened PR #13448 from alexcrichton:bulk-ops to bytecodealliance:main:
This commit is the final step of #13387 to add tests for all bulk operations and ensure that everything stays in sync. Notably all instructions have tests that their "infinite" version traps on out-of-fuel and additionally each version consumes a set amount of fuel. This required adjusting the fuel consumption loops as to where fuel was tweaked/flushed to ensure that fuel wasn't double-counted during loops and to also ensure that 1 fuel was consumed per-loop.
This does surface some slightly odd behavior where sometimes fuel is counted as a per-byte operation and sometimes it's counted as a per-element operation. This happens due to how the code is structured where sometimes
array.fill, for example, is amemsetand sometimes it's per-element. The fuel consumption ofmemsetis byte-based, for example, while it's per-element based for the manual loop. Regardless though it's still always deterministic for a particular wasm, and notably execution will still be limited by the dynamic operation size of these instructions.Closes #13387
<!--
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 ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested cfallin for a review on PR #13448.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #13448.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13448.
alexcrichton updated PR #13448.
:thumbs_up: cfallin submitted PR review:
Looks good!
This does surface some slightly odd behavior where sometimes fuel is counted as a per-byte operation and sometimes it's counted as a per-element operation. This happens due to how the code is structured where sometimes array.fill, for example, is a memset and sometimes it's per-element. The fuel consumption of memset is byte based, for example, while it's per-element based for the manual loop. Regardless though it's still always deterministic for a particular wasm, and notably execution will still be limited by the dynamic operation size of these instructions.
That seems fine to me; we've never made any guarantees about what one unit of fuel means (so we're free to increase or decrease "fuel efficiency[^1]" as our needs require that...)
[^1]: drive an electric Wasmtime today for incredible fuel efficiency! inquire inside for conditions of offer
cfallin added PR #13448 Test/adjust fuel consumption in bulk ops to the merge queue.
:check: cfallin merged PR #13448.
cfallin removed PR #13448 Test/adjust fuel consumption in bulk ops from the merge queue.
Last updated: Jun 01 2026 at 09:49 UTC