Skip to content

Commit 768d5f4

Browse files
[metal] Increase MAX_COMMAND_BUFFERS (#7858)
1 parent d13e9f5 commit 768d5f4

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

cts_runner/test.lst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ webgpu:api,operation,compute,basic:memcpy:*
55
//FAIL: webgpu:api,operation,compute,basic:large_dispatch:*
66
webgpu:api,operation,compute_pipeline,overrides:*
77
webgpu:api,operation,device,lost:*
8+
webgpu:api,validation,encoding,beginComputePass:*
9+
webgpu:api,validation,encoding,beginRenderPass:*
810
webgpu:api,validation,encoding,cmds,clearBuffer:*
911
webgpu:api,validation,encoding,cmds,compute_pass:set_pipeline:*
1012
webgpu:api,validation,encoding,cmds,compute_pass:dispatch_sizes:*
@@ -31,13 +33,22 @@ webgpu:api,validation,encoding,encoder_open_state:render_pass_commands:*
3133
//FAIL: webgpu:api,validation,encoding,encoder_open_state:render_bundle_commands:*
3234
// https://github.com/gfx-rs/wgpu/issues/7857
3335
webgpu:api,validation,encoding,encoder_open_state:compute_pass_commands:*
34-
webgpu:api,validation,encoding,beginComputePass:*
35-
webgpu:api,validation,encoding,beginRenderPass:*
36+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="compute%20pass";*
37+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_binding_mismatch:encoderType="render%20pass";*
38+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="compute%20pass";*
39+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_resource_type_mismatch:encoderType="render%20pass";*
40+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="compute%20pass";*
41+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bgl_visibility_mismatch:encoderType="render%20pass";*
42+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="compute%20pass";*
43+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:bind_groups_and_pipeline_layout_mismatch:encoderType="render%20pass";*
44+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:buffer_binding,render_pipeline:*
45+
webgpu:api,validation,encoding,programmable,pipeline_bind_group_compat:sampler_binding,render_pipeline:*
3646
webgpu:api,validation,queue,submit:command_buffer,device_mismatch:*
3747
webgpu:api,validation,queue,submit:command_buffer,duplicate_buffers:*
3848
webgpu:api,validation,queue,submit:command_buffer,submit_invalidates:*
3949
//FAIL: webgpu:api,validation,queue,submit:command_buffer,invalid_submit_invalidates:*
4050
// https://github.com/gfx-rs/wgpu/issues/3911#issuecomment-2972995675
51+
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,*
4152
webgpu:api,operation,render_pipeline,overrides:*
4253
webgpu:api,operation,rendering,basic:clear:*
4354
webgpu:api,operation,rendering,basic:fullscreen_quad:*

wgpu-hal/src/metal/adapter.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,24 @@ use alloc::sync::Arc;
1010

1111
use super::TimestampQuerySupport;
1212

13-
const MAX_COMMAND_BUFFERS: u64 = 2048;
13+
/// Maximum number of command buffers for `MTLCommandQueue`s that we create.
14+
///
15+
/// If a [new command buffer] is requested when Metal has run out of command
16+
/// buffers, it waits indefinitely for one to become available. If the
17+
/// outstanding command buffers are actively executing on the GPU, this will
18+
/// happen relatively quickly. But if the outstanding command buffers will only
19+
/// be recovered upon GC, and attempting to get a new command buffer prevents
20+
/// forward progress towards that GC, there is a deadlock.
21+
///
22+
/// This is mostly a problem for the CTS, which frequently creates command
23+
/// buffers that it does not submit. It is unclear how likely command buffer
24+
/// exhaustion is in real applications.
25+
///
26+
/// This limit was increased from a previous value of 2048 for
27+
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1971452>.
28+
///
29+
/// [new command buffer]: https://developer.apple.com/documentation/metal/mtlcommandqueue/makecommandbuffer()?language=objc
30+
const MAX_COMMAND_BUFFERS: u64 = 4096;
1431

1532
unsafe impl Send for super::Adapter {}
1633
unsafe impl Sync for super::Adapter {}

0 commit comments

Comments
 (0)