Hold creation_refuses_what_metal_refuses' slot-limit refusal to as many commands as pass the device's limit
The refusal of 2^32 - 1 buffer slots a command named the device's max_buffer_length for two commands. Their slots take 2 x (2^32 - 32) x 16 bytes, about 128 GiB: past the M3's and lavapipe's limits, but within the NVIDIA RTX 5080 Laptop's 2^40 (min(maxBufferSize, maxMemoryAllocationSize)), so the runtime laid them out and the device's memory refused them, OutOfMemory(Device), as new_indirect_command_buffer documents. Metal makes no defined storage at that count (its creation ends the process at 2^32 - 1 slots of 8 commands), so neither answer is a refusal Metal gives; the runtime's contract stands and the test was wrong about the limit. The test now asks for limit / (2^32 - 1) + 1 commands, whose slots pass the limit on every device, and expects the gap naming it. Verified: expected on the 5080 and the M3 (runs pending). (cherry picked from commit 5aaa1525227b257199e2712dca56a4d495f3f86e)
This commit is contained in:
1 parent
cd8d288a55
commit
a80176d2e1
1 file changed
+10
-4
@@ -465,15 +465,21 @@ fn creation_refuses_what_metal_refuses() {
|
||||
// buffer of the device's `max_buffer_length` cannot hold are the gap naming the limit:
|
||||
// plain Metal makes such a buffer and lays out no slots in it (16 KiB at 2^31 kernel
|
||||
// buffers, whose `setKernelBuffer:atIndex:` at index 2^31 then ends the process), and the
|
||||
// runtime lays out every slot it answers for.
|
||||
// runtime lays out every slot it answers for. The commands are as many as put 2^32 - 1
|
||||
// slots a command past the limit on every device, whatever its `max_buffer_length`: a
|
||||
// slot takes 16 bytes, so `limit / (2^32 - 1) + 1` commands' slots pass it. Two commands'
|
||||
// do not pass 2^40, an NVIDIA RTX 5080 Laptop's limit, and its memory refuses their 128
|
||||
// GiB (`OutOfMemory`, which the runtime documents).
|
||||
let [buffers_max, lengths_max, vertex_max, fragment_max] = counts(u32::MAX);
|
||||
assert_eq!(icb(device, &lengths_max, 2).size(), 2);
|
||||
let limit = device.properties().max_buffer_length;
|
||||
let past = limit / u64::from(u32::MAX) + 1;
|
||||
for descriptor in [buffers_max, vertex_max, fragment_max] {
|
||||
assert_eq!(
|
||||
refused(&descriptor, 2, shared),
|
||||
refused(&descriptor, past, shared),
|
||||
Error::NotImplemented(RuntimeGap::IndirectCommandBufferPastMaxBufferLength {
|
||||
count: 2,
|
||||
max_buffer_length: device.properties().max_buffer_length,
|
||||
count: past,
|
||||
max_buffer_length: limit,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user