Mac M2 support/Upgrade dearpygui
mef51 opened this issue · comments
I used dearpygui==0.6.415 which does not install on mac (no wheels for M1/M2?)
Current version of DPG is 1.9.2
On the Apple M2 even with an updated version of DPG frbgui can crash multiple times on startup due to segmentation faults and bus errors related to loading textures from the GPU.
The system's log for the crash is shown here:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000173de9980
Exception Codes: 0x0000000000000002, 0x0000000173de9980
Termination Reason: Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process: exc handler [19598]
VM Region Info: 0x173de9980 is in 0x173de8000-0x173dec000; bytes after start: 6528 bytes before end: 9855
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_LARGE 173274000-173de8000 [ 11.5M] rw-/rwx SM=PRV
---> STACK GUARD 173de8000-173dec000 [ 16K] ---/rwx SM=NUL ...for thread 22
Stack 173dec000-173e74000 [ 544K] rw-/rwx SM=PRV thread 22
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 AGXMetalG14G 0x1fbb54aac agxaAssertBufferIsValid(unsigned char const*, unsigned long, unsigned long, unsigned long, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 804
1 AGXMetalG14G 0x1fb9e0910 AGX::Texture<(AGXTextureMemoryLayout)3, AGX::G14::Encoders, AGX::G14::Classes>::writeRegion(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, void*, unsigned long, unsigned long) + 112
2 AGXMetalG14G 0x1fb9e0894 -[AGXG14GFamilyTexture replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:] + 92
3 IOGPU 0x1b35029a8 -[IOGPUMetalTexture replaceRegion:mipmapLevel:withBytes:bytesPerRow:] + 56
4 _dearpygui.so 0x101cb464c LoadTextureFromArray(unsigned int, unsigned int, float*) + 168
5 _dearpygui.so 0x101d29a1c mvStaticTexture::draw(ImDrawList*, float, float) + 128
6 _dearpygui.so 0x101d28498 mvTextureRegistry::draw(ImDrawList*, float, float) + 88
7 _dearpygui.so 0x101d8ec68 RenderItemRegistry(mvItemRegistry&) + 412
8 _dearpygui.so 0x101c28798 Render() + 1148
9 _dearpygui.so 0x101caa468 mvRenderFrame() + 880
10 _dearpygui.so 0x101c97304 render_dearpygui_frame(_object*, _object*, _object*) + 68
11 libpython3.11.dylib 0x1010dcfe0 cfunction_call + 84
12 libpython3.11.dylib 0x101091ff4 _PyObject_MakeTpCall + 344
13 libpython3.11.dylib 0x1011719e8 _PyEval_EvalFrameDefault + 35800
14 libpython3.11.dylib 0x101168c40 PyEval_EvalCode + 272
15 libpython3.11.dylib 0x1011bbf9c run_mod + 152
16 libpython3.11.dylib 0x1011ba490 _PyRun_SimpleFileObject + 852
17 libpython3.11.dylib 0x1011b9f18 _PyRun_AnyFileObject + 160
18 libpython3.11.dylib 0x1011d9320 Py_RunMain + 1848
19 libpython3.11.dylib 0x1011d96d0 pymain_main + 324
20 libpython3.11.dylib 0x1011d9770 Py_BytesMain + 40
21 dyld 0x1964b3f28 start + 2236
Showing some kind of issue related to rendering a frame of the gui or loading a texture.
When frbgui does load it loads the first waterfall but the texture for the autocorrelation is filled with artifacts and selecting
any other waterfall fails to load.
![image](https://private-user-images.githubusercontent.com/1703141/258225858-7ae9c305-2cce-4bb7-af4d-f7ad822884f0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0OTM2NzIsIm5iZiI6MTcyMTQ5MzM3MiwicGF0aCI6Ii8xNzAzMTQxLzI1ODIyNTg1OC03YWU5YzMwNS0yY2NlLTRiYjctYWY0ZC1mN2FkODIyODg0ZjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjBUMTYzNjEyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjMwNGU0YjY1N2U4MmM4Mjg4NjI5YjEyNTRiNzA5ZDU4NTYxNjJhYzk4NzY4ZmIyNDExZDE1MjQxOGU3NGY4MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Sd_DbH-l83ojLtM7t_WYBViSjB8B3UGDZaCQ89jWs2Q)
At this stage there is sometimes a python error when click around the GUI
XXX lineno: 574
SystemError: Unknown opcode 151
(or something like that, when I started using pyenv to switch python versions the error stopped appearing reliably) and the line numbers refer to the start of function definitions like mousemask_cb
or other callback functions.
In an attempt to workaround this issue I installed a linux ubuntu virtual machine via lima but was also unable to start frbgui. The issue was ultimately again related to the GPU, no gpu driver for the M2 in the VM, and I couldn't compile one like llvmpipe either.
I will try another VM option like docker or virtual box as these may be good workarounds for running the gui on an M2 mac for now.
The texture format changed between DPG versions so the above was solved by updating frbgui.py
without messing around with VMs and drivers.
pyenv seems to catch the unknown opcode errors and frbgui runs more reliably under it. I'll keep using that as I keep updating the code to DPG 1.9. I suspect most of the bugs are related to properly updating DPG from 0.6 to 1.9 and not an M2 issue, since the DPG demo runs fine.