Skip to content

Ignore maxFragmentCombinedOutputResources for Mesa's Honeykrisp driver#9393

Open
im-0 wants to merge 1 commit intogfx-rs:trunkfrom
im-0:do-not-reduce-limits-on-honeykrisp
Open

Ignore maxFragmentCombinedOutputResources for Mesa's Honeykrisp driver#9393
im-0 wants to merge 1 commit intogfx-rs:trunkfrom
im-0:do-not-reduce-limits-on-honeykrisp

Conversation

@im-0
Copy link
Copy Markdown
Contributor

@im-0 im-0 commented Apr 8, 2026

Connections
Fixes #9391

Description

Currently, many wgpu apps that request the device with Limits::defaults() fail to start on Asahi Linux with following error message:

Limit 'max_color_attachments' value 8 is better than allowed 5

This includes wgpu's own wgpu-example-02-hello-window.

Value of '5' looked weirdly non-power-of-two and thus hightly sus, so I tried to investigate where exactly wgpu gets it. It looks like this was recently added by f06431f: new code divides maxFragmentCombinedOutputResources by 3 for all GPU vendors except of those who produce known to be wrong maxFragmentCombinedOutputResources.

I am not 100% sure that Honeykrisp driver should also be exempt from this, but glxinfo reports GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES=248 on the same Apple M2 Max laptop with Asahi's OpenGL driver. If I understand correctly, GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES is a closest analog for maxFragmentCombinedOutputResources. It seems that max_combined_shader_output_resources is never set by OpenGL driver[1] and instead calculated by adding underlying limits by some "defaults" handling code. Also, as the same wgpu allows the same limits just fine on macOS with Metal backend on the same hardware, underlying hardware seems to support those limits.

If you are interested, maxFragmentCombinedOutputResources=16 for Honeykrisp was added by initial commit[2] and never changed since.

[1] https://gitlab.freedesktop.org/mesa/mesa/-/tree/main/src/gallium/drivers/asahi
[2] https://gitlab.freedesktop.org/mesa/mesa/-/commit/5bc828481630147575348b66677edaade9e891e6#line_ed3b525e6_A660

