-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autodesk: Fix HdSt tests failing under HgiVulkan with Lavapipe #3170
Autodesk: Fix HdSt tests failing under HgiVulkan with Lavapipe #3170
Conversation
Filed as internal issue #USD-9861 |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
01a7ae9
to
5a9c960
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
…to fix failing HdSt tests when using Lavapipe. However, this change fixes a hang in many situations when using HgiVulkan, not just for Lavapipe. From PR description: testHdStDrawItemsCache - Problem: is consuming command buffers faster than Lavapipe can execute them, so it reaches the maximum allowed inflight of 64. Normally buffers would be reset by _EndFrameSync after submission (or by EndFrame if it gets called), but since this sync is non-blocking, and Lavapipe is slow, it's called too early and does nothing (because all the buffers are still executing). And since all these calls must be on the main thread, it deadlocks: main thread is waiting for more command buffers, but those require calling _EndFrameSync to be made available, which it can't do because it's blocked... - Fix: Be smarter about allocating in-flight bits: search for the next available bit. If no in-flight bits are available, then update the existing command buffers in-flight status to release ones no longer in use, instead of just waiting (which is a deadlock). See #3170. (Internal change: 2336072)
pxr/imaging/hdSt/codeGen.cpp
Outdated
@@ -4611,6 +4718,8 @@ HdSt_CodeGen::_GenerateDrawingCoord( | |||
/*name=*/name, | |||
/*dataType=*/_tokens->_int); | |||
} | |||
|
|||
_PlumbInterstageElements(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out this if (!_hasCS) { ... _PlumbInterstageElements(); }
block should be moved after the static const std::vector<std::string> drawingCoordParams { ... }
block near the top of the function. Otherwise the code at line 4433 doesn't find the mapping. It's also missing the "vs_" prefix.
bb4fc08
to
cfe2c61
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -69,7 +69,8 @@ _SupportsPresentation( | |||
vkGetInstanceProcAddr( | |||
vkInstance, | |||
"vkGetPhysicalDeviceXlibPresentationSupportKHR"); | |||
return vkGetPhysicalDeviceXlibPresentationSupportKHR( | |||
return vkGetPhysicalDeviceXlibPresentationSupportKHR && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, this gives me a compilation error: the address of 'VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice, uint32_t, Display*, VisualID)' will never be NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting, I actually observed this being null, when I used Lavapipe headless (didn't build it with X support). Is it a warning as an error or an actual error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a warning as an error. Do you know if there's some define we can use to branch this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the WSI macros? https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/WSIheaders.html
Nevermind, we're already using those. I might need to retest this to understand what's going wrong better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vkGetInstanceProcAddr
can return null, so I don't understand why the compiler would warn here.
pxr/imaging/hdSt/codeGen.cpp
Outdated
std::string const index = std::to_string(i); | ||
ss << " " << outputPrefix << "instanceCoordsI" << index << outArraySize | ||
<< " = " << "dc.instanceCoords[" << index << "]" << ";\n"; | ||
const auto [groupName, component] = _GetDrawingCoordMapping("instanceIndexI" + std::to_string(i)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: "instanceIndexI"
should be "instanceCoordsI"
cfe2c61
to
f1aee83
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
failing HdSt tests when using Lavapipe. From PR description: testHdStBasicDrawing Problem: geometry shaders with more than VkPhysicalDeviceLimits::maxGeometryInputComponents input locations are being generated. Fix: Inputs are passed as arrays of int, consuming one location per int. Instead pack them into ivec4 (for array sizes smaller or equal to 4, which is the max right now for quads), to pass up to 4 values per location. See #3170. (Internal change: 2344215)
Removes CMake script duplication for GL and Vulkan versions of testHdStCodeGen. Adds some missing test directories. See github pull request #3170. (Internal change: 2345394)
Description of Change(s)
⚠ Note: This PR is for feature-hgi-vulkan branch.
Introduction
The goal of this PR is to fix various issue with HgiVulkan to enable Lavapipe (software rasterizer) compatibility. This was done by fixing bugs found when running the HdSt tests. Lavapipe is a conformant Vulkan 1.3 implementation: all issues encountered are actually Vulkan API usage problems, and could very well be encountered on actual hardware device. No special code is required for supporting Lavapipe as long as HgiVulkan uses the Vulkan API correctly.
Most fixes fall into two categories:
Breakdown of changes
Fixes Issue(s)