Files
test2/build_files/build_environment/patches/usd_3666_vulkan_amd.diff
Jeroen Bakker 3a4c4c88fa Fix #139882: Vulkan/USD: Crash on AMD GPUs
When USD sends work to the GPU (dispatch) incorrect datatype conversions
can send incorrect vulkan commands. This happens on AMD GPUs. This PR
will patch USD to limit the max allowed limit. A better solution would
be to only use uint32_t in this function, but there is no `GfVec3u` data
type and I didn't want to do to many changes.

![image.png](/attachments/642bd3d5-c6b6-4e1a-be1c-be847e6893bd)

**TODO**

- [x] Validate with @ZedDB that this compiles and solves all the issues
- [x] Add other platform maintainers as reviewers. This is a Windows + Linux issue.
- [ ] Rebuild the USD library including this patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/140102
2025-06-23 07:55:17 +02:00

20 lines
1.0 KiB
Diff

diff --git a/pxr/imaging/hgiVulkan/computeCmds.cpp b/pxr/imaging/hgiVulkan/computeCmds.cpp
index cbf9704fd..74a81c787 100644
--- a/pxr/imaging/hgiVulkan/computeCmds.cpp
+++ b/pxr/imaging/hgiVulkan/computeCmds.cpp
@@ -119,10 +119,11 @@ HgiVulkanComputeCmds::Dispatch(int dimX, int dimY)
// Determine device's num compute work group limits
const VkPhysicalDeviceLimits limits =
_hgi->GetCapabilities()->vkDeviceProperties.limits;
+ const uint32_t maxAllowedLimit = (1 << 31) - 1;
const GfVec3i maxNumWorkGroups = GfVec3i(
- limits.maxComputeWorkGroupCount[0],
- limits.maxComputeWorkGroupCount[1],
- limits.maxComputeWorkGroupCount[2]);
+ std::min<uint32_t>(maxAllowedLimit, limits.maxComputeWorkGroupCount[0]),
+ std::min<uint32_t>(maxAllowedLimit, limits.maxComputeWorkGroupCount[1]),
+ std::min<uint32_t>(maxAllowedLimit, limits.maxComputeWorkGroupCount[2]));
if (numWorkGroupsX > maxNumWorkGroups[0]) {
TF_WARN("Max number of work group available from device is %i, larger "