Skip to content

Commit 5ec3215

Browse files
authored
OpenBLAS: Source build fixes for RISC-V (#56556)
The OpenBLAS build system supports both setting a dynamic architecture, and selecting a fallback Also ensure we build a 64-bit library for RISCV64.
1 parent 55bdb54 commit 5ec3215

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Make.inc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ BOOTSTRAP_DEBUG_LEVEL ?= 0
2828
OPENBLAS_TARGET_ARCH:=
2929
OPENBLAS_SYMBOLSUFFIX:=
3030
OPENBLAS_LIBNAMESUFFIX:=
31-
32-
# If OPENBLAS_TARGET_ARCH is set, we default to disabling OPENBLAS_DYNAMIC_ARCH
33-
ifneq ($(OPENBLAS_TARGET_ARCH),)
3431
OPENBLAS_DYNAMIC_ARCH:=0
35-
else
36-
OPENBLAS_DYNAMIC_ARCH:=1
37-
endif
3832
OPENBLAS_USE_THREAD:=1
3933

4034
# Flags for using libraries available on the system instead of building them.
@@ -995,9 +989,15 @@ MTUNE=native
995989
endif
996990
endif
997991

992+
# If we are running on x86 or x86_64, set certain options automatically
993+
ifeq (1,$(ISX86))
994+
OPENBLAS_DYNAMIC_ARCH:=1
995+
endif
996+
998997
# If we are running on powerpc64le or ppc64le, set certain options automatically
999998
ifneq (,$(filter $(ARCH), powerpc64le ppc64le))
1000999
JCFLAGS += -fsigned-char
1000+
OPENBLAS_DYNAMIC_ARCH:=1
10011001
OPENBLAS_TARGET_ARCH:=POWER8
10021002
BINARY:=64
10031003
# GCC doesn't do -march= on ppc64le
@@ -1054,17 +1054,23 @@ endif
10541054
# If we are running on ARM, set certain options automatically
10551055
ifneq (,$(findstring arm,$(ARCH)))
10561056
JCFLAGS += -fsigned-char
1057-
OPENBLAS_DYNAMIC_ARCH:=0
10581057
OPENBLAS_TARGET_ARCH:=ARMV7
10591058
BINARY:=32
10601059
endif
10611060

10621061
# If we are running on aarch64 (e.g. ARMv8 or ARM64), set certain options automatically
10631062
ifneq (,$(findstring aarch64,$(ARCH)))
1063+
OPENBLAS_DYNAMIC_ARCH:=1
10641064
OPENBLAS_TARGET_ARCH:=ARMV8
10651065
BINARY:=64
10661066
endif
10671067

1068+
# If we are running on riscv64, set certain options automatically
1069+
ifneq (,$(findstring riscv64,$(ARCH)))
1070+
OPENBLAS_DYNAMIC_ARCH:=1
1071+
BINARY:=64
1072+
endif
1073+
10681074
# Set MARCH-specific flags
10691075
ifneq ($(MARCH),)
10701076
CC += -march=$(MARCH)

0 commit comments

Comments
 (0)