Bounded Load/Store Operations
Definition
In the RISC-V Vector (RVV) extension, a bounded load/store operation is a Code Fragment consisting of multiple assembler instructions that work together to implement a single bounded vector load or store. Unlike an ordinary RVV instruction, which is encoded as one assembler line, a bounded load/store Code Fragment bundles the bounding logic together with the vector load/store instruction itself.
For example, while a Code Fragment for an RVV add operation contains a single vector add instruction, a Code Fragment for an RVV bounded load/store operation contains multiple assembler instructions to realize the bounding together with a vector load/store instruction.
Why bounded load/stores are a generation challenge
Context-free grammars are highly efficient at generating syntactically valid, simple instruction sequences. However, their expressiveness is too limited for more complex, multi-instruction sequences whose values depend on each other. Generating bounded values — possibly dynamically parameterized, such as an address restricted to a specific range — is one such case. Bounded load/store operations are a more complex instance of this problem, since they consist of multiple instructions that are mutually dependent.
Generation in the grammar-based ISG
To handle bounded load/store operations (and similar cases) efficiently, the RVVTS grammar-based Instruction Sequence Generator (ISG) extends the context-free grammar with special function symbols associated with Python functions. The ISG expands such function symbols by calling the associated function, which can provide context-sensitive expressiveness. The result returned by the function is then integrated into the generated Code Fragment.
In the ISG, Python-backed functions are used for, among other things:
- generating immediate values,
- register allocations,
- valid values for CSRs,
- bounded load/stores.
Related concept
- grammar-based ISG — the generator that uses context-free grammars extended with Python function symbols to produce bounded load/stores and other context-sensitive constructs.
References
- Schlägl and Große, Single Instruction Isolation for RISC-V Vector Test Failures, ICCAD '24, New York, NY, USA — Sections discussing Code Fragments, the grammar-based ISG, and bounded load/store generation.