Repository navigation
Conversation
Collaborator
|
Moving the address of the next trace to a point determined during trace construction is a potentially useful optimization. However, the performance gain is too small to justify the added complexity. Regarding pull requests (PRs) for CKB-VM performance optimization, we adhere to a consistent rule: in the interest of project stability and security, PRs offering only marginal performance gains should not be merged, unless there is compelling evidence to justify them. |
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.
Change
Cache only the fall-through fixed trace slot on x86-64, AArch64 and riscv64. When building a trace, encode the byte offset for its sequential end PC in the upper word of the synthetic trace terminator. Its dedicated handler consumes that offset, then uses the existing destination-address, nonempty and cycle-budget checks. A colliding or empty slot takes the normal miss path.
Taken branches, direct and indirect jumps, VM entry and legacy trace ends use their original PC lookup. No taken-target hint, new trace field, struct-literal/API break, trace stride change or guest opcode. All supported ASM backends export
ckb_vm_asm_linked_trace_end, so Rust emits the same terminator without architecture-specific code. No dependency on #550.Both fixed and dynamic builders emit the terminator. Custom table sizes and the one-slot single-step invocation use the ordinary lookup instead.
Measurements (x86-64 only, before the handler-symbol rename)
Ryzen AI 9 HX 370, Linux/WSL2 x86-64, pinned logical CPU. Nine alternating before/after pairs against f88f133. The VM benchmark uses the existing release-0.24 secp256k1 benchmark ELF and arguments, V2 ASM + MOP, estimated cycles, fresh VM + load + run (30 warmups, 300 measured runs/process). The guest exits 0 at 1,148,317 cycles in both builds.
The matched-address control uses alignment in separate benchmark builds only, not in the patch. These are workload-specific results; layout and run-to-run variance matter. No block replay.
Validation
make test: 82 passed;make test-asm: 172 passed;make fmt,make clippy, and regenerated assembly constants.tests/test_asm.rstarget on AArch64 and riscv64 (30 passed on each), including the fall-through regression. These are correctness tests, not native performance measurements.test_artifactfailure.