Skip to content

Commit 601ff0e

Browse files
trg-rgbVaibhav805
andcommitted
docs: clarify RISC-V RVV target selection and GCC 14+ requirement for ZVL128B/ZVL256B
Add a RISC-V subsection to docs/install.md inside 'Building from source', between the existing MIPS and FreeBSD sections, covering: - Target selection table (RISCV64_GENERIC / RISCV64_ZVL128B / RISCV64_ZVL256B / C910V / x280) and what each is for. - The general property that GENERIC / ARCH_GENERIC targets across all architectures map to the non-vectorized plain-C reference path, with the Makefile.riscv64 scalar -march override noted as the RISC-V-specific compounding factor. - GCC 14+ requirement for the ZVL targets on current OpenBLAS releases (GCC 13 does not implement the __riscv_vsseg* intrinsics used by the _rvv.c kernels and falls back to scalar silently, detectable only by disassembly). - Reference objdump-based verification command and expected opcode-count range for a correct RISCV64_ZVL128B build. README.md now keeps a single one-line pointer to the new install.md section at the spot where users encounter the RISC-V build commands, so the signposting is preserved without bloating the page that GitHub renders by default. v2 of this PR, addresses review feedback from @martin-frbg on relocation and on the broader GENERIC framing. Co-authored-by: Vaibhav805 <Vaibhav805@users.noreply.github.com>
1 parent 804a77c commit 601ff0e

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ Please read `GotoBLAS_01Readme.txt` for older CPU models already supported by th
226226
make HOSTCC=gcc TARGET=x280 NUM_THREADS=8 CC=riscv64-unknown-linux-gnu-clang FC=riscv64-unknown-linux-gnu-gfortran
227227
```
228228

229+
(For RVV 1.0 target selection and compiler requirements, see the [RISC-V section in docs/install.md](docs/install.md#risc-v).)
230+
229231
- **ZVL???B**: Level-3 BLAS and Level-1,2 including vectorised kernels targeting generic RISCV cores with vector support with registers of at least the corresponding width; ZVL128B and ZVL256B are available.
230232
e.g.:
231233
```sh

docs/install.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,55 @@ make BINARY=32 BINARY32=1 CC=$MTI_TOOLCHAIN-gcc AR=$MTI_TOOLCHAIN-ar FC="$MTI_TO
796796
```
797797
798798
799+
### RISC-V
800+
801+
OpenBLAS supports several RISC-V targets. Target selection determines whether
802+
the resulting build is vectorized.
803+
804+
#### Target selection
805+
806+
| Target | Vectorization | Use when |
807+
| ------------------- | ------------------------------ | ------------------------------------------------------- |
808+
| `RISCV64_GENERIC` | None — scalar reference path | Non-vector cores, or as a baseline reference build |
809+
| `RISCV64_ZVL128B` | RVV 1.0, VLEN >= 128 bits | Generic RVV-1.0 hardware with 128-bit vector registers |
810+
| `RISCV64_ZVL256B` | RVV 1.0, VLEN >= 256 bits | Generic RVV-1.0 hardware with 256-bit vector registers |
811+
| `C910V` | RVV 0.7.1 (legacy) | T-Head C910 (Allwinner D1, etc.) |
812+
| `x280` | RVV 1.0, SiFive-tuned | SiFive x280 cores |
813+
814+
As with the `GENERIC` and `ARCH_GENERIC` targets on other architectures,
815+
`RISCV64_GENERIC` maps all BLAS operations to the non-vectorized plain-C
816+
reference path. On RISC-V specifically, `Makefile.riscv64` also appends a
817+
scalar `-march` override for this target that takes precedence over any
818+
user-supplied `-march=rv64gcv` flag, so passing the V extension on the
819+
command line will not produce a vectorized build under this target.
820+
821+
For RVV 1.0 vectorized builds, use `RISCV64_ZVL128B` or `RISCV64_ZVL256B`.
822+
These targets route all three BLAS levels including DGEMM to the
823+
`_rvv.c` kernel set introduced in 2022; see
824+
[issue #3808](https://github.com/OpenMathLib/OpenBLAS/issues/3808) for the
825+
design rationale and the `_vector.c` (legacy RVV 0.7) / `_rvv.c` (RVV 1.0)
826+
codebase separation.
827+
828+
#### Compiler requirements for ZVL targets
829+
830+
GCC 14 or later is required on current OpenBLAS releases when building the
831+
`RISCV64_ZVL128B` or `RISCV64_ZVL256B` targets. GCC 13 does not implement
832+
the segmented load/store intrinsics (`__riscv_vsseg*`) used by the
833+
`_rvv.c` kernels; under GCC 13 the build still completes and produces a
834+
library, but the affected routines fall back to scalar code paths.
835+
Functional tests will pass on the resulting library; only
836+
disassembly-level verification detects the regression.
837+
838+
For a correct `RISCV64_ZVL128B` build on OpenBLAS 0.3.33,
839+
840+
```bash
841+
riscv64-linux-gnu-objdump -d libopenblas*.a | \
842+
grep -c 'vle64\|vfmacc\|vsetvli\|vlse64\|vfmul\|vfadd\|vfredosum'
843+
```
844+
845+
returns approximately 12,000-14,000 (GCC 14: ~12,691; GCC 15: ~14,355).
846+
847+
799848
### FreeBSD
800849
801850
You will need to install the following tools from the FreeBSD ports tree:

0 commit comments

Comments
 (0)