taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.05k stars 2.26k forks source link

Error when attempting to use GGUI #8536

Closed grindstm closed 3 weeks ago

grindstm commented 1 month ago

When I try to run the simplest ggui program using any backend including cuda, vulkan, cpu, opengl:

import taichi as ti
ti.init(arch=ti.cpu)
window = ti.ui.Window(name='Title', res=(640, 360))
canvas = window.get_canvas()

while window.running:
    window.show()

The window will open and immediately close. I get the error:

test.py
[Taichi] version 1.7.1, llvm 15.0.4, commit 0f143b2f, linux, python 3.10.14
[Taichi] Starting on arch=x64
RHI Error: (-1000001004) vkAcquireNextImageKHR failed
python: /home/dev/taichi/taichi/rhi/vulkan/vulkan_device.cpp:2808: virtual taichi::lang::StreamSemaphore taichi::lang::vulkan::VulkanSurface::acquire_next_image(): Assertion `false && "Error without return code"' failed.
zsh: IOT instruction (core dumped)  /home/matthew/Code/jvenv/bin/python 

With debug=True:

RHI Error: (-1000001004) vkAcquireNextImageKHR failed
python: /home/dev/taichi/taichi/rhi/vulkan/vulkan_device.cpp:2808: virtual taichi::lang::StreamSemaphore taichi::lang::vulkan::VulkanSurface::acquire_next_image(): Assertion `false && "Error without return code"' failed.
[E 05/31/24 17:18:12.556 15543] Received signal 6 (Aborted)

***********************************
* Taichi Compiler Stack Traceback *
***********************************
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x4805994) [0x7fe338005994]
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x1b35d8e) [0x7fe335335d8e]
/usr/lib/libc.so.6(+0x3cae0) [0x7fe3623a8ae0]
/usr/lib/libc.so.6(+0x94e44) [0x7fe362400e44]
/usr/lib/libc.so.6: gsignal
/usr/lib/libc.so.6: abort
/usr/lib/libc.so.6(+0x243df) [0x7fe3623903df]
/usr/lib/libc.so.6(+0x34c67) [0x7fe3623a0c67]
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x4421afe) [0x7fe337c21afe]
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x1dda7b1) [0x7fe3355da7b1]
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x1de5ac0) [0x7fe3355e5ac0]
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x1c2917d) [0x7fe33542917d]
/home/matthew/Code/jvenv/lib/python3.10/site-packages/taichi/_lib/core/taichi_python.cpython-310-x86_64-linux-gnu.so(+0x1c0e1cf) [0x7fe33540e1cf]
/home/matthew/Code/jvenv/bin/python(+0x1445a6) [0x5653ef8995a6]
/home/matthew/Code/jvenv/bin/python: _PyObject_MakeTpCall
/home/matthew/Code/jvenv/bin/python(+0x150866) [0x5653ef8a5866]
/home/matthew/Code/jvenv/bin/python: _PyEval_EvalFrameDefault
/home/matthew/Code/jvenv/bin/python: _PyFunction_Vectorcall
/home/matthew/Code/jvenv/bin/python: _PyEval_EvalFrameDefault
/home/matthew/Code/jvenv/bin/python: _PyFunction_Vectorcall
/home/matthew/Code/jvenv/bin/python: _PyEval_EvalFrameDefault
/home/matthew/Code/jvenv/bin/python(+0x1d7c60) [0x5653ef92cc60]
/home/matthew/Code/jvenv/bin/python: PyEval_EvalCode
/home/matthew/Code/jvenv/bin/python(+0x20812a) [0x5653ef95d12a]
/home/matthew/Code/jvenv/bin/python(+0x203523) [0x5653ef958523]
/home/matthew/Code/jvenv/bin/python(+0x9a6f5) [0x5653ef7ef6f5]
/home/matthew/Code/jvenv/bin/python: _PyRun_SimpleFileObject
/home/matthew/Code/jvenv/bin/python: _PyRun_AnyFileObject
/home/matthew/Code/jvenv/bin/python: Py_RunMain
/home/matthew/Code/jvenv/bin/python: Py_BytesMain
/usr/lib/libc.so.6(+0x25c88) [0x7fe362391c88]
/usr/lib/libc.so.6: __libc_start_main
/home/matthew/Code/jvenv/bin/python(+0x1cb0f1) [0x5653ef9200f1]

Operating System: Manjaro Linux KDE Plasma Version: 6.0.5 KDE Frameworks Version: 6.2.0 Qt Version: 6.7.1 Kernel Version: 6.6.32-1-MANJARO (64-bit) Graphics Platform: Wayland Processors: 16 × 11th Gen Intel® Core™ i7-11700K @ 3.60GHz Memory: 125.6 GiB of RAM Graphics Processor: Mesa Intel® Graphics Manufacturer: Gigabyte Technology Co., Ltd. Product Name: B560M DS3H

Python version 3.10.14

My laptop runs the same operating system, has no gpu, and is able to run ggui without issues.

I have tried creating a new virtual environment and reinstalling vulkan-tools. taichi diagnose doesn't identify any issues when testing the ggui program.

Since this is working on my other computer, I am hesitant to assume it is a bug. If anyone has had a similar experience and can suggest a solution, I would be grateful ☯️

grindstm commented 3 weeks ago

The problem is Wayland + GPU. I do not have these issues when using X11 or when using Wayland on a machine without a dedicated GPU.