Skip to content

r600: info.stage MESA_SHADER_KERNEL as MESA_SHADER_COMPUTE

This fixes a crash when r600 is enabled in rusticl.

@karolherbst said on #rusticl channel:

long term r600 should implement PIPE_CAP_SHAREABLE_SHADERS

On this device:

Platform #1: rusticl
 +-- Device #0: AMD CAYMAN (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)

I got that (more details on https://dl.illwieckz.net/b/mesa/wip/rusticl/r600/20221002-004.rusticl-r600-crash-with-luxmark.md ):

luxmark: ../src/gallium/drivers/r600/sfn/sfn_nir.cpp:832: int r600_shader_from_nir(r600_context*, r600_pipe_shader*, r600_shader_key*): Assertion `shader' failed.
Thread 55 "rusticl queue t" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd047a640 (LWP 1483880)]
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140736687744576) at ./nptl/pthread_kill.c:44
(gdb) thread apply all backtrace

Thread 56 (Thread 0x7fffb4507640 (LWP 1408814) "rusticl queue t"):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fffedc91c9a in std::sys::unix::futex::futex_wait () at library/std/src/sys/unix/futex.rs:25
#2  std::sys_common::thread_parker::futex::Parker::park () at library/std/src/sys_common/thread_parker/futex.rs:50
#3  std::thread::park () at library/std/src/thread/mod.rs:901
#4  std::sync::mpsc::blocking::WaitToken::wait () at library/std/src/sync/mpsc/blocking.rs:68
#5  0x00007fffed8f5711 in std::sync::mpsc::oneshot::Packet<alloc::vec::Vec<alloc::sync::Arc<rusticl::core::event::Event>, alloc::alloc::Global>>::recv<alloc::vec::Vec<alloc::sync::Arc<rusticl::core::event::Event>, alloc::alloc::Global>> (self=0x7fff8c108cd0, deadline=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sync/mpsc/oneshot.rs:140
#6  0x00007fffed91b4ee in std::sync::mpsc::Receiver<alloc::vec::Vec<alloc::sync::Arc<rusticl::core::event::Event>, alloc::alloc::Global>>::recv<alloc::vec::Vec<alloc::sync::Arc<rusticl::core::event::Event>, alloc::alloc::Global>> (self=0x7fffb45069b0) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sync/mpsc/mod.rs:1161
#7  0x00007fffed991d14 in rusticl::core::queue::{impl#0}::new::{closure#0} () at ../src/gallium/frontends/rusticl/core/queue.rs:52
#8  0x00007fffed8f87fe in std::sys_common::backtrace::__rust_begin_short_backtrace<rusticl::core::queue::{impl#0}::new::{closure#0}, ()> (f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:123
#9  0x00007fffed95b8f1 in std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}<rusticl::core::queue::{impl#0}::new::{closure#0}, ()> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/thread/mod.rs:477
#10 0x00007fffed8d2631 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}> (self=..., _args=()) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panic/unwind_safe.rs:271
#11 0x00007fffed8e4832 in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (data=0x7fffb4506b08) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:406
#12 0x00007fffed8e51fb in __rust_try () from install/lib/x86_64-linux-gnu/libRusticlOpenCL.so.1
#13 0x00007fffed8e4720 in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>> (f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:370
#14 0x00007fffed918c21 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panic.rs:133
#15 0x00007fffed95b679 in std::thread::{impl#0}::spawn_unchecked::{closure#1}<rusticl::core::queue::{impl#0}::new::{closure#0}, ()> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/thread/mod.rs:476
#16 0x00007fffed9830ee in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked::{closure#1}, ()> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ops/function.rs:227
#17 0x00007fffedca5b83 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854
#18 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854
#19 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#20 0x00007ffff50c8b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#21 0x00007ffff515aa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 55 (Thread 0x7fffc049d640 (LWP 1408813) "rusticl queue t"):
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140736419452480) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140736419452480) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140736419452480, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff5076476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff505c7f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff505c71b in __assert_fail_base (fmt=0x7ffff0ca9850 "%s%s%s :%u : %s%s l'assertion « %s » a échoué.\n%n", assertion=0x7ffff04a3935 "shader", file=0x7ffff04a2180 "../src/gallium/drivers/r600/sfn/sfn_nir.cpp", line=832, function=<optimized out>) at ./assert/assert.c:92
#6  0x00007ffff506de96 in __GI___assert_fail (assertion=0x7ffff04a3935 "shader", file=0x7ffff04a2180 "../src/gallium/drivers/r600/sfn/sfn_nir.cpp", line=832, function=0x7ffff04a38e8 "int r600_shader_from_nir(r600_context*, r600_pipe_shader*, r600_shader_key*)") at ./assert/assert.c:101
#7  0x00007fffeefe2396 in r600_shader_from_nir (rctx=0x7fff8c022880, pipeshader=0x7fff7c02e1e0, key=0x7fffc049bf1c) at ../src/gallium/drivers/r600/sfn/sfn_nir.cpp:832
#8  0x00007fffeee54fba in r600_pipe_shader_create (ctx=0x7fff8c022880, shader=0x7fff7c02e1e0, key=...) at ../src/gallium/drivers/r600/r600_shader.c:218
#9  0x00007fffeee8cb61 in r600_shader_select (ctx=0x7fff8c022880, sel=0x7fff7c02d540, dirty=0x7fffc049c047, precompile=true) at ../src/gallium/drivers/r600/r600_state_common.c:959
#10 0x00007fffeee184d0 in evergreen_create_compute_state (ctx=0x7fff8c022880, cso=0x7fffc049c0c8) at ../src/gallium/drivers/r600/evergreen_compute.c:451
#11 0x00007fffed9c6804 in mesa_rust::pipe::context::PipeContext::create_compute_state (self=0x7fffc049c9c0, nir=0x7fff8dca10a8, static_local_mem=0) at ../src/gallium/frontends/rusticl/mesa/pipe/context.rs:272
#12 0x00007fffed8deffd in rusticl::core::kernel::{impl#4}::launch::{closure#0} (q=0x7fff8c0ef408, ctx=0x7fffc049c9c0) at ../src/gallium/frontends/rusticl/core/kernel.rs:1007
#13 0x00007fffed8f158d in alloc::boxed::{impl#46}::call<(&alloc::sync::Arc<rusticl::core::queue::Queue>, &mesa_rust::pipe::context::PipeContext), dyn core::ops::function::Fn<(&alloc::sync::Arc<rusticl::core::queue::Queue>, &mesa_rust::pipe::context::PipeContext), Output=core::result::Result<(), i32>>, alloc::alloc::Global> (self=0x7fff8c0ef430, args=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1868
#14 0x00007fffed90a01e in rusticl::core::event::{impl#2}::call::{closure#0} (w=0x7fff8c0ef430) at ../src/gallium/frontends/rusticl/core/event.rs:168
#15 0x00007fffed93a848 in core::option::Option<&alloc::boxed::Box<dyn core::ops::function::Fn<(&alloc::sync::Arc<rusticl::core::queue::Queue>, &mesa_rust::pipe::context::PipeContext), Output=core::result::Result<(), i32>>, alloc::alloc::Global>>::map_or<&alloc::boxed::Box<dyn core::ops::function::Fn<(&alloc::sync::Arc<rusticl::core::queue::Queue>, &mesa_rust::pipe::context::PipeContext), Output=core::result::Result<(), i32>>, alloc::alloc::Global>, i32, rusticl::core::event::{impl#2}::call::{closure#0}> (self=..., default=2, f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/option.rs:946
#16 0x00007fffed909f54 in rusticl::core::event::Event::call (self=0x7fff8c0ef3f0, ctx=0x7fffc049c9c0) at ../src/gallium/frontends/rusticl/core/event.rs:164
#17 0x00007fffed991ffe in rusticl::core::queue::{impl#0}::new::{closure#0} () at ../src/gallium/frontends/rusticl/core/queue.rs:65
#18 0x00007fffed8f87fe in std::sys_common::backtrace::__rust_begin_short_backtrace<rusticl::core::queue::{impl#0}::new::{closure#0}, ()> (f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:123
#19 0x00007fffed95b8f1 in std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}<rusticl::core::queue::{impl#0}::new::{closure#0}, ()> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/thread/mod.rs:477
#20 0x00007fffed8d2631 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}> (self=..., _args=()) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panic/unwind_safe.rs:271
#21 0x00007fffed8e4832 in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (data=0x7fffc049cb08) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:406
#22 0x00007fffed8e51fb in __rust_try () from install/lib/x86_64-linux-gnu/libRusticlOpenCL.so.1
#23 0x00007fffed8e4720 in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>> (f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:370
#24 0x00007fffed918c21 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (f=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panic.rs:133
#25 0x00007fffed95b679 in std::thread::{impl#0}::spawn_unchecked::{closure#1}<rusticl::core::queue::{impl#0}::new::{closure#0}, ()> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/thread/mod.rs:476
#26 0x00007fffed9830ee in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked::{closure#1}, ()> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ops/function.rs:227
#27 0x00007fffedca5b83 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854
#28 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/boxed.rs:1854
#29 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#30 0x00007ffff50c8b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#31 0x00007ffff515aa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 6 (Thread 0x7fffc3f52640 (LWP 1408764) "luxmark"):
#0  __futex_abstimed_wait_common64 (private=-309338642, cancel=true, abstime=0x7fffc3f50498, op=137, expected=0, futex_word=0x7fff688837d8) at ./nptl/futex-internal.c:57
#1  __futex_abstimed_wait_common (cancel=true, private=-309338642, abstime=0x7fffc3f50498, clockid=-1191544736, expected=0, futex_word=0x7fff688837d8) at ./nptl/futex-internal.c:87
#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7fff688837d8, expected=expected@entry=0, clockid=clockid@entry=1, abstime=abstime@entry=0x7fffc3f50498, private=private@entry=0) at ./nptl/futex-internal.c:139
#3  0x00007ffff50c7f1b in __pthread_cond_wait_common (abstime=0x7fffc3f50498, clockid=1, mutex=0x7fffb978b770, cond=0x7fff688837b0) at ./nptl/pthread_cond_wait.c:503
#4  ___pthread_cond_timedwait64 (cond=0x7fff688837b0, mutex=0x7fffb978b770, abstime=0x7fffc3f50498) at ./nptl/pthread_cond_wait.c:652
#5  0x00007fffedc9d7d5 in std::sys::unix::condvar::Condvar::wait_timeout () at library/std/src/sys/unix/condvar.rs:114
#6  0x00007fffed8f889a in std::sys_common::condvar::Condvar::wait_timeout (self=0x7fff8c0ef4b0, mutex=0x7fff8c0ef440, dur=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/condvar.rs:56
#7  0x00007fffed8f8636 in std::sync::condvar::Condvar::wait_timeout<rusticl::core::event::EventMutState> (self=0x7fff8c0ef4b0, guard=..., dur=...) at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sync/condvar.rs:385
#8  0x00007fffed909dc1 in rusticl::core::event::Event::wait (self=0x7fff8c0ef3f0) at ../src/gallium/frontends/rusticl/core/event.rs:147
#9  0x00007fffed9925cb in rusticl::core::queue::Queue::flush (self=0x7fff8c0c0ed0, wait=true) at ../src/gallium/frontends/rusticl/core/queue.rs:91
#10 0x00007fffed8cb141 in rusticl::api::queue::finish_queue (command_queue=0x7fff8c0c0ed0) at ../src/gallium/frontends/rusticl/api/queue.rs:198
#11 0x00007fffed8c739e in rusticl::api::icd::cl_finish (command_queue=0x7fff8c0c0ed0) at ../src/gallium/frontends/rusticl/api/icd.rs:936
#12 0x000055555595dbbc in slg::PathOCLBaseRenderThread::InitRender() ()
#13 0x000055555595dc20 in slg::PathOCLBaseRenderThread::Start() ()
#14 0x000055555594eaf7 in slg::PathOCLBaseRenderEngine::StartLockLess() ()
#15 0x00005555557d1135 in slg::PathOCLRenderEngine::StartLockLess() ()
#16 0x000055555579c8aa in slg::RenderEngine::Start() ()
#17 0x000055555570a193 in LuxRenderSession::Start() ()
#18 0x00005555556e0ede in LuxMarkApp::EngineInitThreadImpl(LuxMarkApp*) ()
#19 0x0000555555a4d36b in thread_proxy ()
#20 0x00007ffff50c8b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#21 0x00007ffff515aa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

hread 1 (Thread 0x7ffff20efcc0 (LWP 1400022) "luxmark"):
#0  0x00007ffff514cd7f in __GI___poll (fds=0x55555a9b4b70, nfds=2, timeout=3880) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff4f59696 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff4f023c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff603a6d3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from install/lib/libQtCore.so.4
#4  0x00007ffff6519a97 in ?? () from install/lib/libQtGui.so.4
#5  0x00007ffff600e5e4 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from install/lib/libQtCore.so.4
#6  0x00007ffff600e8f6 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from install/lib/libQtCore.so.4
#7  0x00007ffff601393c in QCoreApplication::exec() () from install/lib/libQtCore.so.4
#8  0x00005555556c0e61 in main ()

Merge request reports