OpenBLAS: Regression on PPC970, resulting in [some] dependents of OpenBLAS being unusable

I have built OpenBLAS from the current master 17803e790119705d2e2326f9bdbb641999fa04ab and it turns out the library is broken on Darwin PowerPC. Updated. Release 0.3.28 works fine without native optimizations, but exhibits the same problem when optimizations are enabled.

Specifically, I tried building py-scipy against the new OpenBLAS, and it failed at configure. Meson was not really helpful with the output, however eventually I found where exactly configure fails and just tried the same command outside of the build:

/opt/local/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -c 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'

It led to a bus error:

Process:         Python [1164]
Path:            /opt/local/Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         ??? (???)
Code Type:       PPC (Native)
Parent Process:  bash [313]

Date/Time:       2024-12-29 11:54:28.182 +0800
OS Version:      Mac OS X 10.6.8 (10K549)
Report Version:  6

Anonymous UUID:                      BC8371F6-179E-4C81-B2D5-052FA5025D07

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000003
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libopenblas.0.dylib           	0x01c200c0 dgeqr2_ + 316

Thread 1:
0   libSystem.B.dylib             	0x92554300 __semwait_signal + 12

Thread 2:
0   libSystem.B.dylib             	0x92554300 __semwait_signal + 12

Thread 3:
0   libSystem.B.dylib             	0x92554300 __semwait_signal + 12

Thread 0 crashed with PPC Thread State 32:
  srr0: 0x01c200c0  srr1: 0x0200f030   dar: 0x00000003 dsisr: 0x40000000
    r0: 0x01c20160    r1: 0xbfffc980    r2: 0x00000001    r3: 0x00000000
    r4: 0x00000008    r5: 0x00000660    r6: 0x0631d8a0    r7: 0x0213b704
    r8: 0x0631d8c8    r9: 0x00000008   r10: 0x0631d918   r11: 0xbfffc980
   r12: 0x48244402   r13: 0x00000003   r14: 0x0631d8d0   r15: 0x0213ff94
   r16: 0x00000004   r17: 0x00000002   r18: 0xbfffc9c8   r19: 0x00000004
   r20: 0x00000002   r21: 0x00000003   r22: 0x00000005   r23: 0x0213b708
   r24: 0x00000030   r25: 0xbfffcd28   r26: 0x0213b704   r27: 0x0631d8a0
   r28: 0xbfffcaa8   r29: 0x06bc4408   r30: 0x0631d8f8   r31: 0x01c1ff94
    cr: 0x82244444   xer: 0x20000000    lr: 0x01c20160   ctr: 0x00000000
vrsave: 0xc3fc0000

