Skip to content
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

gpu: Remove Alias support to suppress false positives #8879

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

spencer-lunarg
Copy link
Contributor

We added a quick hack for #8875 in #8876, but this takes it a step further and just removes alias binding checks all together. This will allow us to more easily get other things correct, and then can return and try to apply them back in

@spencer-lunarg spencer-lunarg requested a review from a team as a code owner November 19, 2024 03:20
@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 305289.

@@ -152,6 +149,12 @@ bool DescriptorValidator::ValidateBindingDynamic(const DescriptorBindingInfo &bi
auto binding_ptr = descriptor_set.GetBinding(binding_info.first);
ASSERT_AND_RETURN_SKIP(binding_ptr);
auto &binding = *binding_ptr;

// If false, we have already validated (and updated the state) for this descriptor on the CPU
if (!descriptor_set.ValidateBindingOnGPU(binding, binding_info.second.variable->is_dynamic_accessed)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually a BIG motivation for this change. I want to make the exact same call we do in the CPU to defer work off to the GPU to also no repeat work

Some false positives are things that we were validating on the CPU, just to have it re-run ValidateDescriptor in GPU-AV and get it wrong

@@ -238,61 +239,57 @@ bool DescriptorValidator::ValidateDescriptor(const DescriptorBindingInfo &bindin
return false;
}

static const spirv::ResourceInterfaceVariable *FindMatchingImageVariable(const std::vector<DescriptorRequirement> &reqs,
static const spirv::ResourceInterfaceVariable *FindMatchingImageVariable(const DescriptorRequirement &descriptor_req,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function (and FindMatchingTexelVariable) is strange, I "think" it could be removed, but wanted to try that in another PR as it might uncover some other issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests failing are showing me that there is actually just some larger problems at play... glad we had tests, but things are kinda a mess right now trying to share this ValidateDescriptor on the CPU/GPU and having subtle things in it only for one or the other code path

context.ValidateBindingDynamic(binding_info, u.second);
// TODO - https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/8875
// Currently if we find multiple variables (aka aliased bindings) we will skip validating
if (descriptor_req_found == 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this can be zero, it shouldn't be able to, but will need more testing

&descriptor_set.set_, 0, nullptr);
vk::CmdBindPipeline(m_command_buffer.handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, g_pipe.Handle());

if (!m_gpuav_disable_core) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had these in some test... this was sign that this is actually just validated on the CPU and doesn't need GPU-AV

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 18053 running.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 18053 failed.

Copy link
Contributor

@arno-lunarg arno-lunarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are needless deep vector copies, aside that LGTM

@@ -16,6 +16,7 @@
*/

#include "gpu/descriptor_validation/gpuav_descriptor_validation.h"
#include <cstdint>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be needed?

while (iter != bound_descriptor_set.binding_req_map.end() && iter->first == binding) {
binding_info.second.emplace_back(iter->second);
descriptor_req_found++;
binding_info.second = iter->second;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needless vector copies will be done here, just have one copy during the last iteration
Also, do we truly need a deep copy?

@@ -983,7 +983,7 @@ class DescriptorSet : public StateObject {
return DescriptorIterator<ConstBindingIterator>(*this, binding, index);
}

virtual bool SkipBinding(const DescriptorBinding &binding, bool is_dynamic_accessed) const {
inline bool ValidateBindingOnGPU(const DescriptorBinding &binding, bool is_dynamic_accessed) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inline bool ValidateBindingOnGPU(const DescriptorBinding &binding, bool is_dynamic_accessed) const {
bool ValidateBindingOnGPU(const DescriptorBinding &binding, bool is_dynamic_accessed) const {

Function defined in a header are likely to be inlined anyway, and inline being just a hint, just let the compiler decide!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, inline is mostly outdated now, compilers inline not only little but medium sized functions too, results in mostly large functions in the output, and function calls are less expensive as a result 🙃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess another part of inline that deals with One Definition rule can more central reason to use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants