-
Notifications
You must be signed in to change notification settings - Fork 123
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
portable raytracing: Add VulkanAddressReplacer #1879
portable raytracing: Add VulkanAddressReplacer #1879
Conversation
CI gfxreconstruct build queued with queue ID 307164. |
CI gfxreconstruct build queued with queue ID 307178. |
CI gfxreconstruct build # 5356 running. |
CI gfxreconstruct build queued with queue ID 307197. |
CI gfxreconstruct build # 5357 running. |
CI gfxreconstruct build queued with queue ID 307213. |
CI gfxreconstruct build queued with queue ID 307215. |
@@ -24,7 +24,7 @@ android { | |||
} | |||
externalNativeBuild { | |||
cmake { | |||
cppFlags "-fexceptions", "-std=c++14", "-Wno-nullability-completeness" | |||
cppFlags "-fexceptions", "-std=c++17", "-Wno-nullability-completeness" |
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.
fyi @bradgrantham - in this PR, I'm adjusting our android c++ dialect to c++17, matching the other configs.
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.
Thanks for doing this. I think it's important for us to try to maintain consistency between the two. Especially as we add C++17 features into GFXR.
CI gfxreconstruct build # 5359 running. |
CI gfxreconstruct build # 5359 failed. |
CI gfxreconstruct build queued with queue ID 307286. |
CI gfxreconstruct build # 5361 running. |
CI gfxreconstruct build queued with queue ID 307306. |
CI gfxreconstruct build # 5362 running. |
CI gfxreconstruct build queued with queue ID 307342. |
CI gfxreconstruct build # 5363 running. |
CI gfxreconstruct build queued with queue ID 307367. |
CI gfxreconstruct build # 5364 running. |
CI gfxreconstruct build # 5364 failed. |
CI gfxreconstruct build queued with queue ID 307821. |
CI gfxreconstruct build # 5367 running. |
CI gfxreconstruct build # 5367 failed. |
CI gfxreconstruct build queued with queue ID 308221. |
CI gfxreconstruct build # 5370 running. |
CI gfxreconstruct build # 5370 passed. |
281a730
to
2fa629d
Compare
- fixes to shader-group-handle-replay feature-detection (needs both capture&replay)
…ingle capture, get back to it
2fa629d
to
be4eff2
Compare
CI gfxreconstruct build queued with queue ID 315511. |
CI gfxreconstruct build # 5486 running. |
CI gfxreconstruct build # 5486 passed. |
CI gfxreconstruct build queued with queue ID 315569. |
CI gfxreconstruct build # 5487 running. |
CI gfxreconstruct build # 5487 passed. |
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 mostly a few cleanups and questions.
@@ -24,7 +24,7 @@ android { | |||
} | |||
externalNativeBuild { | |||
cmake { | |||
cppFlags "-fexceptions", "-std=c++14", "-Wno-nullability-completeness" | |||
cppFlags "-fexceptions", "-std=c++17", "-Wno-nullability-completeness" |
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.
Thanks for doing this. I think it's important for us to try to maintain consistency between the two. Especially as we add C++17 features into GFXR.
return memory_type_index; | ||
} | ||
|
||
//! 16 bytes |
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.
What's the point of this comment?
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.
was me, counting bytes during development. I'll remove it :)
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.
done
// NOTE: we expect this map to be populated here, but not for older captures (before #1844) using trimming. | ||
if (group_handle_map.empty()) | ||
{ | ||
// the capture appears to be older and is missing information we require here -> bail out |
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 log an INFO_ONCE
level message here? (Side note, I don't even know if we have an INFO_ONCE, if not, just use INFO).
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.
I'll check. and yes, was also thinking back/forth to use warning or just INFO
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.
we do have a GFXRECON_LOG_INFO_ONCE
, using that
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.
done
} | ||
} | ||
|
||
// TODO: testing only -> remove when closing issue #1526 |
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.
Nice! Thanks for remembering to associate a TODO with a PR.
device_table_->CmdBindPipeline(command_buffer_info->handle, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_bda_); | ||
|
||
// NOTE: using push-constants here requires us to re-establish the previous data, if any | ||
device_table_->CmdPushConstants(command_buffer_info->handle, |
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.
Be careful of push constants size. Some HW (Arm?) may have no support or very limited support.
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.
glad you're asking :)
- "Push constants have a minimum size of 128 bytes" (https://vkguide.dev/docs/chapter-3/push_constants/)
replacer_params_t
is only 40 bytes, so plenty of headroom
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.
I was also worried about this and basically chose this all-in approach with using buffer-device-addresses for everything (input/output addresses, hashmap-storage).
} | ||
} | ||
|
||
void VulkanAddressReplacer::init_pipeline() |
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.
For each of these functions, you might want to put a note that they should only be used in a "mark injected" section. This just makes sure others going forward continue to be consistent
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.
alternatively, instead of putting notes to the private methods,
maybe document this ("all vulkan-commands will be wrapped with markers")
as general contract or "expected behavior" inside a class doc-string?
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.
I wrote a class-doc saying:
Important note: all internal Vulkan-API calls performed by this class are expected to be wrapped by calls to:
* - decode::BeginInjectedCommands() / decode::EndInjectedCommands()
|
||
if (pipeline_bda_ == VK_NULL_HANDLE) | ||
{ | ||
init_pipeline(); |
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.
If we hit a fatal error inside this, we should abandon and jump out.
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.
done. we check, print an error and bail out in case this goes wrong
* @param callable_sbt ray-callable sbt | ||
* @param address_tracker const reference to a VulkanDeviceAddressTracker, used for mapping device-addresses | ||
* @param group_handle_map a map from capture- to replay-time group-handles | ||
*/ |
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.
Great comment
GFXRECON_BEGIN_NAMESPACE(gfxrecon) | ||
GFXRECON_BEGIN_NAMESPACE(decode) | ||
|
||
// g_replacer_sbt_comp: original GLSL source |
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.
I have to admit, at first I'm was "what is this?", but then I saw the binary blobs below. I like this way of doing it.
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.
I copied this approach from Dustin :)
CI gfxreconstruct build queued with queue ID 315750. |
CI gfxreconstruct build # 5490 running. |
CI gfxreconstruct build # 5490 passed. |
decode::VulkanAddressReplacer
classVulkanAddressReplacer
vkCmdTraceRays
|vkCmdBuildAccelerationStructuresKHR
decode::Begin/EndInjectedCommands
VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT
this PR solves issues around portable replay wrt. shader-binding-table (SBT) handling.
it only partially solves remaining issues around
VkAccelerationStructure
, which will be addressed in a follow-upbelongs to #1526