The SiFive U74 (RV64GC; e.g. StarFive JH7110 / VisionFive 2) is a scalar,
in-order core with no RVV, so today it falls back to RISCV64_GENERIC whose
S/D GEMM uses the generic 2x2 C micro-kernel.
Per the U74 Core Complex Manual (Table 169) fmadd.d has a 7-cycle latency
at repeat rate 1 (fully pipelined). A 2x2 tile exposes only 4 independent
accumulator chains -- fewer than the FMA latency -- so the FP pipe stalls
on the accumulator dependency, and the 1:1 load:FMA ratio saturates the
single load/store pipe ("only one outstanding line fill", manual 8.2).
This adds a portable 4x4 GEMM micro-kernel and a dedicated U74 target:
- kernel/generic/gemmkernel_4x4.c: 16-accumulator 4x4 register tile. 16
independent chains exceed the 7-cycle latency, and the load:FMA ratio
drops to 1:2. 16 acc + 4 A + 4 B fit RV64G's 32 FP registers without
spilling. Full 4/2/1 edge handling in both M and N.
- U74 target wiring: getarch.c (FORCE_U74, 32 KiB/64 B L1D, 2 MiB L2),
param.h (S/D UNROLL 4/4; complex stays 2/2), kernel/riscv64/KERNEL.U74
(S/D GEMM -> gemmkernel_4x4 + gemm_[nt]copy_4; S/D TRMM -> existing
trmmkernel_4x4), Makefile.prebuild + Makefile.riscv64 (-mtune=sifive-u74),
TargetList.txt, cpuid_riscv64.c.
The 4x4 kernel was verified numerically against a naive reference GEMM,
driven through the real gemm_tcopy_4 / gemm_ncopy_4 packing routines,
across 27,436 M/N/K x alpha combinations covering every 4/2/1 tail case:
worst absolute error 0.
Build with: make TARGET=U74
161 lines
1.7 KiB
Plaintext
161 lines
1.7 KiB
Plaintext
Force Target Examples:
|
|
|
|
make TARGET=NEHALEM
|
|
make TARGET=LOONGSON3A BINARY=64
|
|
make TARGET=ISTANBUL
|
|
|
|
Supported List:
|
|
1.X86/X86_64
|
|
a)Intel CPU:
|
|
P2
|
|
KATMAI
|
|
COPPERMINE
|
|
NORTHWOOD
|
|
PRESCOTT
|
|
BANIAS
|
|
YONAH
|
|
CORE2
|
|
PENRYN
|
|
DUNNINGTON
|
|
NEHALEM
|
|
SANDYBRIDGE
|
|
HASWELL
|
|
SKYLAKEX
|
|
ATOM
|
|
COOPERLAKE
|
|
SAPPHIRERAPIDS
|
|
|
|
b)AMD CPU:
|
|
ATHLON
|
|
OPTERON
|
|
OPTERON_SSE3
|
|
BARCELONA
|
|
SHANGHAI
|
|
ISTANBUL
|
|
BOBCAT
|
|
BULLDOZER
|
|
PILEDRIVER
|
|
STEAMROLLER
|
|
EXCAVATOR
|
|
ZEN
|
|
|
|
c)VIA CPU:
|
|
SSE_GENERIC
|
|
VIAC3
|
|
NANO
|
|
|
|
2.Power CPU:
|
|
POWER4
|
|
POWER5
|
|
POWER6
|
|
POWER7
|
|
POWER8
|
|
POWER9
|
|
POWER10
|
|
POWER11
|
|
PPCG4
|
|
PPC970
|
|
PPC970MP
|
|
PPC440
|
|
PPC440FP2
|
|
CELL
|
|
|
|
3.MIPS CPU:
|
|
P5600
|
|
MIPS1004K
|
|
MIPS24K
|
|
|
|
4.MIPS64 CPU:
|
|
MIPS64_GENERIC
|
|
SICORTEX
|
|
LOONGSON3A
|
|
LOONGSON3B
|
|
I6400
|
|
P6600
|
|
I6500
|
|
|
|
5.IA64 CPU:
|
|
ITANIUM2
|
|
|
|
6.SPARC CPU:
|
|
SPARC
|
|
SPARCV7
|
|
|
|
7.ARM CPU:
|
|
CORTEXA15
|
|
CORTEXA9
|
|
ARMV7
|
|
ARMV6
|
|
ARMV5
|
|
|
|
8.ARM 64-bit CPU:
|
|
ARMV8
|
|
CORTEXA53
|
|
CORTEXA57
|
|
CORTEXA72
|
|
CORTEXA73
|
|
CORTEXA76
|
|
CORTEXA510
|
|
CORTEXA710
|
|
CORTEXX1
|
|
CORTEXX2
|
|
NEOVERSEN1
|
|
NEOVERSEV1
|
|
NEOVERSEN2
|
|
NEOVERSEV2
|
|
CORTEXA55
|
|
EMAG8180
|
|
FALKOR
|
|
THUNDERX
|
|
THUNDERX2T99
|
|
TSV110
|
|
THUNDERX3T110
|
|
VORTEX
|
|
VORTEXM4
|
|
A64FX
|
|
ARMV8SVE
|
|
ARMV9SME
|
|
FT2000
|
|
|
|
9.System Z:
|
|
ZARCH_GENERIC
|
|
Z13
|
|
Z14
|
|
|
|
10.RISC-V 64:
|
|
RISCV64_GENERIC (e.g. PolarFire Soc/SiFive U54)
|
|
RISCV64_ZVL128B
|
|
C910V
|
|
x280
|
|
RISCV64_ZVL256B
|
|
U74 (e.g. SiFive U74 / StarFive JH7110 / VisionFive 2)
|
|
|
|
11.LOONGARCH64:
|
|
// LOONGSONGENERIC/LOONGSON2K1000/LOONGSON3R5 are legacy names,
|
|
// and it is recommended to use the more standardized naming conventions
|
|
// LA64_GENERIC/LA264/LA464. You can still specify TARGET as
|
|
// LOONGSONGENERIC/LOONGSON2K1000/LOONGSON3R5 during compilation or runtime,
|
|
// and they will be internally relocated to LA64_GENERIC/LA264/LA464.
|
|
LOONGSONGENERIC
|
|
LOONGSON2K1000
|
|
LOONGSON3R5
|
|
LA64_GENERIC
|
|
LA264
|
|
LA464
|
|
|
|
12. Elbrus E2000:
|
|
E2K
|
|
|
|
13. Alpha
|
|
EV4
|
|
EV5
|
|
EV6
|
|
|
|
14.CSKY
|
|
CSKY
|
|
CK860FV
|
|
|
|
15. WebAssembly/Emscripten:
|
|
WASM128_GENERIC
|
|
|