|
3 | 3 |
|
4 | 4 | # Spatz |
5 | 5 |
|
| 6 | +## Local updates: VLXBLK custom instruction support |
| 7 | + |
| 8 | +This branch includes local changes for newly added `vlxblk*` custom vector instructions and the software/kernel support around them. |
| 9 | + |
| 10 | +### What changed |
| 11 | + |
| 12 | +- **LLVM support** |
| 13 | + - Added inline assembly recognition for the new `vlxblk*` instructions. |
| 14 | + - Relevant changes are in: |
| 15 | + - `sw/toolchain/llvm-project` |
| 16 | + - `RISCVInstrFormatsV.td` |
| 17 | + - `RISCVInstrInfoV.td` |
| 18 | + |
| 19 | +- **riscv-opcodes support** |
| 20 | + - Added opcode descriptions for the new `vlxblk*` instructions so that `riscv_instr.sv` and related generated files can be reproduced through the opcode toolchain. |
| 21 | + |
| 22 | +- **Environment script** |
| 23 | + - `util/iis-env.sh` was updated to support a **local LLVM installation**. |
| 24 | + |
| 25 | +- **Software kernel** |
| 26 | + - Added `hp-dqmatmul`: a vector dequantized matrix multiplication kernel using the new `vlxblk*` instructions. |
| 27 | + |
| 28 | +### How to use |
| 29 | + |
| 30 | +The new instructions depend on the local changes in both **LLVM** and **riscv-opcodes**. |
| 31 | + |
| 32 | +Run the following from the repository root: |
| 33 | + |
| 34 | +```bash |
| 35 | +make init |
| 36 | +make sw/toolchain/llvm-project |
| 37 | +make tc-llvm |
| 38 | +``` |
| 39 | + |
| 40 | +The local LLVM toolchain will be installed to: |
| 41 | + |
| 42 | +```tcl |
| 43 | +spatz/build/llvm |
| 44 | +``` |
| 45 | + |
| 46 | +If you use the IIS environment helper, source: |
| 47 | + |
| 48 | +```tcl |
| 49 | +source util/iis-env.sh |
| 50 | +Added software: hp-dqmatmul |
| 51 | +``` |
| 52 | + |
| 53 | +A new software kernel was added for vector dequantized matrix multiplication using the new instructions. |
| 54 | + |
| 55 | +Path: |
| 56 | + |
| 57 | +```tcl |
| 58 | +sw/spatzBenchmarks/hp-dqmatmul |
| 59 | +``` |
| 60 | + |
| 61 | +### Generate input data (Optional) |
| 62 | + |
| 63 | +```tcl |
| 64 | +cd sw/spatzBenchmarks/hp-dqmatmul |
| 65 | +python3 script/gen_data.py -c script/dqmatmul.json |
| 66 | +``` |
| 67 | + |
| 68 | +### Run simulation |
| 69 | +```tcl |
| 70 | +cd hw/system/spatz_cluster |
| 71 | +make clean && make sw.vsim -B |
| 72 | +``` |
| 73 | + |
| 74 | +Run without GUI: |
| 75 | + |
| 76 | +```tcl |
| 77 | +bin/spatz_cluster.vsim ./sw/build/spatzBenchmarks/test-spatzBenchmarks-hp-dqmatmul_M32_N128_K32 |
| 78 | +``` |
| 79 | +Instruction encoding note |
| 80 | + |
| 81 | +The current vlxblk* instructions use custom-2 opcodes. |
| 82 | + |
| 83 | +At the moment, the block size is hardcoded in the instruction encoding. |
| 84 | +In a future version, this should be generalized so that the block size is passed through a register or another configurable mechanism. |
| 85 | + |
| 86 | +--- |
| 87 | + |
6 | 88 | Spatz is a compact vector processor based on [RISC-V's Vector Extension (RVV) v1.0](https://github.com/riscv/riscv-v-spec/releases/tag/v1.0). Spatz acts as a coprocessor of [Snitch](https://github.com/pulp-platform/snitch), a tiny 64-bit scalar core. It is developed as part of the PULP project, a joint effort between ETH Zurich and the University of Bologna. |
7 | 89 |
|
8 | 90 | ## Getting started |
|
0 commit comments