Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ CMakeCache.txt
CMakeFiles/*
.vscode
**/__pycache__
dyn_cores.h
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ clean ::
ifeq ($(OSNAME), Darwin)
@rm -rf getarch.dSYM getarch_2nd.dSYM
endif
@rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
@rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h dyn_cores.h st* *.dylib
@rm -f cblas.tmp cblas.tmp2
@touch $(NETLIB_LAPACK_DIR)/make.inc
@$(MAKE) -C $(NETLIB_LAPACK_DIR) clean
Expand Down
12 changes: 12 additions & 0 deletions Makefile.system
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,15 @@ override DYNAMIC_ARCH=
endif
endif

# dyn_cores.h tells common_param.h which cores this DYNAMIC_ARCH build has.
ifeq ($(DYNAMIC_ARCH), 1)
ifndef OPENBLAS_DYN_CORES
export OPENBLAS_DYN_CORES := $(sort $(DYNAMIC_CORE))
HASH := \#
DUMMY := $(shell echo '$(HASH)define OPENBLAS_CORE_LIST(X, arg) $(foreach c,$(OPENBLAS_DYN_CORES),X($(c), arg))' > $(TOPDIR)/dyn_cores.h)
endif
endif

ifeq ($(ARCH), ia64)
NO_BINARY_MODE = 1
BINARY_DEFINED = 1
Expand Down Expand Up @@ -1484,6 +1493,9 @@ endif

ifeq ($(DYNAMIC_ARCH), 1)
CCOMMON_OPT += -DDYNAMIC_ARCH
ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC LSB CLANG INTEL))
CCOMMON_OPT += -ffunction-sections -fdata-sections
endif
endif

ifeq ($(DYNAMIC_OLDER), 1)
Expand Down
17 changes: 17 additions & 0 deletions cmake/arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,26 @@ if (DYNAMIC_ARCH)
message (FATAL_ERROR "Your build directory contains a file config_kernel.h, probably from a previous compilation with make. This will conflict with the cmake compilation and cause strange compiler errors - please remove the file before trying again")
endif ()

if (EXISTS ${PROJECT_SOURCE_DIR}/dyn_cores.h)
message (FATAL_ERROR "Your source directory contains a file dyn_cores.h, probably from a previous compilation with make. It would be used instead of the one generated for this build - please remove the file before trying again")
endif ()

if (NOT DYNAMIC_CORE)
message (STATUS "DYNAMIC_ARCH is not supported on this architecture, removing from options")
unset(DYNAMIC_ARCH CACHE)
else ()
# dyn_cores.h tells common_param.h which cores this build has;
# see the equivalent rule in Makefile.system.
set(DYN_CORES_LIST ${DYNAMIC_CORE})
list(REMOVE_DUPLICATES DYN_CORES_LIST)
list(SORT DYN_CORES_LIST)
set(DYN_CORES_H "#define OPENBLAS_CORE_LIST(X, arg)")
foreach (DCORE ${DYN_CORES_LIST})
string(APPEND DYN_CORES_H " X(${DCORE}, arg)")
endforeach ()
file(WRITE ${PROJECT_BINARY_DIR}/dyn_cores.h.tmp "${DYN_CORES_H}\n")
configure_file(${PROJECT_BINARY_DIR}/dyn_cores.h.tmp ${PROJECT_BINARY_DIR}/dyn_cores.h COPYONLY)
file(REMOVE ${PROJECT_BINARY_DIR}/dyn_cores.h.tmp)
endif ()
endif ()

Expand Down
3 changes: 3 additions & 0 deletions cmake/system.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ endif ()
if (DYNAMIC_ARCH)
if (X86 OR X86_64 OR ARM64 OR POWER OR RISCV64 OR LOONGARCH64 OR ZARCH)
set(CCOMMON_OPT "${CCOMMON_OPT} -DDYNAMIC_ARCH")
if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|Intel" AND NOT MSVC)
set(CCOMMON_OPT "${CCOMMON_OPT} -ffunction-sections -fdata-sections")
endif ()
if (DYNAMIC_OLDER)
set(CCOMMON_OPT "${CCOMMON_OPT} -DDYNAMIC_OLDER")
endif ()
Expand Down
18 changes: 9 additions & 9 deletions common_b.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@
#define BGEMM_KERNEL bgemm_kernel

#else
#define BGEMV_N_K gotoblas->bgemv_n
#define BGEMV_T_K gotoblas->bgemv_t
#define BGEMV_N_K OPENBLAS_DISPATCH(bgemv)->bgemv_n
#define BGEMV_T_K OPENBLAS_DISPATCH(bgemv)->bgemv_t

#define BSCAL_K gotoblas->bscal_k
#define BSCAL_K OPENBLAS_DISPATCH(bscal)->bscal_k

#define BGEMM_ONCOPY gotoblas->bgemm_oncopy
#define BGEMM_OTCOPY gotoblas->bgemm_otcopy
#define BGEMM_INCOPY gotoblas->bgemm_incopy
#define BGEMM_ITCOPY gotoblas->bgemm_itcopy
#define BGEMM_BETA gotoblas->bgemm_beta
#define BGEMM_KERNEL gotoblas->bgemm_kernel
#define BGEMM_ONCOPY OPENBLAS_DISPATCH(bgemm)->bgemm_oncopy
#define BGEMM_OTCOPY OPENBLAS_DISPATCH(bgemm)->bgemm_otcopy
#define BGEMM_INCOPY OPENBLAS_DISPATCH(bgemm)->bgemm_incopy
#define BGEMM_ITCOPY OPENBLAS_DISPATCH(bgemm)->bgemm_itcopy
#define BGEMM_BETA OPENBLAS_DISPATCH(bgemm)->bgemm_beta
#define BGEMM_KERNEL OPENBLAS_DISPATCH(bgemm)->bgemm_kernel

#endif

Expand Down
Loading
Loading