From b8949d1663f49a000baeb331b8d3188d3586b318 Mon Sep 17 00:00:00 2001 From: hmeiland Date: Thu, 9 Jul 2026 20:21:40 +0200 Subject: [PATCH] U74 target: build for the full JH7110 ISA (add Zba/Zbb) The StarFive JH7110's U74 cores implement rv64imafdc_..._zba_zbb, so the U74 target now compiles with -march=rv64imafdc_zba_zbb. The generic RISCV64_GENERIC target stays at bare rv64imafdc for portability across unknown RV64GC cores. Measured on the VisionFive 2 (GCC 13.3, -mtune=sifive-u74 held constant): GCC emits Zba shift-add instructions in the packing routines, but DGEMM is unchanged -- the 4x4 kernel holds 1.533 GF either way and packing 1.74 vs 1.75 GB/s. The 4x4 micro-kernel is FMA-bound (fused fmadd.d with immediate-offset loads) and packing is LPDDR4-bandwidth-bound, so integer address generation is not on the critical path. The flag is nonetheless the correct -march for the silicon, is free, and can only help address-gen-bound code elsewhere in the library. The remaining GEMM headroom on the U74 is microarchitectural scheduling (a hand-written assembly micro-kernel), not the ISA. --- Makefile.prebuild | 2 +- Makefile.riscv64 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.prebuild b/Makefile.prebuild index 94b47346f..6b2567cb9 100644 --- a/Makefile.prebuild +++ b/Makefile.prebuild @@ -76,7 +76,7 @@ TARGET_FLAGS = -march=rv64imafdc -mabi=lp64d endif ifeq ($(TARGET), U74) -TARGET_FLAGS = -march=rv64imafdc -mabi=lp64d +TARGET_FLAGS = -march=rv64imafdc_zba_zbb -mabi=lp64d endif all: getarch_2nd diff --git a/Makefile.riscv64 b/Makefile.riscv64 index eea7bc4c9..7ee92a46f 100644 --- a/Makefile.riscv64 +++ b/Makefile.riscv64 @@ -26,6 +26,6 @@ CCOMMON_OPT += -march=rv64imafdc -mabi=lp64d FCOMMON_OPT += -march=rv64imafdc -mabi=lp64d endif ifeq ($(CORE), U74) -CCOMMON_OPT += -march=rv64imafdc -mabi=lp64d -mtune=sifive-u74 -FCOMMON_OPT += -march=rv64imafdc -mabi=lp64d -mtune=sifive-u74 +CCOMMON_OPT += -march=rv64imafdc_zba_zbb -mabi=lp64d -mtune=sifive-u74 +FCOMMON_OPT += -march=rv64imafdc_zba_zbb -mabi=lp64d -mtune=sifive-u74 endif