Allow using the custom wide integer instructions - #595
Draft
elle-j wants to merge 6 commits into
Draft
Conversation
Useful for testing and comparing the impact of the custom instruction changes with and without the wide instructions enabled.
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.
Description
Allows
resolcto target our new RISC-V vendor extension, which makesi256a machine type held in its own registers: each 256-bit operation selects to a single instruction instead of a chain of four 64-bit limbs, andaddmod,mulmod,expandsignextendbecome emitted intrinsics instead ofstdlib.llroutines.The extension is available via the now-updated LLVM submodule, using our fork (currently
kvpanch/vec_ext_custom_inst@355e253).Note
CLI flag:
A CLI flag (
--wide-instructions) and JSON input (settings.polkavm.wideInstructions) are implemented as part of this change to make the feature more easily measurable with and without the custom instructions enabled during development.(With the flag on, compilation fails at the PolkaVM linker, since this does not include a polkavm update including the decoding. Everything up to the ELF object runs: the intrinsics reach the IR, the
stdlib.llbodies are gone from the optimized module, and the object disassembles to realrevive.*instructions.)Follow-up note: newyork optimizer narrowing
The newyork IR pipeline currently narrows aggressively because a wide operation used to be a four-limb chain. With the extension, narrowing to a scalar vs keeping a value in a 256-bit register likely needs the cost/benefit calculations to be remeasured.