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

printf: Don't do work when there is no printf instruction #9256

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions layers/gpuav/instrumentation/gpuav_instrumentation.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (c) 2020-2024 The Khronos Group Inc.
* Copyright (c) 2020-2024 Valve Corporation
* Copyright (c) 2020-2024 LunarG, Inc.
/* Copyright (c) 2020-2025 The Khronos Group Inc.
* Copyright (c) 2020-2025 Valve Corporation
* Copyright (c) 2020-2025 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -305,8 +305,13 @@ void PreCallSetupShaderInstrumentationResources(Validator &gpuav, CommandBuffer
// bindings of the instrumentation descriptor set
assert(gpuav.instrumentation_bindings_.size() == 8);

// If nothing was updated, we don't want bind anything
if (!last_bound.WasInstrumented()) return;

if (gpuav.gpuav_settings.debug_printf_enabled) {
if (!debug_printf::UpdateInstrumentationDescSet(gpuav, cb_state, instrumentation_desc_set, bind_point, loc)) {
// TODO - need cleaner way to indicate if we want to return because of an error or because we want to save from doing
// unnecessary work
return;
}
}
Expand Down
6 changes: 3 additions & 3 deletions layers/gpuav/instrumentation/gpuav_shader_instrumentor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (c) 2020-2024 The Khronos Group Inc.
* Copyright (c) 2020-2024 Valve Corporation
* Copyright (c) 2020-2024 LunarG, Inc.
/* Copyright (c) 2020-2025 The Khronos Group Inc.
* Copyright (c) 2020-2025 Valve Corporation
* Copyright (c) 2020-2025 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
17 changes: 16 additions & 1 deletion layers/state_tracker/pipeline_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,4 +1429,19 @@ const spirv::EntryPoint *LastBound::GetFragmentEntryPoint() const {
return shader_object->entrypoint.get();
}
return nullptr;
}
}

bool LastBound::WasInstrumented() const {
if (pipeline_state) {
return pipeline_state->instrumentation_data.was_instrumented;
}
for (uint32_t i = 0; i < kShaderObjectStageCount; ++i) {
const auto stage = static_cast<ShaderObjectStage>(i);
if (!IsValidShaderBound(stage)) continue;
const vvl::ShaderObject *shader = GetShaderState(stage);
if (shader && shader->instrumentation_data.was_instrumented) {
return true;
}
}
return false;
}
3 changes: 3 additions & 0 deletions layers/state_tracker/pipeline_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,9 @@ struct LastBound {
std::string DescribeNonCompatibleSet(uint32_t set, const vvl::ShaderObject &shader_object_state) const;

const spirv::EntryPoint *GetFragmentEntryPoint() const;

// For GPU-AV
bool WasInstrumented() const;
};

// Used to compare 2 layouts independently when not tied to the last bound object
Expand Down
Loading