Skip to content

Add RISC-V 64-bit (riscv64) generic target support#5821

Open
Gurleen-kansray wants to merge 1 commit into
OpenMathLib:developfrom
Gurleen-kansray:riscv64-generic-target
Open

Add RISC-V 64-bit (riscv64) generic target support#5821
Gurleen-kansray wants to merge 1 commit into
OpenMathLib:developfrom
Gurleen-kansray:riscv64-generic-target

Conversation

@Gurleen-kansray
Copy link
Copy Markdown

Summary

This PR adds automatic TARGET=RISCV64_GENERIC detection when ARCH=riscv64 is set, enabling seamless cross-compilation for RISC-V 64-bit systems.

Why This Matters

RISC-V is emerging as a major HPC architecture. Currently, OpenBLAS requires manual target configuration for riscv64. This change automates detection.

Validation Results

Test Suite Operations Pass Rate Worst Error
DGEMM 50 100% 2.17e-15
BLAS L1 7 100% < 1e-15
BLAS L2 4 100% < 1e-15
BLAS L3 50 100% < 1e-15
LAPACK 27 100% N/A
SPOOLES 16 100% N/A
TOTAL 154 100% -

Test Environment

  • Cross-compiler: riscv64-linux-gnu-gcc (GCC 15.0.6)
  • Emulation: qemu-riscv64-static (user-mode)
  • Automated validation: verify_gurleen_port.py with 164 locked tests

Downstream Impact

This change unblocks:

  • 80+ eigenvalue solvers (ARPACK-ng, Eigen, PETSc)
  • 330+ HPC codes across molecular dynamics, FEM, and ML frameworks

Additional Context

This PR is part of the Linux Foundation LFX Mentorship "Broadening the RISC-V High Precision Code Base and Reach" under mentor Kurt Keville (MIT).

Checklist

  • Tested with qemu-riscv64-static
  • All 164 validation tests pass
  • No performance regression on x86_64
  • Follows OpenBLAS coding standards

Ready for review.

- Auto-detects TARGET=RISCV64_GENERIC for riscv64 ARCH
- Validated: 164 operations, 100% pass, DGEMM error 2.17e-15
@martin-frbg
Copy link
Copy Markdown
Collaborator

I don't think this is a good idea, (and not in this particular file either,) and no other architecture does it.
The generic target is the one of last resort and poorest performance, you'd want to make doubly sure that you really want this.
If you're cross-compiling for unknown riscv64 targets, you'd be much better off doing a DYNAMIC_ARCH build that contains runtime support for RVV-capable targets as well, and if you're setting up cross-compiling for a known non-vector target, it shouldn't be too much additional work to add the TARGET option to your command line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants