r600: set clear_buffer = u_default_clear_buffer
It avoids “Context missing features” assertion when r600 is enabled in rusticl.
I have this kind of hardware plugged in (first is TeraScale 3, second is TeraScale 2):
$ printf '0300 0302 0380' \
| xargs -d' ' -I{} lspci -d ::{} -nn -mm -k -v
Slot: 01:00.0
Class: VGA compatible controller [0300]
Vendor: Advanced Micro Devices, Inc. [AMD/ATI] [1002]
Device: Cayman XT [Radeon HD 6970] [6718]
SVendor: XFX Pine Group Inc. [1682]
SDevice: Cayman XT [Radeon HD 6970] [3130]
Driver: radeon
Module: radeon
NUMANode: 0
Slot: 06:00.0
Class: VGA compatible controller [0300]
Vendor: Advanced Micro Devices, Inc. [AMD/ATI] [1002]
Device: Cypress XT [Radeon HD 5870] [6898]
SVendor: Advanced Micro Devices, Inc. [AMD/ATI] [1002]
SDevice: Radeon HD 5870 Eyefinity⁶ Edition [0b00]
Driver: radeon
Module: radeon
NUMANode: 0
I tried this:
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index fc7d8d46e12..5188f9d369d 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -631,6 +631,9 @@ static int r600_get_shader_param(struct pipe_screen* pscreen,
ir |= 1 << PIPE_SHADER_IR_TGSI;
if (is_nir_enabled(&rscreen->b)) {
ir |= 1 << PIPE_SHADER_IR_NIR;
+ if (shader == PIPE_SHADER_COMPUTE) {
+ ir |= 1 << PIPE_SHADER_IR_NIR_SERIALIZED;
+ }
}
return ir;
}
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
index 938ff9d0efd..722c001d88d 100644
--- a/src/gallium/targets/rusticl/meson.build
+++ b/src/gallium/targets/rusticl/meson.build
@@ -45,6 +45,7 @@ librusticl = shared_library(
driver_iris,
driver_nouveau,
driver_panfrost,
+ driver_r600,
driver_radeonsi,
driver_swrast,
idep_nir,
I got this:
$ RUST_BACKTRACE=full clinfo -l
thread '<unnamed>' panicked at 'Context missing features. This should never happen!', ../src/gallium/frontends/rusticl/mesa/pipe/context.rs:44:13
stack backtrace:
0: 0x7f3d092aadcc - std::backtrace_rs::backtrace::libunwind::trace::h91c465e73bf6c785
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f3d092aadcc - std::backtrace_rs::backtrace::trace_unsynchronized::hae9da36f5d58b5f3
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f3d092aadcc - std::sys_common::backtrace::_print_fmt::h7f499fa126a7effb
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7f3d092aadcc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3e2b509ce2ce6007
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7f3d0931851c - core::fmt::write::h753c7571fa063ecb
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/fmt/mod.rs:1168:17
5: 0x7f3d09299b53 - std::io::Write::write_fmt::h2815c0519c99ba09
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/io/mod.rs:1660:15
6: 0x7f3d092aeed2 - std::sys_common::backtrace::_print::h64941a6fc8b0ed9b
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7f3d092aeed2 - std::sys_common::backtrace::print::hcf25e43e1a9b0766
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7f3d092aeed2 - std::panicking::default_hook::{{closure}}::h78d3e6cf97fc623d
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:211:50
9: 0x7f3d092aeab5 - std::panicking::default_hook::hda898f8d3ad1a5ae
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:228:9
10: 0x7f3d092af763 - std::panicking::rust_panic_with_hook::h1a5ea2d6c23051aa
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:606:17
11: 0x7f3d092af452 - std::panicking::begin_panic_handler::{{closure}}::h07f549390938b73f
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:500:13
12: 0x7f3d092ab274 - std::sys_common::backtrace::__rust_end_short_backtrace::h5ec3758a92cfb00d
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sys_common/backtrace.rs:139:18
13: 0x7f3d092af1b9 - rust_begin_unwind
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:498:5
14: 0x7f3d093152b1 - core::panicking::panic_fmt::h3a79a6a99affe1d5
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:116:14
15: 0x7f3d08fdba5e - mesa_rust::pipe::context::PipeContext::new::he4d8853cd68bd26d
at src/gallium/frontends/rusticl/mesa/pipe/context.rs:44:13
16: 0x7f3d08fd329c - mesa_rust::pipe::screen::PipeScreen::create_context::h5cea8aed4b1b02e7
at src/gallium/frontends/rusticl/mesa/pipe/screen.rs:72:9
17: 0x7f3d08f1b3b2 - rusticl::core::device::Device::new::hbda71411eb88a2be
at src/gallium/frontends/rusticl/core/device.rs:180:36
18: 0x7f3d08f98f88 - core::ops::function::FnMut::call_mut::he860c4a3be91c61f
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ops/function.rs:150:5
19: 0x7f3d08f0a5b2 - core::iter::adapters::filter_map::filter_map_try_fold::{{closure}}::hdca92cdbd8607aec
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/iter/adapters/filter_map.rs:46:28
20: 0x7f3d08f800e0 - core::iter::traits::iterator::Iterator::try_fold::hcc8c3fe64c3bce22
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/iter/traits/iterator.rs:1995:21
21: 0x7f3d08f0a8e5 - <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h15b1882bb6f1853f
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/iter/adapters/filter_map.rs:77:9
22: 0x7f3d08f0ab11 - <I as alloc::vec::source_iter_marker::SpecInPlaceCollect<T,I>>::collect_in_place::h00d42edb0857626e
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/vec/source_iter_marker.rs:126:13
23: 0x7f3d08f33dc9 - alloc::vec::source_iter_marker::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter::hc175d1d4fe318a9e
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/vec/source_iter_marker.rs:45:19
24: 0x7f3d08f414cf - <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter::h5507c8a4cf5a9dcd
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/alloc/src/vec/mod.rs:2541:9
25: 0x7f3d08f0c468 - core::iter::traits::iterator::Iterator::collect::hc2a438e4fb8e5f01
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/iter/traits/iterator.rs:1745:9
26: 0x7f3d08f1df04 - rusticl::core::device::Device::all::h10d1eda61ccf219b
at src/gallium/frontends/rusticl/core/device.rs:525:9
27: 0x7f3d08f6f724 - rusticl::api::device::load_devices::h491193ab99d5ee35
at src/gallium/frontends/rusticl/api/device.rs:207:5
28: 0x7f3d08f9a3a9 - core::ops::function::FnOnce::call_once::hf9ac5a15cbd8444c
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ops/function.rs:227:5
29: 0x7f3d08ee87d5 - std::sync::once::Once::call_once::{{closure}}::h89c4e131ad437062
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sync/once.rs:269:41
30: 0x7f3d092a913a - std::sync::once::Once::call_inner::h222a34e71c71c7d0
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sync/once.rs:426:21
31: 0x7f3d08ee86b6 - std::sync::once::Once::call_once::ha80841833266b8dc
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/sync/once.rs:269:9
32: 0x7f3d08f6f76d - rusticl::api::device::devs::h6eeca5798bd4e62f
at src/gallium/frontends/rusticl/api/device.rs:213:5
33: 0x7f3d08f6f798 - rusticl::api::device::get_devs_for_type::hbad94411c005df3f
at src/gallium/frontends/rusticl/api/device.rs:218:5
34: 0x7f3d08f6fae2 - rusticl::api::device::get_device_ids::h219f999a859eb168
at src/gallium/frontends/rusticl/api/device.rs:247:16
35: 0x7f3d08edbf21 - rusticl::api::icd::cl_get_device_ids::h73164af9ca567064
at src/gallium/frontends/rusticl/api/icd.rs:454:16
36: 0x7f3d3efbe695 - <unknown>
37: 0x7f3d3efbefeb - clGetPlatformIDs
38: 0x55f060a19765 - <unknown>
39: 0x7f3d3edafd90 - __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
40: 0x7f3d3edafe40 - __libc_start_main_impl
at ./csu/../csu/libc-start.c:392:3
41: 0x55f060a19e0e - <unknown>
fatal runtime error: failed to initiate panic, error 5
It asserted there:
src/gallium/frontends/rusticl/mesa/pipe/context.rs
impl PipeContext {
pub(super) fn new(context: *mut pipe_context, screen: &Arc<PipeScreen>) -> Option<Self> {
let s = Self {
pipe: NonNull::new(context)?,
screen: screen.clone(),
};
if !has_required_cbs(unsafe { s.pipe.as_ref() }) {
assert!(false, "Context missing features. This should never happen!");
If I apply this patch then enabling r600 in rusticl, I get this:
$ clinfo -l
Platform #0: rusticl
+-- Device #0: AMD CAYMAN (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
`-- Device #1: AMD CYPRESS (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
$ clinfo
Number of platforms 1
Platform Name rusticl
Platform Vendor Mesa/X.org
Platform Version OpenCL 3.0
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions with Version cl_khr_icd 0x400000 (1.0.0)
Platform Numeric Version 0xc00000 (3.0.0)
Platform Extensions function suffix MESA
Platform Host timer resolution 0ns
Platform Name rusticl
Number of devices 2
Device Name AMD CAYMAN (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
Device Vendor AMD
Device Vendor ID 0x1002
Device Version OpenCL 1.2
Driver Version 22.3.0-devel (git-ff649a893a)
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile EMBEDDED_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 12
Max clock frequency 880MHz
Device Partition (core)
Max number of sub-devices 0
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 1024x1024x1024
Max work group size 1024
Preferred work group size multiple (kernel) 64
Preferred / native vector sizes
char 1 / 1
short 1 / 1
int 1 / 1
long 1 / 1
half 0 / 0 (n/a)
float 1 / 1
double 0 / 0 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 2147483648 (2GiB)
Error Correction support No
Max memory allocation 536870912 (512MiB)
Unified memory for Host and Device No
Minimum alignment for any data type 128 bytes
Alignment of base address 4096 bits (512 bytes)
Global Memory cache type None
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 536870912 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 16384x16384 pixels
Max 3D image size 2048x2048x2048 pixels
Max number of read image args 16
Max number of write image args 8
Local memory type Global
Local memory size 32768 (32KiB)
Max number of constant args 1024
Max constant buffer size 536870912 (512MiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 0ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
printf() buffer size 1048576 (1024KiB)
Built-in kernels (n/a)
Device Extensions cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cles_khr_int64
Device Name AMD CYPRESS (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
Device Vendor AMD
Device Vendor ID 0x1002
Device Version OpenCL 1.2
Driver Version 22.3.0-devel (git-ff649a893a)
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile EMBEDDED_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 10
Max clock frequency 850MHz
Device Partition (core)
Max number of sub-devices 0
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 1024x1024x1024
Max work group size 1024
Preferred work group size multiple (kernel) 64
Preferred / native vector sizes
char 1 / 1
short 1 / 1
int 1 / 1
long 1 / 1
half 0 / 0 (n/a)
float 1 / 1
double 0 / 0 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 2147483648 (2GiB)
Error Correction support No
Max memory allocation 536870912 (512MiB)
Unified memory for Host and Device No
Minimum alignment for any data type 128 bytes
Alignment of base address 4096 bits (512 bytes)
Global Memory cache type None
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 536870912 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 16384x16384 pixels
Max 3D image size 2048x2048x2048 pixels
Max number of read image args 16
Max number of write image args 8
Local memory type Global
Local memory size 32768 (32KiB)
Max number of constant args 1024
Max constant buffer size 536870912 (512MiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 0ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
printf() buffer size 1048576 (1024KiB)
Built-in kernels (n/a)
Device Extensions cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cles_khr_int64
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) rusticl
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [MESA]
clCreateContext(NULL, ...) [default] Success [MESA]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (2)
Platform Name rusticl
Device Name AMD CAYMAN (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
Device Name AMD CYPRESS (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (2)
Platform Name rusticl
Device Name AMD CAYMAN (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
Device Name AMD CYPRESS (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (2)
Platform Name rusticl
Device Name AMD CAYMAN (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
Device Name AMD CYPRESS (DRM 2.50.0 / 5.15.0-48-generic, LLVM 16.0.0)
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.14
ICD loader Profile OpenCL 3.0