Skip to content

Commit 2025688

Browse files
committed
Enable f2c and complex return style autodetection on aarch64
It turns out we need these for Accelerate on apple silicon, and the autodetection just works! What a lovely surprise.
1 parent 91a1662 commit 2025688

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Make.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ endif
8080
# If we're on x86_64 or i686, we may need to convert back f2c-style bindings (such as Apple's Accelerate)
8181
# from returning doubles to instead return float's. We enable automatic F2C detection on those platforms.
8282
F2C_AUTODETECTION := 0
83-
ifneq (,$(filter $(ARCH), x86_64 i686))
83+
ifneq (,$(filter $(ARCH), x86_64 i686 aarch64 arm64))
8484
LBT_CFLAGS += -DF2C_AUTODETECTION
8585
F2C_AUTODETECTION := 1
8686
endif
@@ -93,7 +93,7 @@ ifneq (,$(filter $(ARCH), x86_64 i686))
9393
endif
9494

9595
# If we're on x86_64, we can do complex return style autodetection
96-
ifneq (,$(filter $(ARCH), x86_64))
96+
ifneq (,$(filter $(ARCH), x86_64 aarch64))
9797
LBT_CFLAGS += -DCOMPLEX_RETSTYLE_AUTODETECTION
9898
COMPLEX_RETSTYLE_AUTODETECTION := 1
9999
endif

test/direct.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ lbt_handle = dlopen("$(lbt_prefix)/$(binlib)/lib$(lbt_link_name).$(shlib_ext)",
4747
config = lbt_get_config(lbt_handle)
4848

4949
# If we're x86_64, ensure LBT thinks it's f2c-adapter capable
50-
if Sys.ARCH == :x86_64
50+
if Sys.ARCH (:x86_64, :aarch64)
5151
@test (config.build_flags & LBT_BUILDFLAGS_F2C_CAPABLE) != 0
5252
end
5353

@@ -69,18 +69,22 @@ lbt_handle = dlopen("$(lbt_prefix)/$(binlib)/lib$(lbt_link_name).$(shlib_ext)",
6969
@test libs[1].interface == LBT_INTERFACE_LP64
7070
end
7171
@test libs[1].f2c == LBT_F2C_PLAIN
72-
if Sys.ARCH == :x86_64
73-
@test libs[1].cblas == LBT_CBLAS_CONFORMANT
72+
if Sys.ARCH (:x86_64, :aarch64)
7473
if Sys.iswindows()
7574
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_ARGUMENT
7675
else
7776
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_NORMAL
7877
end
7978
else
80-
@test libs[1].cblas == LBT_CBLAS_UNKNOWN
8179
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_UNKNOWN
8280
end
8381

82+
if Sys.ARCH == :x86_64
83+
@test libs[1].cblas == LBT_CBLAS_CONFORMANT
84+
else
85+
@test libs[1].cblas == LBT_CBLAS_UNKNOWN
86+
end
87+
8488
@test bitfield_get(libs[1].active_forwards, dgemm_idx) != 0
8589

8690
# Next check OpenBLAS32_jll which is always LP64

0 commit comments

Comments
 (0)