Testing
No idea about what is the right way to test this. I just ran cargo xtask test before and after the patch.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests.
  • Run cargo xtask test to run tests. Same amount of failed tests with and without this patch (llvmpipe seems unrelated):
     Summary [  20.284s] 1551 tests run: 1511 passed, 40 failed, 18 skipped
        FAIL [   0.003s] naga::naga snapshots::convert_snapshots_spv
        FAIL [   0.165s] player::player test_api
        FAIL [   1.174s] wgpu-examples [Executed Failure: BACKEND] [Vulkan/Apple M2 Max (G14C B1)/0] water
        FAIL [   1.231s] wgpu-examples [Executed Failure: BACKEND] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] water
     SIGSEGV [   0.255s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_aabb_compute
     SIGSEGV [   0.258s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_cube_compute
     SIGSEGV [   0.320s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_cube_fragment
     SIGSEGV [   0.209s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_cube_normals
     SIGSEGV [   0.208s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_scene
     SIGSEGV [   0.322s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_shadows
     SIGSEGV [   0.345s] wgpu-examples [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] ray_traced_triangle
        FAIL [   0.074s] wgpu-test::wgpu-gpu [Executed Failure: BACKEND] [Vulkan/Apple M2 Max (G14C B1)/0] wgpu_gpu::regression::issue_5231_9343::read_only_depth_with_sampled_binding
        FAIL [   0.090s] wgpu-test::wgpu-gpu [Executed Failure: BACKEND] [Vulkan/Apple M2 Max (G14C B1)/0] wgpu_gpu::regression::issue_5231_9343::read_only_depth_without_texture_binding
        FAIL [   0.118s] wgpu-test::wgpu-gpu [Executed Failure: BACKEND] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::regression::issue_5231_9343::read_only_depth_with_sampled_binding
        FAIL [   0.101s] wgpu-test::wgpu-gpu [Executed Failure: BACKEND] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::regression::issue_5231_9343::read_only_depth_without_texture_binding
        FAIL [   0.058s] wgpu-test::wgpu-gpu [Executed] [Vulkan/Apple M2 Max (G14C B1)/0] wgpu_gpu::multiview::draw_multiview_noncontiguous
        FAIL [   0.071s] wgpu-test::wgpu-gpu [Executed] [Vulkan/Apple M2 Max (G14C B1)/0] wgpu_gpu::passthrough::all_passthrough_shaders_binary
        FAIL [   0.047s] wgpu-test::wgpu-gpu [Executed] [Vulkan/Apple M2 Max (G14C B1)/0] wgpu_gpu::passthrough::all_passthrough_shaders_source
        FAIL [   0.054s] wgpu-test::wgpu-gpu [Executed] [Vulkan/Apple M2 Max (G14C B1)/0] wgpu_gpu::passthrough::spirv_passthrough_shader
        FAIL [   0.080s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::binding_array::samplers::binding_array_samplers
        FAIL [   0.039s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::binding_array::samplers::partial_binding_array_samplers
     SIGSEGV [   0.201s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::binding_array::tlas::binding_array_tlas
        FAIL [   0.080s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::passthrough::all_passthrough_shaders_binary
        FAIL [   0.068s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::passthrough::all_passthrough_shaders_source
        FAIL [   0.065s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::passthrough::spirv_passthrough_shader
     SIGSEGV [   0.270s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_aabb::aabb_blas_build_and_trace
     SIGSEGV [   0.317s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::blas_compaction
     SIGSEGV [   0.305s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::blas_compaction_without_flags
     SIGSEGV [   0.288s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::blas_first_vertex
     SIGSEGV [   0.276s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::build_with_transform
     SIGSEGV [   0.224s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::extra_format_build
     SIGSEGV [   0.291s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::only_blas_vertex_return
     SIGSEGV [   0.200s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::out_of_order_as_build
     SIGSEGV [   0.296s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::out_of_order_as_build_use
     SIGSEGV [   0.234s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_build::unprepared_blas_compaction
     SIGSEGV [   0.267s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::as_use_after_free::acceleration_structure_use_after_free
     SIGSEGV [   0.240s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::scene::acceleration_structure_build_no_index
     SIGSEGV [   0.323s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::scene::acceleration_structure_build_with_index
     SIGSEGV [   0.195s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::shader::access_all_struct_members
     SIGSEGV [   0.204s] wgpu-test::wgpu-gpu [Executed] [Vulkan/llvmpipe (LLVM 21.1.8, 128 bits)/1] wgpu_gpu::ray_tracing::shader::prevent_invalid_ray_query_calls
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@im-0
Copy link
Copy Markdown
Contributor Author

im-0 commented Apr 8, 2026

Created new issue in Mesa: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15249

@cwfitzgerald cwfitzgerald self-assigned this Apr 8, 2026
Copy link
Copy Markdown
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM minus some nits, this is a mesa bug, but we will need to ignore it on older driver versions anyway. Per the upstream bug we should also ignore it on mvk,

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) April 9, 2026 02:17
@cwfitzgerald cwfitzgerald disabled auto-merge April 9, 2026 02:17
@im-0
Copy link
Copy Markdown
Contributor Author

im-0 commented Apr 9, 2026

Per the upstream bug we should also ignore it on mvk,

You mean nvk? Existing code already catches that by vendor_id == crate::auxil::db::nvidia::VENDOR. And now, when I am thinking about it, this feels like wrong thing to do. maxFragmentCombinedOutputResources is reported by driver, but there are multiple independent driver implementations for at least NV, AMD and Intel GPUs.

@marysaka
Copy link
Copy Markdown

marysaka commented Apr 9, 2026

LGTM minus some nits, this is a mesa bug, but we will need to ignore it on older driver versions anyway. Per the upstream bug we should also ignore it on mvk,

For reference, I just tested on NVK and #9391 does not reproduce (but it reproduce as expected on Honeykrisp)
In any cases, I will push a fix for maxFragmentCombinedOutputResources limit on NVK side.

EDIT: Seems that I missed the vendorID ignore... this should really match on the driver ID and not the vendorID.

Currently, many wgpu apps that request the device with
Limits::defaults() fail to start on Asahi Linux with following error message:

	Limit 'max_color_attachments' value 8 is better than allowed 5

This includes wgpu's own `wgpu-example-02-hello-window`.

Value of '5' looked weirdly non-power-of-two and thus hightly sus, so I
tried to investigate where exactly wgpu gets it. It looks like this
was recently added by f06431f: new code divides
maxFragmentCombinedOutputResources by 3 for all GPU vendors except of
those who produce known to be wrong maxFragmentCombinedOutputResources.

I am not 100% sure that Honeykrisp driver should also be exempt from
this, but glxinfo reports GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES=248
on the same Apple M2 Max laptop with Asahi's OpenGL driver. If I
understand correctly, GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES is a
closest analog for maxFragmentCombinedOutputResources. It seems that
`max_combined_shader_output_resources` is never set by OpenGL driver[1]
and instead calculated by adding underlying limits by some "defaults"
handling code. Also, as the same wgpu allows the same limits just fine on macOS
with Metal backend on the same hardware, underlying hardware seems to
support those limits.

If you are interested, maxFragmentCombinedOutputResources=16 for Honeykrisp
was added by initial commit[2] and never changed since.

[1] https://gitlab.freedesktop.org/mesa/mesa/-/tree/main/src/gallium/drivers/asahi
[2] https://gitlab.freedesktop.org/mesa/mesa/-/commit/5bc828481630147575348b66677edaade9e891e6#line_ed3b525e6_A660

Fixes gfx-rs#9391
@im-0 im-0 force-pushed the do-not-reduce-limits-on-honeykrisp branch from a7e6095 to ba5e7b3 Compare April 9, 2026 11:19
@im-0 im-0 requested a review from cwfitzgerald April 10, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limits exceeded error using wgpu 29 on Asahi Linux on MacBook m2

3 participants