Exception in system functions on Apple M1
Original Reporter info from Mantis: IgorKokarev
-
Reporter name: Igor Kokarev
Original Reporter info from Mantis: IgorKokarev
- Reporter name: Igor Kokarev
Description:
This problem is very similar to a problem in bug-report # 38189 "App aarch64 crashes on Apple M1".
Metal macOS function crashes with exception when called from non-main thread on Apple M1 aarch64/darwin:
copyFromTexture();
This problem doesn't occur with x86-64/darwin on Apple M1 using Rosetta.
Apple DTK works fine both versions aarch64 and x86-64. Probably because DTK doesn't have a hardware FPU exceptions?
Steps to reproduce:
I attach a test project. Compile for aarch64/darwin.
Click "Render async" button. The app should generate rt.bmp image in the same folder.
aarch64/darwin app crashes immediatelly on Apple M1
Additional information:
Apple M1. macOS 11.1, Xcode 12.3, Lazarus Trunk (December 17, 2020) and FPC Trunk 3.3.1 (December 17, 2020).
Project project1 raised exception class 'Debugger stopped with reason: EXC_BAD_INSTRUCTION (code=1, subcode=0x1e220820)'.
At address 115C9CEE0
0000000115C9CEC4 : 0x1e270183 fmov s3, w12
0000000115C9CEC8 : 0x1e235803 fmin s3, s0, s3
0000000115C9CECC : 0x1e39006c fcvtzu w12, s3
0000000115C9CED0 : 0x1200258c and w12, w12, #0x3ff
0000000115C9CED4 : 0x1e202008 fcmp s0, #0.0
0000000115C9CED8 : 0x9a8c43ec csel x12, xzr, x12, mi
0000000115C9CEDC : 0xf900000c str x12, [x0]
0000000115C9CEE0 : 0x1e220820 fmul s0, s1, s2
0000000115C9CEE4 : 0x1e202008 fcmp s0, #0.0
0000000115C9CEE8 : 0x52a88c0d mov w13, #0x44600000
0000000115C9CEEC : 0x1e2701a1 fmov s1, w13
0000000115C9CEF0 : 0x1e215800 fmin s0, s0, s1
0000000115C9CEF4 : 0x1e39000d fcvtzu w13, s0
0000000115C9CEF8 : 0x531625ad ubfiz w13, w13, #10, #10
0000000115C9CEFC : 0x9a8d43ed csel x13, xzr, x13, mi
0000000115C9CF00 : 0xaa0c01ac orr x12, x13, x12
0000000115C9CF04 : 0xf900000c str x12, [x0]
0000000115C9CF08 : 0x71000529 subs w9, w9, #0x1 ; =0x1
0000000115C9CF0C : 0x5ac01129 clz w9, w9
0000000115C9CF10 : 0x4b0903e9 neg w9, w9
0000000115C9CF14 : 0x5280002d mov w13, #0x1
0000000115C9CF18 : 0x1ac921a9 lsl w9, w13, w9
0000000115C9CF1C : 0x1a9f8529 csinc w9, w9, wzr, hi
0000000115C9CF20 : 0x5100052d sub w13, w9, #0x1 ; =0x1
0000000115C9CF24 : 0x5ac011ad clz w13, w13
0000000115C9CF28 : 0x4b0d53ed neg w13, w13, lsl #20
0000000115C9CF2C : 0x120c09ad and w13, w13, #0x700000
0000000115C9CF30 : 0x7100093f cmp w9, #0x2 ; =0x2
0000000115C9CF34 : 0x1a8d33e9 csel w9, wzr, w13, lo
0000000115C9CF38 : 0x7100011f cmp w8, #0x0 ; =0x0
0000000115C9CF3C : 0x9a8903e9 csel x9, xzr, x9, eq
0000000115C9CF40 : 0x7100011f cmp w8, #0x0 ; =0x0
0000000115C9CF44 : 0x1a9f07ed cset w13, ne
0000000000000000 ......
0000000000000000 ......
[FORMS.PP] ExceptionOccurred
Sender=EAccessViolation
Exception=Access violation
Stack trace:
$00000001109E0EE0
$5678000110C966A8
$47548001045D597C
$00000001045D669C
$00000001042E0E28
$00000001042E0EB0
$00000001042C4C68
[FORMS.PP] ExceptionOccurred
[FORMS.PP] ExceptionOccurred
[FORMS.PP] ExceptionOccurred
-[_MTLCommandEncoder dealloc]:131: failed assertion `Command encoder released without endEncoding'
Abort trap: 6
Full system log is attached in logs.txt.
Mantis conversion info:
- Mantis ID: 38230
- OS: macOS
- OS Build: 11.1
- Build: 2020/12/17
- Platform: Apple M1
- Version: 3.3.1
- Monitored by: » @neurolabusc1 (Chris Rorden), » ekryukov (ekryukov)