diff --git a/O/OpenBLAS/OpenBLAS32@0.3.31/build_tarballs.jl b/O/OpenBLAS/OpenBLAS32@0.3.31/build_tarballs.jl new file mode 100644 index 00000000000..364f88f4344 --- /dev/null +++ b/O/OpenBLAS/OpenBLAS32@0.3.31/build_tarballs.jl @@ -0,0 +1,43 @@ +using BinaryBuilder +using BinaryBuilderBase + +include("../common.jl") + +# Collection of sources required to build OpenBLAS +name = "OpenBLAS32" +version = v"0.3.31" + +sources = openblas_sources(version) +script = openblas_script(openblas32=true, bfloat16=true, float16=true) +platforms = openblas_platforms(; version) +products = openblas_products() +preferred_gcc_version = v"12" +preferred_llvm_version = v"18.1.7" +dependencies = openblas_dependencies(platforms; llvm_compilerrt_version=preferred_llvm_version) + +# Do we build all platforms, or those specified as arguments? +platform_args = filter(arg -> !startswith(arg, "--"), ARGS) +if !isempty(platform_args) + @assert length(platform_args) == 1 + platforms = BinaryBuilderBase.parse_platform.(split(platform_args[1], ",")) +end + +riscv64_preferred_gcc_version = v"15" + +# The regular options, excluding the list of platforms +option_args = filter(arg -> startswith(arg, "--"), ARGS) +non_register_option_args = filter(arg -> arg != "--register", option_args) + +for (n,platform) in enumerate(platforms) + # We register the build products only after the last build. + args = n == length(platforms) ? option_args : non_register_option_args + + build_tarballs(args, name, version, sources, script, [platform], products, dependencies; + julia_compat="1.11", + lock_microarchitecture=false, + preferred_gcc_version = arch(platform) == "riscv64" ? riscv64_preferred_gcc_version : preferred_gcc_version, + preferred_llvm_version=preferred_llvm_version, + ) +end + +# Build trigger: 2 diff --git a/O/OpenBLAS/OpenBLAS32@0.3.31/bundled/patches/10-dynamic-riscv64.patch b/O/OpenBLAS/OpenBLAS32@0.3.31/bundled/patches/10-dynamic-riscv64.patch new file mode 100644 index 00000000000..071b421ebe5 --- /dev/null +++ b/O/OpenBLAS/OpenBLAS32@0.3.31/bundled/patches/10-dynamic-riscv64.patch @@ -0,0 +1,21 @@ +diff --git a/driver/others/dynamic_riscv64.c b/driver/others/dynamic_riscv64.c +index 726f76d79..919663b22 100644 +--- a/driver/others/dynamic_riscv64.c ++++ b/driver/others/dynamic_riscv64.c +@@ -99,7 +99,7 @@ struct riscv_hwprobe { + #define RISCV_HWPROBE_IMA_V (1 << 2) + #define RISCV_HWPROBE_EXT_ZFH (1 << 27) + #define RISCV_HWPROBE_EXT_ZVFH (1 << 30) +-#define RISCV_HWPROBE_EXT_ZVFBFWMA (1 << 54) ++#define RISCV_HWPROBE_EXT_ZVFBFWMA (1ULL << 54) + + #ifndef NR_riscv_hwprobe + #ifndef NR_arch_specific_syscall +@@ -152,6 +152,7 @@ char* gotoblas_corename(void) { + static gotoblas_t* get_coretype(void) { + uint64_t vector_mask; + unsigned vlenb = 0; ++ char coremsg[128]; + + #if !defined(OS_LINUX) + return NULL; diff --git a/O/OpenBLAS/OpenBLAS32@0.3.31/bundled/patches/50-openblas-winexit.patch b/O/OpenBLAS/OpenBLAS32@0.3.31/bundled/patches/50-openblas-winexit.patch new file mode 100644 index 00000000000..33389f34a40 --- /dev/null +++ b/O/OpenBLAS/OpenBLAS32@0.3.31/bundled/patches/50-openblas-winexit.patch @@ -0,0 +1,170 @@ +diff --git a/driver/others/memory.c b/driver/others/memory.c +index 6e654ccf..1d2f9f12 100644 +--- a/driver/others/memory.c ++++ b/driver/others/memory.c +@@ -1534,7 +1534,7 @@ void CONSTRUCTOR gotoblas_init(void) { + + } + +-void DESTRUCTOR gotoblas_quit(void) { ++void gotoblas_quit(void) { + + if (gotoblas_initialized == 0) return; + +@@ -1572,75 +1572,11 @@ void DESTRUCTOR gotoblas_quit(void) { + } + + #if defined(_MSC_VER) && !defined(__clang__) +-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +-{ +- switch (ul_reason_for_call) +- { +- case DLL_PROCESS_ATTACH: +- gotoblas_init(); +- break; +- case DLL_THREAD_ATTACH: +- break; +- case DLL_THREAD_DETACH: +-#if defined(SMP) +- blas_thread_memory_cleanup(); +-#endif +- break; +- case DLL_PROCESS_DETACH: +- gotoblas_quit(); +- break; +- default: +- break; +- } +- return TRUE; +-} +- +-/* +- This is to allow static linking. +- Code adapted from Google performance tools: +- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc +- Reference: +- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html +- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp +-*/ +-static int on_process_term(void) +-{ +- gotoblas_quit(); +- return 0; +-} + #ifdef _WIN64 + #pragma comment(linker, "/INCLUDE:_tls_used") + #else + #pragma comment(linker, "/INCLUDE:__tls_used") + #endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XLB") +-#else +-#pragma data_seg(".CRT$XLB") +-#endif +- +-#ifdef _WIN64 +-static const PIMAGE_TLS_CALLBACK dll_callback(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#pragma const_seg() +-#else +-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#pragma data_seg() +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XTU") +-#else +-#pragma data_seg(".CRT$XTU") +-#endif +- +-#ifdef _WIN64 +-static const int(*p_process_term)(void) = on_process_term; +-#pragma const_seg() +-#else +-static int(*p_process_term)(void) = on_process_term; +-#pragma data_seg() +-#endif + #endif + + #if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64)) +@@ -3146,7 +3082,7 @@ void CONSTRUCTOR gotoblas_init(void) { + + } + +-void DESTRUCTOR gotoblas_quit(void) { ++void gotoblas_quit(void) { + + if (gotoblas_initialized == 0) return; + +@@ -3175,71 +3111,6 @@ void DESTRUCTOR gotoblas_quit(void) { + #endif + } + +-#if defined(_MSC_VER) && !defined(__clang__) +-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +-{ +- switch (ul_reason_for_call) +- { +- case DLL_PROCESS_ATTACH: +- gotoblas_init(); +- break; +- case DLL_THREAD_ATTACH: +- break; +- case DLL_THREAD_DETACH: +- break; +- case DLL_PROCESS_DETACH: +- gotoblas_quit(); +- break; +- default: +- break; +- } +- return TRUE; +-} +- +-/* +- This is to allow static linking. +- Code adapted from Google performance tools: +- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc +- Reference: +- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html +- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp +-*/ +-static int on_process_term(void) +-{ +- gotoblas_quit(); +- return 0; +-} +-#ifdef _WIN64 +-#pragma comment(linker, "/INCLUDE:_tls_used") +-#else +-#pragma comment(linker, "/INCLUDE:__tls_used") +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XLB") +-#else +-#pragma data_seg(".CRT$XLB") +-#endif +-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#ifdef _WIN64 +-#pragma const_seg() +-#else +-#pragma data_seg() +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XTU") +-#else +-#pragma data_seg(".CRT$XTU") +-#endif +-static int(*p_process_term)(void) = on_process_term; +-#ifdef _WIN64 +-#pragma const_seg() +-#else +-#pragma data_seg() +-#endif +-#endif +- + #if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64)) + /* Don't call me; this is just work around for PGI / Sun bug */ + void gotoblas_dummy_for_PGI(void) { diff --git a/O/OpenBLAS/OpenBLAS@0.3.31/build_tarballs.jl b/O/OpenBLAS/OpenBLAS@0.3.31/build_tarballs.jl new file mode 100644 index 00000000000..45b79f757c6 --- /dev/null +++ b/O/OpenBLAS/OpenBLAS@0.3.31/build_tarballs.jl @@ -0,0 +1,52 @@ +using BinaryBuilder +using BinaryBuilderBase + +include("../common.jl") + +# Collection of sources required to build OpenBLAS +name = "OpenBLAS" +version = v"0.3.31" + +sources = openblas_sources(version) +script = openblas_script(; aarch64_ilp64=true, num_64bit_threads=512, bfloat16=true) +platforms = openblas_platforms(; version) +# Note: The msan build doesn't use gfortran, and we thus don't expand the gfortran versions +push!(platforms, Platform("x86_64", "linux"; sanitize="memory")) +products = openblas_products() +preferred_gcc_version = v"12" +preferred_llvm_version = v"18.1.7" +dependencies = openblas_dependencies(platforms; llvm_compilerrt_version=preferred_llvm_version) + +# Everything below is necessary only because we need to build msan platforms with a different LLVM version. +# We can only build msan platforms with LLVM 13, but we need to build non-msan builds with LLVM 17 to get bfloat16 support. +# +# For the love of god, can someone PLEASE just build msan support for a modern LLVM? + +# Do we build all platforms, or those specified as arguments? +platform_args = filter(arg -> !startswith(arg, "--"), ARGS) +if !isempty(platform_args) + @assert length(platform_args) == 1 + platforms = BinaryBuilderBase.parse_platform.(split(platform_args[1], ",")) +end + +riscv64_preferred_gcc_version = v"15" +msan_preferred_llvm_version = v"13.0.1+0" +msan_dependencies = openblas_dependencies(platforms; llvm_compilerrt_version=msan_preferred_llvm_version) + +# The regular options, excluding the list of platforms +option_args = filter(arg -> startswith(arg, "--"), ARGS) +non_register_option_args = filter(arg -> arg != "--register", option_args) + +for (n,platform) in enumerate(platforms) + # We register the build products only after the last build. + args = n == length(platforms) ? option_args : non_register_option_args + + deps = sanitize(platform) == "memory" ? msan_dependencies : dependencies + pref_gcc = arch(platform) == "riscv64" ? riscv64_preferred_gcc_version : preferred_gcc_version + pref_llvm = sanitize(platform) == "memory" ? msan_preferred_llvm_version : preferred_llvm_version + + build_tarballs(args, name, version, sources, script, [platform], products, deps; + julia_compat="1.11", lock_microarchitecture=false, preferred_gcc_version=pref_gcc, preferred_llvm_version=pref_llvm) +end + +# Build trigger: 2 diff --git a/O/OpenBLAS/OpenBLAS@0.3.31/bundled/patches/10-dynamic-riscv64.patch b/O/OpenBLAS/OpenBLAS@0.3.31/bundled/patches/10-dynamic-riscv64.patch new file mode 100644 index 00000000000..071b421ebe5 --- /dev/null +++ b/O/OpenBLAS/OpenBLAS@0.3.31/bundled/patches/10-dynamic-riscv64.patch @@ -0,0 +1,21 @@ +diff --git a/driver/others/dynamic_riscv64.c b/driver/others/dynamic_riscv64.c +index 726f76d79..919663b22 100644 +--- a/driver/others/dynamic_riscv64.c ++++ b/driver/others/dynamic_riscv64.c +@@ -99,7 +99,7 @@ struct riscv_hwprobe { + #define RISCV_HWPROBE_IMA_V (1 << 2) + #define RISCV_HWPROBE_EXT_ZFH (1 << 27) + #define RISCV_HWPROBE_EXT_ZVFH (1 << 30) +-#define RISCV_HWPROBE_EXT_ZVFBFWMA (1 << 54) ++#define RISCV_HWPROBE_EXT_ZVFBFWMA (1ULL << 54) + + #ifndef NR_riscv_hwprobe + #ifndef NR_arch_specific_syscall +@@ -152,6 +152,7 @@ char* gotoblas_corename(void) { + static gotoblas_t* get_coretype(void) { + uint64_t vector_mask; + unsigned vlenb = 0; ++ char coremsg[128]; + + #if !defined(OS_LINUX) + return NULL; diff --git a/O/OpenBLAS/OpenBLAS@0.3.31/bundled/patches/50-openblas-winexit.patch b/O/OpenBLAS/OpenBLAS@0.3.31/bundled/patches/50-openblas-winexit.patch new file mode 100644 index 00000000000..33389f34a40 --- /dev/null +++ b/O/OpenBLAS/OpenBLAS@0.3.31/bundled/patches/50-openblas-winexit.patch @@ -0,0 +1,170 @@ +diff --git a/driver/others/memory.c b/driver/others/memory.c +index 6e654ccf..1d2f9f12 100644 +--- a/driver/others/memory.c ++++ b/driver/others/memory.c +@@ -1534,7 +1534,7 @@ void CONSTRUCTOR gotoblas_init(void) { + + } + +-void DESTRUCTOR gotoblas_quit(void) { ++void gotoblas_quit(void) { + + if (gotoblas_initialized == 0) return; + +@@ -1572,75 +1572,11 @@ void DESTRUCTOR gotoblas_quit(void) { + } + + #if defined(_MSC_VER) && !defined(__clang__) +-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +-{ +- switch (ul_reason_for_call) +- { +- case DLL_PROCESS_ATTACH: +- gotoblas_init(); +- break; +- case DLL_THREAD_ATTACH: +- break; +- case DLL_THREAD_DETACH: +-#if defined(SMP) +- blas_thread_memory_cleanup(); +-#endif +- break; +- case DLL_PROCESS_DETACH: +- gotoblas_quit(); +- break; +- default: +- break; +- } +- return TRUE; +-} +- +-/* +- This is to allow static linking. +- Code adapted from Google performance tools: +- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc +- Reference: +- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html +- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp +-*/ +-static int on_process_term(void) +-{ +- gotoblas_quit(); +- return 0; +-} + #ifdef _WIN64 + #pragma comment(linker, "/INCLUDE:_tls_used") + #else + #pragma comment(linker, "/INCLUDE:__tls_used") + #endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XLB") +-#else +-#pragma data_seg(".CRT$XLB") +-#endif +- +-#ifdef _WIN64 +-static const PIMAGE_TLS_CALLBACK dll_callback(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#pragma const_seg() +-#else +-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#pragma data_seg() +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XTU") +-#else +-#pragma data_seg(".CRT$XTU") +-#endif +- +-#ifdef _WIN64 +-static const int(*p_process_term)(void) = on_process_term; +-#pragma const_seg() +-#else +-static int(*p_process_term)(void) = on_process_term; +-#pragma data_seg() +-#endif + #endif + + #if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64)) +@@ -3146,7 +3082,7 @@ void CONSTRUCTOR gotoblas_init(void) { + + } + +-void DESTRUCTOR gotoblas_quit(void) { ++void gotoblas_quit(void) { + + if (gotoblas_initialized == 0) return; + +@@ -3175,71 +3111,6 @@ void DESTRUCTOR gotoblas_quit(void) { + #endif + } + +-#if defined(_MSC_VER) && !defined(__clang__) +-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +-{ +- switch (ul_reason_for_call) +- { +- case DLL_PROCESS_ATTACH: +- gotoblas_init(); +- break; +- case DLL_THREAD_ATTACH: +- break; +- case DLL_THREAD_DETACH: +- break; +- case DLL_PROCESS_DETACH: +- gotoblas_quit(); +- break; +- default: +- break; +- } +- return TRUE; +-} +- +-/* +- This is to allow static linking. +- Code adapted from Google performance tools: +- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc +- Reference: +- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html +- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp +-*/ +-static int on_process_term(void) +-{ +- gotoblas_quit(); +- return 0; +-} +-#ifdef _WIN64 +-#pragma comment(linker, "/INCLUDE:_tls_used") +-#else +-#pragma comment(linker, "/INCLUDE:__tls_used") +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XLB") +-#else +-#pragma data_seg(".CRT$XLB") +-#endif +-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#ifdef _WIN64 +-#pragma const_seg() +-#else +-#pragma data_seg() +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XTU") +-#else +-#pragma data_seg(".CRT$XTU") +-#endif +-static int(*p_process_term)(void) = on_process_term; +-#ifdef _WIN64 +-#pragma const_seg() +-#else +-#pragma data_seg() +-#endif +-#endif +- + #if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64)) + /* Don't call me; this is just work around for PGI / Sun bug */ + void gotoblas_dummy_for_PGI(void) { diff --git a/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/build_tarballs.jl b/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/build_tarballs.jl new file mode 100644 index 00000000000..cece982838c --- /dev/null +++ b/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/build_tarballs.jl @@ -0,0 +1,36 @@ +using BinaryBuilder +using BinaryBuilderBase + +include("../common.jl") + +# Collection of sources required to build OpenBLAS +name = "OpenBLASConsistentFPCSR" +version = v"0.3.31" + +sources = openblas_sources(version) +script = openblas_script(; aarch64_ilp64=true, num_64bit_threads=512, bfloat16=true, consistent_fpcsr=true) +platforms = expand_gfortran_versions(supported_platforms(; exclude=p -> !(arch(p) in ("x86_64", "aarch64")))) +products = openblas_products() +preferred_gcc_version = v"12" +preferred_llvm_version = v"18.1.7" +dependencies = openblas_dependencies(platforms; llvm_compilerrt_version=preferred_llvm_version) + +riscv64_preferred_gcc_version = v"15" + +# The regular options, excluding the list of platforms +option_args = filter(arg -> startswith(arg, "--"), ARGS) +non_register_option_args = filter(arg -> arg != "--register", option_args) + +for (n,platform) in enumerate(platforms) + # We register the build products only after the last build. + args = n == length(platforms) ? option_args : non_register_option_args + + build_tarballs(args, name, version, sources, script, [platform], products, dependencies; + julia_compat="1.11", + lock_microarchitecture=false, + preferred_gcc_version = arch(platform) == "riscv64" ? riscv64_preferred_gcc_version : preferred_gcc_version, + preferred_llvm_version=preferred_llvm_version, + ) +end + +# Build trigger: 2 diff --git a/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/bundled/patches/10-dynamic-riscv64.patch b/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/bundled/patches/10-dynamic-riscv64.patch new file mode 100644 index 00000000000..071b421ebe5 --- /dev/null +++ b/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/bundled/patches/10-dynamic-riscv64.patch @@ -0,0 +1,21 @@ +diff --git a/driver/others/dynamic_riscv64.c b/driver/others/dynamic_riscv64.c +index 726f76d79..919663b22 100644 +--- a/driver/others/dynamic_riscv64.c ++++ b/driver/others/dynamic_riscv64.c +@@ -99,7 +99,7 @@ struct riscv_hwprobe { + #define RISCV_HWPROBE_IMA_V (1 << 2) + #define RISCV_HWPROBE_EXT_ZFH (1 << 27) + #define RISCV_HWPROBE_EXT_ZVFH (1 << 30) +-#define RISCV_HWPROBE_EXT_ZVFBFWMA (1 << 54) ++#define RISCV_HWPROBE_EXT_ZVFBFWMA (1ULL << 54) + + #ifndef NR_riscv_hwprobe + #ifndef NR_arch_specific_syscall +@@ -152,6 +152,7 @@ char* gotoblas_corename(void) { + static gotoblas_t* get_coretype(void) { + uint64_t vector_mask; + unsigned vlenb = 0; ++ char coremsg[128]; + + #if !defined(OS_LINUX) + return NULL; diff --git a/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/bundled/patches/50-openblas-winexit.patch b/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/bundled/patches/50-openblas-winexit.patch new file mode 100644 index 00000000000..33389f34a40 --- /dev/null +++ b/O/OpenBLAS/OpenBLASConsistentFPCSR@0.3.31/bundled/patches/50-openblas-winexit.patch @@ -0,0 +1,170 @@ +diff --git a/driver/others/memory.c b/driver/others/memory.c +index 6e654ccf..1d2f9f12 100644 +--- a/driver/others/memory.c ++++ b/driver/others/memory.c +@@ -1534,7 +1534,7 @@ void CONSTRUCTOR gotoblas_init(void) { + + } + +-void DESTRUCTOR gotoblas_quit(void) { ++void gotoblas_quit(void) { + + if (gotoblas_initialized == 0) return; + +@@ -1572,75 +1572,11 @@ void DESTRUCTOR gotoblas_quit(void) { + } + + #if defined(_MSC_VER) && !defined(__clang__) +-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +-{ +- switch (ul_reason_for_call) +- { +- case DLL_PROCESS_ATTACH: +- gotoblas_init(); +- break; +- case DLL_THREAD_ATTACH: +- break; +- case DLL_THREAD_DETACH: +-#if defined(SMP) +- blas_thread_memory_cleanup(); +-#endif +- break; +- case DLL_PROCESS_DETACH: +- gotoblas_quit(); +- break; +- default: +- break; +- } +- return TRUE; +-} +- +-/* +- This is to allow static linking. +- Code adapted from Google performance tools: +- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc +- Reference: +- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html +- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp +-*/ +-static int on_process_term(void) +-{ +- gotoblas_quit(); +- return 0; +-} + #ifdef _WIN64 + #pragma comment(linker, "/INCLUDE:_tls_used") + #else + #pragma comment(linker, "/INCLUDE:__tls_used") + #endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XLB") +-#else +-#pragma data_seg(".CRT$XLB") +-#endif +- +-#ifdef _WIN64 +-static const PIMAGE_TLS_CALLBACK dll_callback(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#pragma const_seg() +-#else +-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#pragma data_seg() +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XTU") +-#else +-#pragma data_seg(".CRT$XTU") +-#endif +- +-#ifdef _WIN64 +-static const int(*p_process_term)(void) = on_process_term; +-#pragma const_seg() +-#else +-static int(*p_process_term)(void) = on_process_term; +-#pragma data_seg() +-#endif + #endif + + #if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64)) +@@ -3146,7 +3082,7 @@ void CONSTRUCTOR gotoblas_init(void) { + + } + +-void DESTRUCTOR gotoblas_quit(void) { ++void gotoblas_quit(void) { + + if (gotoblas_initialized == 0) return; + +@@ -3175,71 +3111,6 @@ void DESTRUCTOR gotoblas_quit(void) { + #endif + } + +-#if defined(_MSC_VER) && !defined(__clang__) +-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +-{ +- switch (ul_reason_for_call) +- { +- case DLL_PROCESS_ATTACH: +- gotoblas_init(); +- break; +- case DLL_THREAD_ATTACH: +- break; +- case DLL_THREAD_DETACH: +- break; +- case DLL_PROCESS_DETACH: +- gotoblas_quit(); +- break; +- default: +- break; +- } +- return TRUE; +-} +- +-/* +- This is to allow static linking. +- Code adapted from Google performance tools: +- https://gperftools.googlecode.com/git-history/perftools-1.0/src/windows/port.cc +- Reference: +- https://sourceware.org/ml/pthreads-win32/2008/msg00028.html +- http://ci.boost.org/svn-trac/browser/trunk/libs/thread/src/win32/tss_pe.cpp +-*/ +-static int on_process_term(void) +-{ +- gotoblas_quit(); +- return 0; +-} +-#ifdef _WIN64 +-#pragma comment(linker, "/INCLUDE:_tls_used") +-#else +-#pragma comment(linker, "/INCLUDE:__tls_used") +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XLB") +-#else +-#pragma data_seg(".CRT$XLB") +-#endif +-static void (APIENTRY *dll_callback)(HINSTANCE h, DWORD ul_reason_for_call, PVOID pv) = DllMain; +-#ifdef _WIN64 +-#pragma const_seg() +-#else +-#pragma data_seg() +-#endif +- +-#ifdef _WIN64 +-#pragma const_seg(".CRT$XTU") +-#else +-#pragma data_seg(".CRT$XTU") +-#endif +-static int(*p_process_term)(void) = on_process_term; +-#ifdef _WIN64 +-#pragma const_seg() +-#else +-#pragma data_seg() +-#endif +-#endif +- + #if (defined(C_PGI) || (!defined(C_SUN) && defined(F_INTERFACE_SUN))) && (defined(ARCH_X86) || defined(ARCH_X86_64)) + /* Don't call me; this is just work around for PGI / Sun bug */ + void gotoblas_dummy_for_PGI(void) { diff --git a/O/OpenBLAS/common.jl b/O/OpenBLAS/common.jl index f32ec273c41..49146bab289 100644 --- a/O/OpenBLAS/common.jl +++ b/O/OpenBLAS/common.jl @@ -93,7 +93,7 @@ end # Do not override the default `num_64bit_threads` here, instead pass a custom from specific OpenBLAS versions # that should opt into a higher thread count. -function openblas_script(;num_64bit_threads::Integer=32, openblas32::Bool=false, aarch64_ilp64::Bool=false, consistent_fpcsr::Bool=false, bfloat16::Bool=false, kwargs...) +function openblas_script(;num_64bit_threads::Integer=32, openblas32::Bool=false, aarch64_ilp64::Bool=false, consistent_fpcsr::Bool=false, bfloat16::Bool=false, float16::Bool=false, kwargs...) # Allow some basic configuration script = """ NUM_64BIT_THREADS=$(num_64bit_threads) @@ -101,6 +101,7 @@ function openblas_script(;num_64bit_threads::Integer=32, openblas32::Bool=false, AARCH64_ILP64=$(aarch64_ilp64) CONSISTENT_FPCSR=$(consistent_fpcsr) BFLOAT16=$(bfloat16) + FLOAT16=$(float16) version_patch=$(version.patch) """ # Bash recipe for building across all platforms @@ -125,6 +126,14 @@ function openblas_script(;num_64bit_threads::Integer=32, openblas32::Bool=false, cp -rL ${prefix}/lib/linux/* $(dirname $(readlink -f $(which flang)))/../lib/clang/13.0.1/lib/linux/ fi + # GCC 14+ on Darwin requires additional libraries. + # (These should be in our image; remove this when the RootFS images have been updated.) + if [[ ${target} == *-darwin* ]]; then + if gcc --version | head -n 1 | grep -q '(GCC) 1[45][.]'; then + apk add libdispatch libdispatch-dev --repository=http://dl-cdn.alpinelinux.org/alpine/v3.17/community + fi + fi + # We always want threading flags=(USE_THREAD=1 GEMM_MULTITHREADING_THRESHOLD=400 NO_AFFINITY=1) if [[ "${CONSISTENT_FPCSR}" == "true" ]]; then @@ -134,6 +143,14 @@ function openblas_script(;num_64bit_threads::Integer=32, openblas32::Bool=false, # Build BFLOAT16 kernels if [[ "${BFLOAT16}" == "true" ]]; then flags+=(BUILD_BFLOAT16=1) + if [[ "${target}" == riscv64-* ]]; then + flags+=(CFLAGS=-Wno-error=incompatible-pointer-types) + fi + fi + + # Build FLOAT16 kernels + if [[ "${FLOAT16}" == "true" && "${target}" != arm-* && "${target}" != powerpc64le-* && "${target}" != x86_64-apple-* ]]; then + flags+=(BUILD_HFLOAT16=1) fi # We are cross-compiling @@ -198,6 +215,11 @@ function openblas_script(;num_64bit_threads::Integer=32, openblas32::Bool=false, flags+=(TARGET=RISCV64_GENERIC DYNAMIC_ARCH=1) fi + if [[ ${target} == aarch64-*-darwin* ]]; then + # Disable SME (not support on Darwin -- neither by the hardware nor by the toolchain) + export NO_SME=1 + fi + # If we're building for x86_64 Windows gcc7+, we need to disable usage of # certain AVX-512 registers (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782) if [[ ${target} == x86_64-w64-mingw32 ]] && [[ $(gcc --version | head -1 | awk '{ print $3 }') =~ (7|8).* ]]; then