RISC-V Vector Extension (RVV)
The RISC-V Vector Extension, RVV, is the standard vector instruction set of RISC-V. Version 1.0 was frozen for public review in September 2021, and the specification now lives as a chapter of the unified RISC-V instruction set manual rather than in the standalone repository it was drafted in.[1][2]
Material on RVV tends to come in two halves that do not meet. The specification gives mnemonics, encodings and exact semantics, and says nothing about C. The intrinsics specification gives C function names and a naming scheme, and assumes you already know what the instruction does.[3] A programmer with a loop to vectorize needs both at once: which operations exist, and what to call to get one. This article puts the two side by side, category by category.
What it does not do: it is not a tutorial, it does not give performance advice, and it does not list every intrinsic. The generated intrinsic listing runs to roughly 27,000 function signatures[4] — the article gives the base names, which number about 460, and the rule that expands them. Claims about particular processors are limited to what the vendor states or a cited measurement reports, and are labeled accordingly.
History
The repository the extension was drafted in was opened in July 2018, and its tagged releases are the clearest record of how long the design took to settle.[5]
| Release | Date | Note |
|---|---|---|
0.7.1 |
13 June 2019 | the draft a good deal of silicon was built against |
0.8 |
14 December 2019 | |
0.9 |
15 May 2020 | |
v0.10 |
29 January 2021 | tagged as "v1.0-draft" |
v1.0-rc1 |
9 June 2021 | |
v1.0-rc2 |
18 September 2021 | |
v1.0 |
20 September 2021 | "frozen for public review" |
zvfh |
2 May 2023 | half-precision, added after 1.0 |
The repository's own README is worth quoting for what it expected to happen next: version 1.0 was "frozen and at this time is undergoing public review", stable enough "to begin developing toolchains, functional simulators, and implementations", and "once ratified, the spec will be given version 2.0."[6] The renumbering never happened — the ratified extension is still called 1.0 — and the repository was archived read-only on 20 March 2024, its content having moved into the unified instruction set manual, where it is maintained today.[2][1]
The same README is blunt about the earlier tags: they "were for experimental development purposes only and are not standard versions suitable for production use", and "significant incompatible changes were made from these earlier versions prior to freezing."[6]
That sentence is the origin of the one piece of history that still costs people time. Chips were designed and sold against 0.7.1, two years before the freeze, and the incompatible changes landed afterwards. The result is a permanent fork in the installed base rather than a version anyone can upgrade past — see XuanTie, and the 0.7.1 problem below.
Extensions have continued to arrive since: half precision in 2023, and the vector cryptography family, which LLVM declared non-experimental at version 1.0 in its 18 release.[7]
Why RVV code looks unfamiliar
In SSE, NEON or AVX the register width is part of the instruction set. A program compiled for 128-bit registers uses 128-bit registers; to use 256 you recompile, often with a second copy of the kernel.
RVV does not work that way. The vector register length, VLEN, is an implementation choice that the program does not know at compile time and is not told at link time. The same binary is meant to run on a core with 128-bit registers and on a core with 1024-bit registers, and to go faster on the second one. Three consequences follow, and they shape everything else:
- The element width is not in the opcode.
vadd.vvadds whatever the current configuration says the registers hold — sixteen 8-bit integers, or two 64-bit ones. The configuration lives in thevtypeCSR. - The loop asks for work and is told how much it got. A
vsetvliinstruction takes the number of elements the program still has to process and returns the number the hardware will do this time. The loop is written around that answer rather than around a fixed step. - There is no scalar remainder loop. The final iteration simply gets a smaller answer from
vsetvli. Code that would need a peeled tail in SSE needs nothing here.
The RISC-V term for this is a vector-length-agnostic program, and it is the single biggest difference for anyone arriving from fixed-width SIMD.
The programmer's model
Registers, VLEN and LMUL
There are 32 vector registers, v0 to v31, each VLEN bits wide. VLEN is a power of two, fixed in the hardware, and readable at run time from the vlenb CSR, which holds VLEN/8.[1]
Registers can be ganged together. LMUL, the vector register group multiplier, makes one instruction operate on 1, 2, 4 or 8 registers at once; a group of 2 is named by its even register, a group of 4 by a multiple of four, and so on. LMUL can also be fractional — 1/2, 1/4, 1/8 — which uses only part of a register.
Fractional LMUL looks pointless until mixed-width code comes up. Widening a vector of 16-bit values into 32-bit results needs twice the register space for the output. With integer LMUL only, the narrow input has to occupy a whole register and the wide output two, which burns register names fast. With fractional LMUL the narrow input occupies half a register and the wide output a whole one, and all 32 names stay available.[1]
SEW and vtype
SEW, the selected element width, says how the bits in a register are divided into elements. The standard extensions encode 8, 16, 32 and 64; the larger encodings are reserved.[1]
The number of elements one instruction processes is then
VLMAX = LMUL × VLEN / SEW
so at VLEN=128, SEW=32, LMUL=2 an instruction covers eight elements, which is the situation drawn in the figure.
vtype holds five fields: vill, vma, vta, vsew and vlmul. It is read-only — only vsetvli, vsetivli and vsetvl change it. If a configuration is not supported, the vill bit comes back set rather than the instruction trapping, and software is expected to check it and take another path.[1]
vl, the body, the tail and the mask
vl holds the number of elements the next instruction will actually write. Elements below vl are the body; elements from vl up to VLMAX are the tail.
Within the body, a mask register can switch individual elements off. The mask is always v0, one bit per element, and an instruction that uses it is written with v0.t as its last operand. Body elements whose mask bit is 0 are inactive.
Two policy bits decide what happens to the elements an instruction does not compute:
| Bit | Setting | What happens to those elements |
|---|---|---|
vta |
tail-undisturbed (0) | tail elements keep their old contents |
vta |
tail-agnostic (1) | tail elements may be left alone or overwritten with ones; do not rely on either |
vma |
mask-undisturbed (0) | inactive body elements keep their old contents |
vma |
mask-agnostic (1) | inactive body elements may be left alone or overwritten with ones |
The agnostic settings exist because preserving old contents forces an out-of-order core to treat the old register value as an input, which costs it a dependency it would rather not have. The intrinsics default to agnostic for exactly that reason.[3]
A strip-mined loop
The shape below is the one every RVV loop has. Note that nothing in it mentions a vector width.
#include <riscv_vector.h>
void saxpy(size_t n, float a, const float *x, float *y) {
for (size_t vl; n > 0; n -= vl, x += vl, y += vl) {
vl = __riscv_vsetvl_e32m8(n); // ask for n, get what fits
vfloat32m8_t vx = __riscv_vle32_v_f32m8(x, vl);
vfloat32m8_t vy = __riscv_vle32_v_f32m8(y, vl);
vy = __riscv_vfmacc_vf_f32m8(vy, a, vx, vl);
__riscv_vse32_v_f32m8(y, vy, vl);
}
}
On a core with VLEN=128 the first vsetvl returns 32; on one with VLEN=512 it returns 128. The loop does not change, and there is no remainder to clean up.
The C intrinsics
The intrinsics are declared in <riscv_vector.h>. Whether a compiler has them is tested with the __riscv_v_intrinsic macro, which is defined even when the vector extension is not enabled, and whose value for version 1.0 is 1000000.[3]
#if __riscv_v_intrinsic >= 1000000
#include <riscv_vector.h>
#endif
Which intrinsics actually exist depends on the -march string. Under rv64gc_zve32x, for instance, neither the type vint64m1_t nor the function __riscv_vle64_v_i64m1 is available, because that subset has no 64-bit elements.[3]
Types
The types are strongly typed in element width and LMUL both. The pattern is v{int|uint|float}{SEW}{LMUL}_t:
| Type | Elements | At VLEN = 128 |
|---|---|---|
vint8m1_t |
8-bit signed, LMUL 1 | 16 elements in one register |
vint8m8_t |
8-bit signed, LMUL 8 | 128 elements across eight registers |
vuint16mf2_t |
16-bit unsigned, LMUL 1/2 | 4 elements in half a register |
vfloat32m2_t |
32-bit float, LMUL 2 | 8 elements across a register pair |
vbool8_t |
mask, one bit per element, for a SEW/LMUL ratio of 8 | the mask for vint8m1_t above
|
Mask types are named after the ratio SEW/LMUL rather than after a width: a vbool32_t is the mask that fits an operation whose ratio is 32, such as i32m1 or i64m2.[3]
The naming scheme
The explicit, non-overloaded form is:
__riscv_{MNEMONIC}_{OPERANDS}_{RETURN TYPE}[_{ROUNDING}][_{POLICY}]
MNEMONIC is the instruction without its dots — vadd, vfmacc, vsadd. OPERANDS is the operand form the mnemonic's suffix would give in assembly: vv for vector-vector, vx for vector-scalar from an integer register, vf for vector-scalar from a float register, vi for an immediate, vs for the scalar forms, and vvm / vxm where a mask operand is part of the instruction rather than a modifier.[3]
So the assembly
vadd.vv v8, v16, v24
is reached in C as
vint32m1_t __riscv_vadd_vv_i32m1(vint32m1_t vs2, vint32m1_t vs1, size_t vl);
Policy suffixes
The masking bit and the two policy bits are fused into one suffix, and every maskable intrinsic exists in all six variants:[3]
| Suffix | Masked? | vta |
vma
|
|---|---|---|---|
| (none) | no | agnostic | — |
_tu |
no | undisturbed | — |
_m |
yes | agnostic | agnostic |
_tum |
yes | undisturbed | agnostic |
_mu |
yes | agnostic | undisturbed |
_tumu |
yes | undisturbed | undisturbed |
The masked forms take the mask as their first argument; the undisturbed forms take the destination's previous value as an argument, because that value is now an input.
Four places the scheme does not fit
Encoding only the return type is ambiguous for four families, so those encode an input type as well.[3] They are worth knowing, because a reader who has internalized the general rule will otherwise think the names are inconsistent:
| Family | What is added | Example |
|---|---|---|
| Scalar moves | input vector type and output scalar type | __riscv_vmv_x_s_i8m1_i8
|
| Reductions | input vector type and output vector type | __riscv_vredsum_vs_i8m2_i8m1
|
| Carry / borrow | input type and the mask output type | __riscv_vmadc_vvm_i8mf8_b64
|
vreinterpret, vlmul_ext/vlmul_trunc, vget/vset |
input type before the return type | __riscv_vreinterpret_v_i32m1_f32m1
|
Overloaded intrinsics
Beside the explicit names there is an overloaded set, which drops the type suffix and lets C++ overloading or C generic selection pick the right one from the argument types — __riscv_vadd rather than __riscv_vadd_vv_i32m1. The policy suffix stays. Code that changes LMUL during tuning is much less painful to edit in the overloaded form; code that is read by someone else is usually clearer in the explicit one.[3]
The instruction set, category by category
Each table below gives the specification's own grouping, the mnemonics in that group, and the intrinsic base names that reach them. The counts are of the generated listing.[4]
Configuration
| Instruction | What it does | Intrinsic |
|---|---|---|
vsetvli |
set vtype from an immediate, vl from a register |
__riscv_vsetvl_e{SEW}m{LMUL}, __riscv_vsetvlmax_e{SEW}m{LMUL}
|
vsetivli |
both from immediates, for short known lengths | |
vsetvl |
both from registers |
In intrinsic code these are rarely written by hand except for the loop's own vsetvl: the type suffix on every other intrinsic already tells the compiler what configuration that operation needs, and the compiler emits and hoists the vset* instructions itself.
Loads and stores
| Addressing mode | Mnemonics | Intrinsic base names |
|---|---|---|
| Unit stride | vle8, vle16, vle32, vle64, vse8 … vse64 |
vle{8,16,32,64}, vse{8,16,32,64}
|
| Mask load/store | vlm.v, vsm.v |
vlm, vsm
|
| Constant stride | vlse8 … vlse64, vsse8 … vsse64 |
vlse{N}, vsse{N}
|
| Indexed, unordered | vluxei8 … vluxei64, vsuxei8 … |
vluxei{N}, vsuxei{N}
|
| Indexed, ordered | vloxei8 … vloxei64, vsoxei8 … |
vloxei{N}, vsoxei{N}
|
| Fault-only-first | vle8ff … vle64ff |
vle{N}ff
|
| Whole register | vl1re8 … vl8re64, vs1r.v … vs8r.v |
(no intrinsic; the compiler emits them) |
38 base names, 2,300 signatures. Two of these deserve attention:
- Indexed ordered versus unordered. Both are gather/scatter. The ordered form guarantees the memory accesses happen in element order, which matters when indices repeat in a scatter; the unordered form does not, and is the one to use when they do not.
- Fault-only-first. A unit-stride load that takes a fault on any element after the first does not trap — it shortens
vlto stop before the faulting element and carries on. This is what makes it possible to vectorize astrlen-shaped loop that must not read past the end of a page.[1]
Segment loads and stores
Segment instructions move 2 to 8 fields per element, de-interleaving on load and re-interleaving on store: one instruction turns an array of RGB triples into three vectors, or three vectors back into triples.
| Form | Mnemonic pattern |
|---|---|
| Unit stride | vlseg{2..8}e{8,16,32,64} / vsseg…
|
| Unit stride, fault-only-first | vlseg{2..8}e{N}ff
|
| Constant stride | vlsseg{2..8}e{N} / vssseg…
|
| Indexed, unordered and ordered | vluxseg{2..8}ei{N}, vloxseg{2..8}ei{N} and the store forms
|
This is the largest category by a wide margin — 252 base names and 9,388 signatures, a third of the whole intrinsic surface — purely because every combination of field count, element width and index width gets its own name.
Integer arithmetic
| Group | Mnemonics |
|---|---|
| Add and subtract | vadd, vsub, vrsub
|
| Widening add/subtract | vwadd, vwaddu, vwsub, vwsubu
|
| Extension | vsext.vf{2,4,8}, vzext.vf{2,4,8}
|
| Carry and borrow | vadc, vmadc, vsbc, vmsbc
|
| Bitwise | vand, vor, vxor
|
| Shifts | vsll, vsrl, vsra
|
| Narrowing shifts | vnsrl, vnsra
|
| Compares | vmseq, vmsne, vmsltu, vmslt, vmsleu, vmsle, vmsgtu, vmsgt
|
| Min and max | vminu, vmin, vmaxu, vmax
|
| Multiply | vmul, vmulh, vmulhu, vmulhsu
|
| Divide | vdivu, vdiv, vremu, vrem
|
| Widening multiply | vwmul, vwmulu, vwmulsu
|
| Multiply-add | vmacc, vnmsac, vmadd, vnmsub
|
| Widening multiply-add | vwmacc, vwmaccu, vwmaccsu, vwmaccus
|
| Merge and move | vmerge, vmv.v.{v,x,i}
|
61 base names, 6,282 signatures. The compare instructions are the ones to look at twice: they write a mask register, not a vector of 0 and −1 as SSE and NEON do. That is why the result type of __riscv_vmseq_vv_i32m1_b32 is vbool32_t, and why there is no "movemask" step — the mask is already a bitmap.
Note also that vmsge and vmsgeu have intrinsics but no vector-vector encoding of their own: the assembler and the compiler reach the vector-vector forms by swapping the operands of vmsle, and the vx forms with a short instruction sequence.
Fixed-point arithmetic
| Group | Mnemonics |
|---|---|
| Saturating add/subtract | vsaddu, vsadd, vssubu, vssub
|
| Averaging add/subtract | vaaddu, vaadd, vasubu, vasub
|
| Fractional multiply | vsmul
|
| Scaling shifts | vssrl, vssra
|
| Narrowing clip | vnclipu, vnclip
|
13 base names, 1,088 signatures. All but the four saturating add/subtract forms round, and their intrinsics therefore take a rounding-mode argument that must be a compile-time constant, from the enum __RISCV_VXRM_{RNU,RNE,RDN,ROD}. The saturating forms do not round and have no such argument.[3]
Floating-point
| Group | Mnemonics |
|---|---|
| Add, subtract, multiply, divide | vfadd, vfsub, vfrsub, vfmul, vfdiv, vfrdiv
|
| Widening forms | vfwadd, vfwsub, vfwmul
|
| Fused multiply-add | vfmacc, vfnmacc, vfmsac, vfnmsac, vfmadd, vfnmadd, vfmsub, vfnmsub
|
| Widening fused multiply-add | vfwmacc, vfwnmacc, vfwmsac, vfwnmsac
|
| Square root and estimates | vfsqrt, vfrsqrt7, vfrec7
|
| Min, max, sign injection | vfmin, vfmax, vfsgnj, vfsgnjn, vfsgnjx
|
| Compares | vmfeq, vmfne, vmflt, vmfle, vmfgt, vmfge
|
| Classify, merge, move | vfclass, vfmerge, vfmv
|
| Conversions | vfcvt, vfwcvt, vfncvt
|
45 base names, 3,960 signatures. vfrsqrt7 and vfrec7 are estimates accurate to about seven bits, meant as the seed of a Newton iteration rather than as answers. The conversions are a small family with a large name space: each of vfcvt, vfwcvt and vfncvt spans float-to-int, int-to-float and float-to-float in signed and unsigned forms, with rtz variants that truncate instead of using the current rounding mode.
Reductions
| Group | Mnemonics |
|---|---|
| Integer, single width | vredsum, vredand, vredor, vredxor, vredminu, vredmin, vredmaxu, vredmax
|
| Integer, widening | vwredsumu, vwredsum
|
| Floating-point | vfredusum, vfredosum, vfredmin, vfredmax
|
| Floating-point, widening | vfwredusum, vfwredosum
|
16 base names, 868 signatures. A reduction takes a vector and a one-element vector holding the running value, and returns a one-element vector — which is why the intrinsic names carry two types.
The floating-point pair repays attention. vfredosum is ordered: it adds elements strictly in order, so the result is reproducible and matches what the scalar loop would have produced. vfredusum is unordered and may associate freely, which is faster and gives a different answer. Choosing the fast one is a numerical decision, not a performance one.
Mask instructions
| Group | Mnemonics |
|---|---|
| Mask logic | vmand, vmnand, vmandn, vmxor, vmor, vmnor, vmorn, vmxnor
|
| Pseudo-instructions | vmmv, vmclr, vmset, vmnot
|
| Count and find | vcpop.m, vfirst.m
|
| Set before/including/only first | vmsbf.m, vmsif.m, vmsof.m
|
| Index generation | viota.m, vid.v
|
19 base names, 242 signatures — the smallest category, because masks have no element width to multiply out. vcpop and vfirst return a scalar to an integer register, which makes them the usual way to turn a vector condition into a branch. viota produces the prefix sum of a mask, which is the index computation behind a compaction.
Permutation
| Group | Mnemonics |
|---|---|
| Scalar moves | vmv.x.s, vmv.s.x, vfmv.f.s, vfmv.s.f
|
| Slides | vslideup, vslidedown, vslide1up, vslide1down, vfslide1up, vfslide1down
|
| Gather | vrgather, vrgatherei16
|
| Compress | vcompress.vm
|
| Whole register move | vmv1r.v, vmv2r.v, vmv4r.v, vmv8r.v
|
11 base names, 999 signatures. vrgather is the general in-register permute, with the indices in a vector; vrgatherei16 is the same with 16-bit indices, which is what you want when SEW is 8 and a byte index could not reach far enough. vcompress packs the active elements of a vector to the front — the operation that turns a filter into straight-line code.
Intrinsics with no instruction behind them
The last category exists only in C. These are pseudo-intrinsics: they generate no instruction, they have no policy variants, and they are there to make the type system bearable.[3]
| Intrinsic | What it does |
|---|---|
__riscv_vreinterpret_v_* |
reads the same bits as another type |
__riscv_vlmul_ext_v_* / vlmul_trunc_v_* |
moves a value to a larger or smaller LMUL type |
__riscv_vget_v_* / vset_v_* |
extracts or inserts a sub-group of a larger register group |
__riscv_vcreate_v_* |
builds a tuple or a larger group from parts |
__riscv_vundefined_* |
names an uninitialized value, for the destination argument of a _tu call that has nothing to preserve
|
8 base names, 1,779 signatures. A second group of C-level names does map to instructions but to ones the assembler also treats as aliases — vneg, vnot, vfneg, vfabs, vwcvt, vncvt — each a specific operand pattern of a real instruction.
What a given chip actually implements
"Supports RVV" is not a single thing. The standard defines one application-processor extension and a family of embedded subsets, and they differ in which element widths exist, which is the difference that breaks code.[1]
| Extension | Element widths | Floating point | Notes |
|---|---|---|---|
Zve32x |
8, 16, 32 | none | the smallest; all integer, fixed-point, mask, reduction and permutation instructions |
Zve32f |
8, 16, 32 | FP32 | adds the floating-point instructions at EEW=32; requires scalar F
|
Zve64x |
8, 16, 32, 64 | none | adds 64-bit elements |
Zve64f |
8, 16, 32, 64 | FP32 | the union of the two above |
Zve64d |
8, 16, 32, 64 | FP32 and FP64 | requires scalar D
|
V |
8, 16, 32, 64 | FP32 and FP64 | Zve64d plus Zvl128b: VLEN is at least 128
|
Zvfh |
adds 16 | FP16 | binary16 arithmetic throughout |
Zvfhmin |
adds 16 | FP16 conversions only | only vfwcvt.f.f.v and vfncvt.f.f.w
|
Zvl{N}b |
— | — | asserts VLEN ≥ N; every longer one implies the shorter ones |
Three exclusions are worth committing to memory, because they are the ones that will surprise you:
Zve64xdoes not give youvmulhat 64 bits.vmulh.vv,vmulh.vx,vmulhuandvmulhsuare excluded at EEW=64; the specification's reason is the gate count of a wide high-half multiplier. The fullVextension does include them.Zve64xdoes not give youvsmulat 64 bits either.- 64-bit indices need a 64-bit base. Neither
VnorZve64xsupports EEW=64 index values when XLEN is 32.
The minimum VLEN differs too: V mandates 128, while a Zve* subset only requires VLEN ≥ ELEN unless a Zvl extension raises it. Code that assumes it has at least 128 bits to work with is assuming the V extension.
The calling convention
The ABI rules matter more here than in most extensions, because the vector state is large and because the defaults are not the ones a C programmer expects.[8]
In the standard calling convention, every vector register is a temporary. Nothing is preserved across a call:
| Register or CSR | Role | Preserved across calls? |
|---|---|---|
v0–v31 |
temporary registers | no |
vl |
vector length | no |
vtype |
vector type | no |
vxrm, vxsat |
fixed-point rounding and saturation | no |
Two consequences follow for anyone writing vector code around calls. A call in
the middle of a vectorized loop forces everything live to be spilled, which on
a machine with 512-bit registers and LMUL=8 is a great deal of stack traffic;
and vl and vtype have to be re-established after the
call, because the callee was free to change them. The specification also fixes
vstart: a procedure may assume it is zero on entry and on return,
and anything that writes it must zero it again before calling or
returning.[8]
Vector values are not passed in vector registers in the standard
convention. A variant convention exists for functions that do, selected
in C by __attribute__((riscv_vector_cc)), and it carves the
register file differently: v0 is an argument register,
v8–v23 are argument registers, and
v1–v7 and v24–v31 become
callee-saved. vl and vtype remain unpreserved even
there.[8]
Toolchain support
Intrinsics arrived in the compilers well before the intrinsics specification was finished, and the interface changed under its users more than once. The history is worth knowing because old code and old blog posts do not compile any more.
| Release | What it brought |
|---|---|
| LLVM 14 (2022) | the RISC-V vector extensions updated to version 1.0[9] |
| Clang 16 (2023) | all vector intrinsics given a __riscv_ prefix, plus an overall simplification of the interfaces and an adjustment to vcompress and vmerge. Compatible headers were shipped for the transition to the then-current v0.11[10]
|
| GCC 13 (2023) | intrinsics as specified in v0.11 of the intrinsics specification, most of the implementation contributed by Ju-Zhe Zhong of RiVAI[11] |
| Clang 17 (2023) | intrinsics v0.12; -mrvv-vector-bits= for a fixed vector length; the riscv_rvv_vector_bits attribute; intrinsics that take the frm and vxrm rounding modes explicitly; vread_csr and vwrite_csr removed[12]
|
| LLVM 17 (2023) | vsetvli intrinsics no longer modeled as having side effects[13]
|
| GCC 14 (2024) | the loop and SLP vectorizers enabled for RISC-V when the vector extension is on; -mrvv-max-lmul=; intrinsics v1.0; experimental vector crypto intrinsics; experimental -mrvv-vector-bits=zvl[14]
|
| LLVM 18 (2024) | the Zvbb…Zvkt vector crypto extensions raised to 1.0 and no longer experimental[7]
|
| Clang 18 (2024) | rvv_vector_bits(N) extended to the vbool*_t types[15]
|
The __riscv_ prefix is the change most likely to bite: code
written against the pre-Clang-16 headers calls vadd_vv_i32m1,
and the same code today needs __riscv_vadd_vv_i32m1. The
intrinsics repository carries compatibility headers for the move, under
auto-generated/rvv-v0p10-compatible-headers/.
Enabling the extension is an -march matter and nothing else:
-march=rv64gcv for the full V extension, or a subset such as
-march=rv64gc_zve32x. The subset string is not cosmetic — it
removes types and intrinsics, as the intrinsics specification's own example
shows: under rv64gc_zve32x neither vint64m1_t nor
__riscv_vle64_v_i64m1 exists.[3]
What this asks of a compiler
RVV is unusually demanding on a code generator, and the demands show up in compiler flags that a programmer tuning a kernel will meet.
Configuration is machine state, so placing vsetvli is a
dataflow problem. Every vector instruction executes under whatever
vtype and vl the last vset* left
behind. A compiler therefore has to track that state through the control flow
graph, insert the configuration changes a block needs, and remove the ones
whose effect is already in force — including across branches, where two
predecessors may arrive in different states. This is a pass of its own in a
production backend rather than a peephole, and in LLVM its intrinsics stopped
being modeled as side-effecting in release 17, precisely so the rest of the
optimizer could reason about them.[13]
LMUL is a cost model decision, not a free win. A larger LMUL does more
work per instruction and amortizes the loop overhead, but it consumes
registers in the same proportion: at LMUL=8 the 32 architectural registers
become four usable groups, and anything live across the loop body has nowhere
to go. GCC exposes this directly as -mrvv-max-lmul=, and its
default is m1 — the vectorizer will not use register groups
at all unless asked. The dynamic setting picks the bound from the
register pressure it measures.[14] Anyone comparing
auto-vectorized output against hand-written intrinsics should check this flag
before concluding anything.
Vector-length-agnostic versus vector-length-specific code. The portable
form of RVV code works for any VLEN, which means the element count is unknown
at compile time: the vector types are scalable, loop trip counts cannot be
constant-folded, and vectors cannot be placed in structs or globals. Both
compilers offer a way out for programs that will only ever run on one machine
— Clang's -mrvv-vector-bits= takes a power of two between 64
and 65536, GCC's takes zvl, meaning the bound the
-march string already implies — and an attribute,
riscv_rvv_vector_bits, that gives a scalable type a fixed size so
it can be stored in a struct or a global.[12][14]
The cost is the portability the extension was designed for: the binary now
assumes a vector length.
Register groups constrain allocation. A group of 2, 4 or 8 is named by its first register and must be aligned to its size, so an allocator cannot treat the 32 registers as interchangeable; it is allocating aligned tuples whose size depends on the LMUL of the operation using them.
The policy bits are a code generation choice. Tail-undisturbed and mask-undisturbed make the destination's previous value an input to the instruction, which creates a dependency an out-of-order core would rather not have. That is why the intrinsics default to agnostic and why the undisturbed variants take the old value as an explicit argument — the cost is visible in the signature.[3]
VLEN is not throughput. A cost model that reasons from the register width alone will mis-predict on hardware whose datapath is narrower, which is most of it: see the DLEN column in the table of measured silicon below, where a 1024-bit register file is processed 256 bits at a time.
Processors
Vector IP cores
These are the figures the IP vendors state on their own product pages. They describe what the IP can be configured to do, not what any particular chip was built with.
| Core | Vendor claim | VLEN / datapath | Data types |
|---|---|---|---|
| SiFive X280 (X200 series) | "supports RISC-V Vectors v1.0 (RVV 1.0)" | 512-bit VLEN, 256-bit DLEN, single vector ALU | INT8–INT64, BF16, FP16, FP32, FP64 |
| SiFive X390 (X300 series) | RVV 1.0 vector engine | 1024-bit VLEN, 512-bit DLEN, dual vector ALU | INT8–INT64, BF16, FP16, FP32, FP64 |
| SiFive P600 / P800 | RVA22 and RVA23 profiles | 2 × 128-bit vectors | not stated |
| Andes NX27V | "Support RISC-V V-extension spec.", no version given | configurable 128 / 256 / 512-bit VLEN, SIMD and memory width | int8–int64, fp16, fp32, fp64, plus bfloat16 and int4 |
| Andes AX45MPV | "RISC-V V-extension (RVV) 1.0 spec" | configurable VLEN and DLEN from 128 to 1024 bits, 1:1 or 2:1 | BF16 stated; integer widths not stated |
Sources: SiFive's X200, X300 and core-IP pages[16][17][18] and Andes' NX27V and AX45MPV pages.[19][20] Where a page gives no version number, the table says so rather than assuming 1.0.
Silicon that has been measured
A 2026 benchmarking study from Forschungszentrum Jülich compares five RVV 1.0 platforms, and its hardware table is the most useful published summary of what is actually buildable today. The figures below are the paper's.[21]
| SoC / core | Cores | VLEN | Datapath (DLEN) | Clock | Released |
|---|---|---|---|---|---|
| SpacemiT K1 / X60 | 8 | 256 bit | 256 bit | 1.6 GHz | 04/2024 |
| SpacemiT K3 / X100 | 8 | 256 bit | 256 bit | 2.2 GHz | 04/2026 |
| SpacemiT K3 / A100 | 8 | 1024 bit | 256 bit FP64, 512 bit FP32 | 1.8 GHz | 04/2026 |
| Sophon SG2044 / T-Head C920v2 | 64 | 128 bit | 256 bit | 2.6 GHz | 02/2025 |
| Tenstorrent Blackhole / SiFive X280 | 4 × 4 | 512 bit | 256 bit | 1.75 GHz | 04/2025 |
The paper states that all of these implement RVV 1.0, and that the extension "delivers significant performance improvements over scalar execution". It also reports that on the SpacemiT X60 and A100 the vector floating-point unit and the vector load/store unit appear to contend for the same port, so that code alternating loads and arithmetic is penalized — a microarchitectural property no data sheet mentions.[21]
Note the two columns that are not the same thing. VLEN is the architectural register width; DLEN is how much of it the hardware computes per cycle. The SpacemiT A100's 1024-bit registers are processed 256 bits at a time for FP64, so a single instruction occupies the unit for four cycles. A large VLEN is not by itself a large throughput.
XuanTie, and the 0.7.1 problem
A substantial amount of RISC-V hardware in circulation implements a pre-ratification draft of the vector extension, and RVV 1.0 binaries do not run on it.
T-Head's XuanTie cores carry an extension the vendor calls XTheadVector, and the vendor's own specification is unusually frank about it: it is "not a custom-extension, but a non-standard non-conforming extension", its encoding space overlaps the V extension's, and tools must refuse to enable both at once. Its instruction set overlaps the V extension version 0.7.1, with every instruction and CSR prefixed th..[22]
The specification lists its differences from RVV 1.0 directly. They are not subtle:[22]
- a different encoding of
vsetvl, and novsetivliat all - no
vtaorvma— the policy is fixed at tail-agnostic, mask-undisturbed - no fractional LMUL
- no whole-register move instructions
- no
vlm/vsmmask load and store - different load/store instructions, and different names for the indexed ones
- narrowing shifts and conversions take
vv/vx/visuffixes where 1.0 takeswv/wx/wi - the mask mode is sized by VLEN rather than by
vl - tighter register-overlap rules, and several instructions available only unmasked
The vendor names the cores it identifies: C906V, C920 and R920.[22] Detection is by mvendorid 0x5b7 with misa bit 21 set and mimpid zero. Note that the C920v2 in the table above is listed by the Jülich paper as an RVV 1.0 part, so the generation matters: the core name alone does not settle which vector extension you are facing.
For a programmer the practical consequences are that <riscv_vector.h> intrinsics do not apply, that the toolchain needs -march=…_xtheadvector rather than v, and that any kernel meant to run on both has to exist twice.
See also
References
- ↑ 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 The RISC-V Instruction Set Manual, unprivileged volume, vector chapter (
src/unpriv/vector-common.adoc,v-st-ext.adocand thezve*,zvfh*files) — github.com — https://github.com/riscv/riscv-isa-manual - ↑ 2.0 2.1 riscv-v-spec, the standalone working repository of the V extension, archived by its owner on 20 March 2024 and now read-only — github.com — https://github.com/riscvarchive/riscv-v-spec
- ↑ 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 RISC-V Vector C Intrinsics specification,
doc/rvv-intrinsic-spec.adoc— github.com — https://github.com/riscv-non-isa/rvv-intrinsic-doc - ↑ 4.0 4.1 Generated intrinsic function listings,
auto-generated/intrinsic_funcs/, counted per category — github.com — https://github.com/riscv-non-isa/rvv-intrinsic-doc - ↑ Tagged releases of the riscv-v-spec repository, with their publication dates — github.com — https://github.com/riscvarchive/riscv-v-spec/releases
- ↑ 6.0 6.1 README of the riscv-v-spec repository, as left at the archive — github.com — https://github.com/riscvarchive/riscv-v-spec/blob/master/README.md
- ↑ 7.0 7.1 LLVM 18.1.0 Release Notes, changes to the RISC-V backend — releases.llvm.org — https://releases.llvm.org/18.1.0/docs/ReleaseNotes.html
- ↑ 8.0 8.1 8.2 RISC-V ELF psABI specification,
riscv-cc.adoc, "Vector Register Convention" — github.com — https://github.com/riscv-non-isa/riscv-elf-psabi-doc - ↑ LLVM 14.0.0 Release Notes, changes to the RISC-V backend — releases.llvm.org — https://releases.llvm.org/14.0.0/docs/ReleaseNotes.html
- ↑ Clang 16.0.0 Release Notes, RISC-V Support — releases.llvm.org — https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html
- ↑ GCC 13 Release Series — Changes, New Features, and Fixes, RISC-V section — gcc.gnu.org — https://gcc.gnu.org/gcc-13/changes.html
- ↑ 12.0 12.1 Clang 17.0.1 Release Notes, RISC-V Support — releases.llvm.org — https://releases.llvm.org/17.0.1/tools/clang/docs/ReleaseNotes.html
- ↑ 13.0 13.1 LLVM 17.0.1 Release Notes, changes to the RISC-V backend — releases.llvm.org — https://releases.llvm.org/17.0.1/docs/ReleaseNotes.html
- ↑ 14.0 14.1 14.2 GCC 14 Release Series — Changes, New Features, and Fixes, RISC-V section — gcc.gnu.org — https://gcc.gnu.org/gcc-14/changes.html
- ↑ Clang 18.1.0 Release Notes, RISC-V Support — releases.llvm.org — https://releases.llvm.org/18.1.0/tools/clang/docs/ReleaseNotes.html
- ↑ SiFive Intelligence X200 Series — sifive.com — https://www.sifive.com/cores/intelligence-x280
- ↑ SiFive Intelligence X300 Series — sifive.com — https://www.sifive.com/cores/intelligence-x390
- ↑ SiFive RISC-V Core IP — sifive.com — https://www.sifive.com/risc-v-core-ip
- ↑ AndesCore NX27V — andestech.com — https://www.andestech.com/en/products-solutions/andescore-processors/riscv-nx27v/
- ↑ AndesCore AX45MPV — andestech.com — https://www.andestech.com/en/products-solutions/andescore-processors/riscv-ax45mpv/
- ↑ 21.0 21.1 Stepan Nassyr, Prateek Chawla, Daniel Seibel, Jayesh Badwaik, Kaveh Haghighi Mood, Andreas Herten (Jülich Supercomputing Centre), "Great Expectations: Benchmarking the Real-World Performance of RVV 1.0 in HPC", arXiv:2608.28097, 28 August 2026, Table 1 — arxiv.org — https://arxiv.org/abs/2608.28097
- ↑ 22.0 22.1 22.2 XuanTie's vector extension (XTheadVector), in the XuanTie RISC-V ISA extension specifications,
xtheadvector.adoc— github.com — https://github.com/XUANTIE-RV/thead-extension-spec