Binary Images:
    0x1000 -     0x2fff +org.python.python 3.12.8 (3.12.8) <D0AEA538-7475-6388-5F1B-2AD80948C399> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python
    0x5000 -   0x2dbffb +org.python.python 3.12.8, (c) 2001-2023 Python Software Foundation. (3.12.8) <65C58188-686B-2103-DFA0-4803AD869824> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/Python
  0x5ba000 -   0x5cdfff +libintl.8.dylib ??? (???) <1D434055-DFEA-0613-38DF-82D9591B78F2> /opt/local/lib/libintl.8.dylib
  0x5d3000 -   0x6d8fff +libiconv.2.dylib ??? (???) <1AE293B0-F61B-7FC5-D35C-A157C464B293> /opt/local/lib/libiconv.2.dylib
  0x7e4000 -   0x7eaff7 +libgcc_s.1.1.dylib ??? (???) <5935AE2A-933C-B949-4655-7E4EFEEB13B3> /opt/local/lib/libgcc/libgcc_s.1.1.dylib
  0x7ed000 -   0x7f7fff +math.cpython-312-darwin.so ??? (???) <9974D2E5-98CA-3583-98A1-9A85E453385B> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/math.cpython-312-darwin.so
  0xae0000 -   0xeeeffb +_multiarray_umath.cpython-312-darwin.so ??? (???) <EF61165A-0B54-DC2B-83B9-884FF2FC42DF> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/core/_multiarray_umath.cpython-312-darwin.so
  0xf70000 -   0xf7effb +_datetime.cpython-312-darwin.so ??? (???) <F95B693A-4709-341F-2CBF-CD791C65F5BE> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_datetime.cpython-312-darwin.so
  0xfc9000 -   0xfcffff +_struct.cpython-312-darwin.so ??? (???) <3E52A171-E5E7-78CF-CDD1-3F7B0E136DBA> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_struct.cpython-312-darwin.so
  0xfd6000 -   0xfe7fff +_pickle.cpython-312-darwin.so ??? (???) <0FA4D399-8FDB-90A5-1597-D44CE36191D1> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_pickle.cpython-312-darwin.so
  0xff0000 -   0xff0ffd +_contextvars.cpython-312-darwin.so ??? (???) <CA525B06-2B7F-CA6F-319B-8050E85054BD> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_contextvars.cpython-312-darwin.so
  0xff3000 -   0xff8ff7 +libffi.8.dylib ??? (???) <8F9EBF03-F8E7-5AD2-C402-3C6BC4159824> /opt/local/lib/libffi.8.dylib
  0xffb000 -   0xffcfff +_random.cpython-312-darwin.so ??? (???) <CEFE7584-06C8-6FED-CB93-19A636264F80> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_random.cpython-312-darwin.so
 0x1800000 -  0x2159fef +libopenblas.0.dylib ??? (???) <C4508703-E162-747D-458C-7CE0870CBAA8> /opt/local/lib/libopenblas.0.dylib
 0x21c0000 -  0x229efff +libgfortran.5.dylib ??? (???) <47073CEF-25C9-8824-5B40-235211C61203> /opt/local/lib/libgcc/libgfortran.5.dylib
 0x62ee000 -  0x62fafff +_pocketfft_internal.cpython-312-darwin.so ??? (???) <76FE4F65-472D-285B-9569-F995B452BFF3> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/fft/_pocketfft_internal.cpython-312-darwin.so
 0x62fd000 -  0x62fdffe +_opcode.cpython-312-darwin.so ??? (???) <74041AE0-157D-31E2-7535-38B593EF734C> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_opcode.cpython-312-darwin.so
 0x64e2000 -  0x64e6fff +binascii.cpython-312-darwin.so ??? (???) <3A7F7D74-80F1-7253-F579-2D454065776D> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/binascii.cpython-312-darwin.so
 0x64ea000 -  0x64fcffc +libz.1.dylib ??? (???) <A7D052E5-99BB-A5E8-2179-2F973818B7B0> /opt/local/lib/libz.1.dylib
 0x66e5000 -  0x66ffffb +_multiarray_tests.cpython-312-darwin.so ??? (???) <0CB4ADED-CB1F-C4C5-0B05-C688B6D0C7EB> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/core/_multiarray_tests.cpython-312-darwin.so
 0x6786000 -  0x6799ffb +_ctypes.cpython-312-darwin.so ??? (???) <B7E19F64-4174-D641-46B3-6F262DB84F66> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_ctypes.cpython-312-darwin.so
 0x67e7000 -  0x67eeffc +_hashlib.cpython-312-darwin.so ??? (???) <E17B6DC3-2569-29CB-2A93-BDD10BCC9CC6> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_hashlib.cpython-312-darwin.so
 0x67f5000 -  0x67f7ffd +_bisect.cpython-312-darwin.so ??? (???) <19DFDC81-D870-737B-B133-BF80B2CEDE44> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_bisect.cpython-312-darwin.so
 0x7040000 -  0x706affb +_umath_linalg.cpython-312-darwin.so ??? (???) <7C5B0CC5-EEA7-561B-DB07-5C70A52FD71E> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/linalg/_umath_linalg.cpython-312-darwin.so
 0x7131000 -  0x71cffff +mtrand.cpython-312-darwin.so ??? (???) <9791A75F-CCB1-504E-EBD4-A9600F6D59D8> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/mtrand.cpython-312-darwin.so
 0x71dc000 -  0x7207ff7 +bit_generator.cpython-312-darwin.so ??? (???) <FE7AD0F1-8C54-95D8-820B-B53A6329BA77> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/bit_generator.cpython-312-darwin.so
 0x7211000 -  0x7247fff +_common.cpython-312-darwin.so ??? (???) <B41A4952-873F-D0EF-BBEF-280C462F60B7> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_common.cpython-312-darwin.so
 0x728e000 -  0x7518feb +libcrypto.3.dylib ??? (???) <9CEBA2D6-5BF6-7348-22EA-8617A351B3C7> /opt/local/libexec/openssl3/lib/libcrypto.3.dylib
 0x75fd000 -  0x7605fff +_blake2.cpython-312-darwin.so ??? (???) <3CC5A3A2-FD20-B285-234B-7EB415D90DA1> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_blake2.cpython-312-darwin.so
 0x760a000 -  0x7618ffc +_sha2.cpython-312-darwin.so ??? (???) <7833E3B3-77F7-3E27-DE4B-AF6987744D1A> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/_sha2.cpython-312-darwin.so
 0x761e000 -  0x7668fff +_bounded_integers.cpython-312-darwin.so ??? (???) <351D33E9-5FE9-BBA5-AE49-414CA4A5A508> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_bounded_integers.cpython-312-darwin.so
 0x766e000 -  0x7683ff7 +_mt19937.cpython-312-darwin.so ??? (???) <F256145F-8235-89E0-1C8D-45ADD06F1990> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_mt19937.cpython-312-darwin.so
 0x7688000 -  0x769afff +_philox.cpython-312-darwin.so ??? (???) <15E10E6B-2ACA-E3CD-FBF3-8C0511812F17> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_philox.cpython-312-darwin.so
 0x769f000 -  0x76b7fff +_pcg64.cpython-312-darwin.so ??? (???) <42E581C4-8C67-67A6-CAE4-94CF53EFD231> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_pcg64.cpython-312-darwin.so
 0x76bd000 -  0x76c7fff +_sfc64.cpython-312-darwin.so ??? (???) <F821E00E-A55B-B8AC-E88A-8FDED4690F34> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_sfc64.cpython-312-darwin.so
 0x76cc000 -  0x7794ff7 +_generator.cpython-312-darwin.so ??? (???) <4F23FF47-D8BE-63CF-314B-2A5192F79A42> /opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/random/_generator.cpython-312-darwin.so
