Describe the issue
Seems that #16082 has introduced a bug when compiling for an Apple M1 machine. The bug stems from a missing inlined-assembly instruction.
Reverting the commit introduces a regression on the test suite.
Urgency
This is a presumed blocker for a release on an arm64 Apple.
Target platform
arm64-apple-darwin22.5.0
Build script
./build.sh --config Debug --build_shared_lib --parallel --compile_no_warning_as_error --skip_submodule_sync --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64
Error / output
...
5: 2023-06-27 14:08:02.109 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.109664 [I:onnxruntime:Default, bfc_arena.cc:212 Extend] Allocated memory at 0x128a88000 to 0x128e88000
5: 2023-06-27 14:08:02.110 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.110300 [I:onnxruntime:, session_state_utils.cc:344 SaveInitializedTensors] Done saving initialized tensors
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111169 [I:onnxruntime:, inference_session.cc:1675 Initialize] Session successfully initialized.
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111225 [V:onnxruntime:, sequential_executor.cc:534 ExecuteThePlan] Number of streams: 1
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111319 [V:onnxruntime:, sequential_executor.cc:184 SessionScope] Begin execution
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111356 [I:onnxruntime:Default, bfc_arena.cc:347 AllocateRawInternal] Extending BFCArena for Cpu. bin_num:13 (requested) num_bytes: 3154176 (actual) rounded_bytes:3154176
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111374 [I:onnxruntime:Default, bfc_arena.cc:206 Extend] Extended allocation by 8388608 bytes.
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111385 [I:onnxruntime:Default, bfc_arena.cc:209 Extend] Total allocated bytes: 15728640
5: 2023-06-27 14:08:02.111 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.111395 [I:onnxruntime:Default, bfc_arena.cc:212 Extend] Allocated memory at 0x120000000 to 0x120800000
5: 2023-06-27 14:08:02.112 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.112710 [V:onnxruntime:, sequential_executor.cc:518 ExecuteKernel] stream 0 launch kernel with idx 66
5: 2023-06-27 14:08:02.113 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.113577 [V:onnxruntime:, stream_execution_context.cc:171 RecycleNodeInputs] ort value 53 released
5: 2023-06-27 14:08:02.113 onnxruntime_global_thread_pools_test[44651:1311462] 2023-06-27 14:08:02.113592 [V:onnxruntime:, sequential_executor.cc:518 ExecuteKernel] stream 0 launch kernel with idx 2
5/8 Test #5: onnxruntime_global_thread_pools_test ....***Exception: Illegal 0.27 sec
...
38% tests passed, 5 tests failed out of 8
Total Test time (real) = 5.27 sec
The following tests FAILED:
1 - onnxruntime_test_all (ILLEGAL)
2 - onnx_test_pytorch_converted (ILLEGAL)
3 - onnx_test_pytorch_operator (ILLEGAL)
4 - onnxruntime_shared_lib_test (ILLEGAL)
5 - onnxruntime_global_thread_pools_test (ILLEGAL)```
Running lldb onnxruntime_mlas_test provides the following output:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=1, subcode=0xd5380608)
frame #0: 0x00000001001b5458 onnxruntime_mlas_test`MLAS_PLATFORM::MLAS_PLATFORM(this=0x000000010029cd48) at platform.cpp:456:5
453 HasDotProductInstructions = (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) != 0);
454 #else
455 uint64_t isar0_el1;
-> 456 asm("mrs %[reg], ID_AA64ISAR0_EL1\n" : [reg] "=r"(isar0_el1) : :);
457 HasDotProductInstructions = ((isar0_el1 >> 44) & 0xfu) == 0x1u;
458 #endif
459
Target 0: (onnxruntime_mlas_test) stopped.
Reverting the offending commit introduces the following test cases to fail:
[ FAILED ] 11 tests, listed below:
[ FAILED ] GraphTransformationTests.FuseConvBnAddMulFloat16
[ FAILED ] GraphTransformationTests.QuickGelu
[ FAILED ] GraphTransformationTests.ConstantSharing_ShareFloatOrHalfTypedInitializer
[ FAILED ] GraphTransformationTests.ConstantSharing_Share2DFloatOrHalfTypedInitializer
[ FAILED ] GraphTransformationTests.ConstantSharing_ShareFloatAndHalfTypedInitializer
[ FAILED ] GraphTransformationTests.ConstantSharing_Share2DFloatAndHalfTypedInitializer
[ FAILED ] Float16_Tests.Mul_16_Test
[ FAILED ] InverseContribOpTest.two_by_two_float16
[ FAILED ] CastOpTest.NonStringTypes
[ FAILED ] CastOpTest.ToString
[ FAILED ] IsNaNOpTest.IsNaNFloat16
Visual Studio Version
No response
GCC / Compiler Version
clang version 11.1.0
Describe the issue
Seems that #16082 has introduced a bug when compiling for an Apple M1 machine. The bug stems from a missing inlined-assembly instruction.
Reverting the commit introduces a regression on the test suite.
Urgency
This is a presumed blocker for a release on an arm64 Apple.
Target platform
arm64-apple-darwin22.5.0
Build script
./build.sh --config Debug --build_shared_lib --parallel --compile_no_warning_as_error --skip_submodule_sync --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64Error / output
Running
lldb onnxruntime_mlas_testprovides the following output:Reverting the offending commit introduces the following test cases to fail:
Visual Studio Version
No response
GCC / Compiler Version
clang version 11.1.0