Use optimized 256-bit instructions - #604
Draft
elle-j wants to merge 12 commits into
Draft
Conversation
Windows. A workspace-wide resolve checks out the temporary polkadot-sdk git dependency, whose tree contains a directory named aux — a reserved device name on Windows — so the checkout fails before the builder is even installed. The builder itself uses no workspace crate and no git dependency, so narrowing the workspace members to crates/llvm-builder keeps the resolve entirely on crates.io; the narrowed resolve no longer matches Cargo.lock, which is why the Windows install drops --locked.
The MSVC developer environment makes rustc invoke the linker by the bare name link.exe, and bash prepends the Git coreutils link.exe to PATH ahead of the MSVC one, so every build script failed to link. The workspace narrowing stays in bash for grep and sed; only the cargo install moves back to the default shell, where link.exe resolves to MSVC.
Workflows will temporarily use prebuilt fork LLVM supporting the wide instructions. Differential tests will run both with the interpreter and the JIT, allowing testing the recompiler/JIT runs (x86-64 dependent) via CI before running any benchmarks. The JIT leg differs only in RUSTFLAGS gaining --cfg revive_jit, which is_jit reads and the dev-node runtime build script propagates into the wasm build on its own. For the first run, the JIT leg passes no expectations file as it first needs a baseline from the uploaded report.
Allows starting the resolc builds immediately.
The e2e node built from cccda66 embeds polkavm 09ce634, whose recompiler corrupts the heap while emitting the wide instructions and wedged under the JIT leg. This commit pins the fixed polkavm 77373b5.
The PolkaVM blob writer sized its jump table entries by counting bytes up to the first zero of the target offset. Thus, a program whose code crosses 64 KiB could deploy with a target truncated to an offset that is not an instruction boundary, which parses and then traps on the first return through it.
The previous revision reduces the 256-bit division family through bit-serial loops of up to 512 iterations per mulmod, which dominate wide instruction execution time on both backends. The new revision computes identical results digit-serially in roughly a seventh of the executed instructions per mulmod.
The renamed test-sim module removes the directory that libgit2 refuses to write on Windows, which made any workspace resolve with the git dependency present fail there. The temporary narrowed LLVM builder install on Windows existed only to avoid that checkout, so it is removed together with the bump.
The new revision monomorphizes the division digit step per divisor width, estimates quotients with a table seeded reciprocal, gives single-limb operands a native division path, and skips limbs the product does not occupy in the full-width modulus reduction, removing a quarter to three quarters of the executed instructions per operation.
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.
No description provided.