0x8fe00000 - 0x8fe3d7c7  dyld 132.1 (???) <25642EAE-381E-F8E4-65D7-202623802C57> /usr/lib/dyld
0x90003000 - 0x9002bff3  com.apple.DictionaryServices 1.1.2 (1.1.2) <28D18429-6770-B127-886A-D632AEC97FB0> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
0x90656000 - 0x907e4ff3  libicucore.A.dylib ??? (???) <3E465D6F-535F-E51D-93F1-7464C8AA934C> /usr/lib/libicucore.A.dylib
0x90886000 - 0x90893fff  libkxld.dylib ??? (???) <7C1EE264-5B42-1FBA-AA8B-B0F011D476EB> /usr/lib/system/libkxld.dylib
0x9094e000 - 0x9098bfff  com.apple.SystemConfiguration 1.10.8 (1.10.2) <40364E85-F915-7EA1-98A4-4AFC1FFB2D3D> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
0x9098c000 - 0x909b8fff  libxslt.1.dylib ??? (???) <88189D5E-6F3D-BC47-0D34-8EA6465D0277> /usr/lib/libxslt.1.dylib
0x909b9000 - 0x909c2fff  com.apple.DiskArbitration 2.3 (2.3) <F5681EE4-97D8-4145-CCAD-51F78D899D80> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
0x909c3000 - 0x909d1fff  libz.1.dylib ??? (???) <3B22B5A3-9A90-EF48-84D9-07E6D0A1EDBF> /usr/lib/libz.1.dylib
0x9109a000 - 0x910d3ff3  com.apple.AE 496.5 (496.5) <D9E8C3F3-37C1-6BFA-FB1F-5D8C884D84CE> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
0x910d4000 - 0x911e5fff  libxml2.2.dylib ??? (???) <F89A83D2-BF18-C82B-717B-6FCD96B8B7D0> /usr/lib/libxml2.2.dylib
0x911e6000 - 0x911ebffe  libmathCommon.A.dylib ??? (???) <C74C35F1-C121-4418-6BFF-503AA9D0B889> /usr/lib/system/libmathCommon.A.dylib
0x9146c000 - 0x91521ffb  com.apple.CFNetwork 454.12.4 (454.12.4) <F25C54B7-3D47-E79D-6443-F8595690907B> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
0x9156e000 - 0x916dbff7  com.apple.CoreFoundation 6.6.6 (550.44) <01239ACC-BF77-CD89-FB11-62612ADA6BBE> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x91c00000 - 0x91c43ff3  libauto.dylib ??? (???) <7F36ED55-D49F-3E2C-6330-6F0F7F645AFA> /usr/lib/libauto.dylib
0x91c52000 - 0x91cb2fff  com.apple.framework.IOKit 2.0 (???) <71C8FB5C-FE64-8001-2DA1-EF8BC7E3273A> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x91cd3000 - 0x91d88ffb  libsqlite3.dylib ??? (???) <BC14CA88-E9DA-5E7E-B624-D36846C54574> /usr/lib/libsqlite3.dylib
0x91dc4000 - 0x9210dffb  com.apple.CoreServices.CarbonCore 861.39 (861.39) <5F30A629-B51D-8D46-7323-E3F368CCBE61> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
0x92253000 - 0x92267fff  libbsm.0.dylib ??? (???) <AE1E2515-4ED9-9AFD-0DAF-ADFA421D39C5> /usr/lib/libbsm.0.dylib
0x92268000 - 0x922dbff7  libstdc++.6.dylib ??? (???) <3B1C6DCD-B165-49B8-060D-9FCC4C09FBDE> /usr/lib/libstdc++.6.dylib
0x922dc000 - 0x9238eff3  libobjc.A.dylib ??? (???) <37861DF9-840C-8F1C-57E9-2E4D4CF4A5D3> /usr/lib/libobjc.A.dylib
0x924b5000 - 0x9268dffb  libSystem.B.dylib ??? (???) <45298DD5-31D9-AE52-CCE7-D02224C22208> /usr/lib/libSystem.B.dylib
0x926c5000 - 0x92769ff3  com.apple.LaunchServices 362.3 (362.3) <8EEC6B1A-5174-443D-942A-C253358D206C> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
0x927a2000 - 0x92828fff  com.apple.SearchKit 1.3.0 (1.3.0) <FDCCACEC-1294-9871-DBDD-DCC0C53F8169> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
0x9289d000 - 0x928abffe  com.apple.NetFS 3.2.2 (3.2.2) <1B167948-4975-38B7-492A-E1540FE665D7> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
0x92940000 - 0x92bb6ff7  com.apple.security 6.0 (36910) <F73CE32C-B154-86BC-2B13-966B9DB0CD44> /System/Library/Frameworks/Security.framework/Versions/A/Security
0x92bb7000 - 0x92bfeff7  com.apple.Metadata 10.6.3 (507.15) <6AB3D3B7-BFEA-6024-8BA6-F639E3920670> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
0x92c02000 - 0x92ce0ff7  com.apple.CoreServices.OSServices 359.2 (359.2) <6A759D29-CB94-342E-45A7-5F1684A0FEEC> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
0x92d93000 - 0x92d93ffa  com.apple.CoreServices 44 (44) <EEDF28CB-C144-9A7B-7467-32EB629CC620> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0xffff8000 - 0xffff9703  libSystem.B.dylib ??? (???) <45298DD5-31D9-AE52-CCE7-D02224C22208> /usr/lib/libSystem.B.dylib

