diff options
| author | bailu12300 <bailu12300@users.noreply.github.com> | 2026-11-24 03:55:56 +0800 |
|---|---|---|
| committer | bailu12300 <bailu12300@users.noreply.github.com> | 2026-11-24 03:55:56 +0800 |
| commit | e1ec785b2ddda4a00f7996951d4cc344fc9e7574 (patch) | |
| tree | 15a2ecb309a4e8b2db140ef4227a99b3554dcdc5 /runtime/src | |
| parent | 9cf192d92667103b9c7507a8631603d121962c08 (diff) | |
d3d12: ExecuteIndirect bounds the span max_count * stride, and checks the offset at max_count 0
d3d12_execute_indirect_validation reports five host-parity mismatches on the RTX 5060 and on
WARP: the layer accepts an argument buffer range the host refuses. Both live hosts bound the
bytes the signature can walk, max_count * stride, so a record that fits at the end of the
buffer while its stride runs past it is refused (offset 240 with stride 20 in a 256-byte
buffer), and both check the offset itself when max_count is 0, which the layer skipped
entirely.
The layer validated with (max_count - 1) * stride + record_size and only when max_count was
non-zero. It now uses the same span as the host and validates every call, in d3d12_com.cpp
(recording, so Close fails as the host's does) and in vulkan_replay.h (replay, which had its
own copy of the old arithmetic).
The test's positive GPU path recorded the same out-of-range calls the parity table marks as
refused, so it moves to an exact-fit range (244 + 12 == 256) and a max_count 0 no-op at the
buffer's end (offset 256), and the five parity rows take the verdict both hosts give here.
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/vulkan_replay.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h index 7ed8d251a..18fe802f8 100644 --- a/runtime/src/vulkan_replay.h +++ b/runtime/src/vulkan_replay.h | |||
| @@ -2997,8 +2997,13 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 2997 | const VkDeviceSize record_size = detail::indirect_record_size(ind->kind); | 2997 | const VkDeviceSize record_size = detail::indirect_record_size(ind->kind); |
| 2998 | if (!record_size || ind->stride < record_size || ind->stride % sizeof(std::uint32_t)) | 2998 | if (!record_size || ind->stride < record_size || ind->stride % sizeof(std::uint32_t)) |
| 2999 | return ReplayResult::invalid_indirect_arguments; | 2999 | return ReplayResult::invalid_indirect_arguments; |
| 3000 | const VkDeviceSize bytes = VkDeviceSize(ind->max_count - 1) * ind->stride + record_size; | 3000 | // The span is max_count * stride, the bytes the signature can walk, as D3D12 measures it: a record that |
| 3001 | if (!detail::indirect_range(p.binding, ind->argument_offset, bytes)) | 3001 | // fits at the end of the buffer while its stride runs past it is refused (`240` with stride `20` in a |
| 3002 | // `256`-byte buffer). A zero max_count still has to name an offset inside the buffer. | ||
| 3003 | if (ind->argument_offset > p.binding.size || | ||
| 3004 | ind->max_count > (p.binding.size - ind->argument_offset) / ind->stride || | ||
| 3005 | !detail::indirect_range(p.binding, ind->argument_offset, | ||
| 3006 | VkDeviceSize(ind->max_count) * ind->stride)) | ||
| 3002 | return ReplayResult::invalid_indirect_arguments; | 3007 | return ReplayResult::invalid_indirect_arguments; |
| 3003 | if (ind->count_buffer) { | 3008 | if (ind->count_buffer) { |
| 3004 | const ResourceBinding* cnt = resolve(ind->count_buffer); | 3009 | const ResourceBinding* cnt = resolve(ind->count_buffer); |