Skip to content

Commit

Permalink
[dawn][d3d12] Improve limitation on storage buffers on QC
Browse files Browse the repository at this point in the history
The storage buffer binding size was limited to 2^27 but further
clarifications showed that since we only use [RW]ByteAddressBuffer, the
binding size can be 2^29 (still lower than D3D12's requirement of 2^31).

Bug: 364384943
Bug: 42242119
Change-Id: Ib5ae58d7e49b4093f6399497cbe528f05661a350
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/212895
Commit-Queue: Corentin Wallez <[email protected]>
Reviewed-by: Rafael Cintron <[email protected]>
Reviewed-by: Loko Kung <[email protected]>
  • Loading branch information
Kangz authored and Dawn LUCI CQ committed Nov 2, 2024
1 parent 0856adf commit 3a212ce
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,19 +354,9 @@ MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits)
// Max number of "constants" where each constant is a 16-byte float4
limits->v1.maxUniformBufferBindingSize = D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * 16;

if (gpu_info::IsQualcomm_ACPI(GetVendorId())) {
// limit of number of texels in a buffer == (1 << 27)
// D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP
// This limit doesn't apply to a raw buffer, but only applies to
// typed, or structured buffer. so this could be a QC driver bug.
limits->v1.maxStorageBufferBindingSize = uint64_t(1)
<< D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP;
} else {
limits->v1.maxStorageBufferBindingSize = kAssumedMaxBufferSize;
}

// D3D12 has no documented limit on the buffer size.
limits->v1.maxBufferSize = kAssumedMaxBufferSize;
limits->v1.maxStorageBufferBindingSize = kAssumedMaxBufferSize;

// 1 for SV_Position and 1 for (SV_IsFrontFace OR SV_SampleIndex).
// See the discussions in https://github.com/gpuweb/gpuweb/issues/1962 for more details.
Expand All @@ -385,6 +375,14 @@ MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits)
// https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics#:~:text=UINT%20WaveLaneCountMax
limits->experimentalSubgroupLimits.maxSubgroupSize = 128u;

if (gpu_info::IsQualcomm_ACPI(GetVendorId())) {
// Due to a driver and hardware limitation, Raw Buffers can only address 2^27 WORDS instead
// of the guaranteeed 2^31 bytes. Probably because it uses some form of texel buffer of
// 32bit values to implement [RW]ByteAddressBuffer.
limits->v1.maxStorageBufferBindingSize = sizeof(uint32_t)
<< D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP;
}

return {};
}

Expand Down

0 comments on commit 3a212ce

Please sign in to comment.