Model: PowerMac11,2, BootROM 5.2.7f1, 4 processors, PowerPC G5 (1.1), 2.5 GHz, 16 GB, SMC 
Graphics: NVIDIA Quadro FX 4500, Quadro FX 4500, PCIe, 512 MB
Memory Module: DIMM0/J6700, 2 GB, DDR2 SDRAM, PC2-3200U-288
Memory Module: DIMM1/J6800, 2 GB, DDR2 SDRAM, PC2-3200U-288
Memory Module: DIMM2/J6900, 2 GB, DDR2 SDRAM, PC2-4200U-444
Memory Module: DIMM3/J7000, 2 GB, DDR2 SDRAM, PC2-4200U-444
Memory Module: DIMM4/J7100, 2 GB, DDR2 SDRAM, PC2-3200U-288
Memory Module: DIMM5/J7200, 2 GB, DDR2 SDRAM, PC2-3200U-288
Memory Module: DIMM6/J7300, 2 GB, DDR2 SDRAM, PC2-3200U-288
Memory Module: DIMM7/J7400, 2 GB, DDR2 SDRAM, PC2-3200U-288
Network Service: Ethernet 1, Ethernet, en0
PCI Card: Quadro FX 4500, Display, SLOT-1
PCI Card: Apple 5714, network, GIGE
PCI Card: Apple 5714, network, GIGE
PCI Card: pci16b8,6a02, AHCI Controller, SLOT-4
Serial ATA Device: WDC WD2500JS-41MVB1, 232.89 GB
Serial ATA Device: VO0600ECHPP, 558.91 GB
Parallel ATA Device: HL-DT-ST DVD-RW GWA-4165B, 744.6 MB
USB Device: USB Keyboard, 0x04f2  (Chicony Electronics Co., Ltd.), 0x1516, 0x0b200000
USB Device: HP USB Optical Mouse, 0x03f0  (Hewlett Packard), 0x134a, 0x2b200000
FireWire Device: unknown_device, unknown_value, Unknown
FireWire Device: unknown_device, unknown_value, Unknown

