feat: support for Zbb, Zba and Zbs extensions - #3083
Draft
mansur20478 wants to merge 12 commits into
Draft
Conversation
This comment has been minimized.
This comment has been minimized.
mansur20478
force-pushed
the
feat/zba-b-s-extension-support
branch
from
July 29, 2026 19:33
fdf3f2c to
990c52b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The shadd/slli_uw GPU test harnesses gave the trace-comparison CPU chip the hybrid cpu_range_checker(), whose counts merge into the GPU range checker trace on top of the kernel's own counts, so receives were twice the AIR sends (LogUp NonzeroRootSum). Use a dummy range checker for the CPU comparison chip, matching the add_sub CUDA test idiom.
Mirrors cargo-openvm's env passthrough so benchmark ELFs can be built with -C target-feature=+zba,+zbb,+zbs for bitmanip A/B runs.
ANDN/ORN/XNOR move to a dedicated byte-limb chip that reuses the bitwise XOR lookup (complement folded linearly into the relation), and MIN/MINU/MAX/MAXU move to a less_than-style limb comparison chip with a pick_b selector, writing the selected operand as an expression. Both replace the 348-column reg catch-all rows (27 and 21 core columns respectively) for these seven opcodes; the catch-all keeps serving the rotate and single-bit families until they are extracted too. Executor registration order now matters and matches the AIR/chip order (chips pair with executors positionally); the initial mis-ordering corrupted adapter records in the full-config integration test.
bitmanip/rotate.rs and bitmanip/rotate_imm.rs hold the finished generic rotate cores (ROL/ROR at 4 limbs, ROLW/RORW at 2 limbs behind the W adapter, plus the RORI/RORIW immediate variant with the shamt bound as width*(is_valid - is_idx_zero) - idx). They are intentionally NOT in the module tree yet: wiring (predicates, executors, registration, CUDA, tests) lands with the rotate extraction commit.
This comment has been minimized.
This comment has been minimized.
mansur20478
force-pushed
the
feat/zba-b-s-extension-support
branch
from
July 30, 2026 14:35
9892fb0 to
f2a6c35
Compare
This comment has been minimized.
This comment has been minimized.
Constant propagation can fold a min/max operand to a literal 0, and the inline unsigned ternary then contains 'x < 0ull', which clang rejects under -Werror=tautological-unsigned-zero-compare. Route the four ops through always_inline helpers in rv64b.h so the generated call sites are insensitive to operand shape, and re-seed x10 to zero in the rvr golden program so the folded-zero path stays covered.
This comment has been minimized.
This comment has been minimized.
REV8 and SEXT.B are the hottest non-shadd B ops on reth (1.6M and 0.95M rows) and were paying the imm catch-all's 310 columns and 5,949 constraints per row. They move (with SEXT.H/ZEXT.H/ORC.B) to a dedicated byte-limb chip whose written value is an expression over the operand bytes: REV8 is pure wiring, ORC.B uses the inverse trick per byte, and the sign extensions decompose the extended byte as lo + 128*t with the low part range checked through the bitwise lookup (2*lo < 256). 27 core columns, ~20 constraints.
Contributor
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: 409a26f |
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.
This PR adds support for
zbb,zbaandzbsextensions. The PR is intended for benchmarking purposes only.Benchmark results
Baseline: https://github.com/axiom-crypto/openvm-eth/actions/runs/30566664481
With basic bit manipulation extension (per iterative improvement):
Resolves INT-8922