Switching to 0.3.28, I was able to configure py-scipy normally, and the build runs now with no issues. Nothing else changed, I did not even have to rebuild py-numpy, only switch OpenBLAS from 17803e790119705d2e2326f9bdbb641999fa04ab to the release.

Importantly, MacPorts build OpenBLAS-devel (the one tracking upstream) with native optimizations, while releases are built without those.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 45 (28 by maintainers)

Most upvoted comments

I will try build now with this patch and let you know soon.

Thank you, and the same to you! (Yes, I am in TW at the moment, so time is accurate.) I will look at the code tomorrow, and perhaps we could ask GCC upstream if they could assist us too.

Good to know that G4 is unaffected. Adding the “generic” C kernels to the build configuration overrides the default from kernel/Makefile.L1 which specifies SSCALKERNEL=scal.S and DSCALKERNEL=scal.S . (Overriding the defaults for CSCAL and ZSCAL should indeed be unnecessary, as the new flag parameter for NaN handling was only added to the real-space functions. The fact that a lot of the generic BLAS kernels ended up in “arm” or “mips” rather than “generic” is just a historic oddity - not sure if OpenBLAS inherited this from GotoBLAS already, or if it crept in later as more architectures got added). Thank you very much for your help so far - I guess you must be very close to the New Year already, if you are anywhere near the location in your profile. I hope it will be a good year…

Looking at this again (and on more than just a phone screen), it occurs to me that (1) if the DSCAL changes were wrong, they should blow up both with and without native optimizations - if by native optimizations you mean compiler flags (?) and (2) the backtrace ending in dgeqr2 rather than any function called from it suggests that the problem already occurs in whatever optimized machine code the Fortran compiler creates from Reference-LAPACKs dgeqr2 code that OpenBLAS includes. Perhaps you could try including DEBUG=1 (equivalent to the -g compiler flag) in your build flags for OpenBLAS (if that is not already there) to see if we can get a more exact failure location ?