Skip to content

Commit

Permalink
gpu: Combine gpu namespace to gpuav
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Oct 3, 2024
1 parent 65f986c commit 9155710
Show file tree
Hide file tree
Showing 71 changed files with 216 additions and 223 deletions.
22 changes: 11 additions & 11 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ vvl_sources = [
"layers/gpu/cmd_validation/gpuav_draw.h",
"layers/gpu/cmd_validation/gpuav_trace_rays.cpp",
"layers/gpu/cmd_validation/gpuav_trace_rays.h",
"layers/gpu/core/gpu_settings.h",
"layers/gpu/core/gpu_shader_cache_hash.h",
"layers/gpu/core/gpuav_settings.h",
"layers/gpu/core/gpuav_shader_cache_hash.h",
"layers/gpu/core/gpuav.h",
"layers/gpu/core/gpuav_constants.h",
"layers/gpu/core/gpuav_record.cpp",
Expand All @@ -175,18 +175,18 @@ vvl_sources = [
"layers/gpu/descriptor_validation/gpuav_image_layout.h",
"layers/gpu/error_message/gpuav_vuids.cpp",
"layers/gpu/error_message/gpuav_vuids.h",
"layers/gpu/instrumentation/gpu_shader_instrumentor.cpp",
"layers/gpu/instrumentation/gpu_shader_instrumentor.h",
"layers/gpu/instrumentation/gpuav_shader_instrumentor.cpp",
"layers/gpu/instrumentation/gpuav_shader_instrumentor.h",
"layers/gpu/instrumentation/gpuav_instrumentation.cpp",
"layers/gpu/instrumentation/gpuav_instrumentation.h",
"layers/gpu/resources/gpu_resources.cpp",
"layers/gpu/resources/gpu_resources.h",
"layers/gpu/resources/gpu_shader_resources.h",
"layers/gpu/resources/gpuav_resources.cpp",
"layers/gpu/resources/gpuav_resources.h",
"layers/gpu/resources/gpuav_shader_resources.h",
"layers/gpu/resources/gpuav_subclasses.cpp",
"layers/gpu/resources/gpuav_subclasses.h",
"layers/gpu/shaders/gpu_error_codes.h",
"layers/gpu/shaders/gpu_error_header.h",
"layers/gpu/shaders/gpu_shaders_constants.h",
"layers/gpu/shaders/gpuav_error_codes.h",
"layers/gpu/shaders/gpuav_error_header.h",
"layers/gpu/shaders/gpuav_shaders_constants.h",
"layers/gpu/spirv/bindless_descriptor_pass.cpp",
"layers/gpu/spirv/bindless_descriptor_pass.h",
"layers/gpu/spirv/non_bindless_oob_buffer_pass.cpp",
Expand Down Expand Up @@ -358,7 +358,7 @@ vvl_sources = [
"layers/vulkan/generated/error_location_helper.h",
"layers/vulkan/generated/feature_requirements_helper.cpp",
"layers/vulkan/generated/feature_requirements_helper.h",
"layers/vulkan/generated/gpu_av_shader_hash.h",
"layers/vulkan/generated/gpuav_shader_hash.h",
"layers/vulkan/generated/instrumentation_bindless_descriptor_comp.cpp",
"layers/vulkan/generated/instrumentation_bindless_descriptor_comp.h",
"layers/vulkan/generated/instrumentation_non_bindless_oob_buffer_comp.cpp",
Expand Down
22 changes: 11 additions & 11 deletions layers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ target_sources(vvl PRIVATE
${API_TYPE}/generated/thread_safety_counter_bodies.h
${API_TYPE}/generated/thread_safety_counter_definitions.h
${API_TYPE}/generated/thread_safety_counter_instances.h
${API_TYPE}/generated/gpu_av_shader_hash.h
${API_TYPE}/generated/gpuav_shader_hash.h
${API_TYPE}/generated/cmd_validation_copy_buffer_to_image_comp.h
${API_TYPE}/generated/cmd_validation_copy_buffer_to_image_comp.cpp
${API_TYPE}/generated/cmd_validation_dispatch_comp.h
Expand All @@ -219,8 +219,8 @@ target_sources(vvl PRIVATE
${API_TYPE}/generated/cmd_validation_draw_vert.cpp
${API_TYPE}/generated/cmd_validation_trace_rays_rgen.h
${API_TYPE}/generated/cmd_validation_trace_rays_rgen.cpp
gpu/core/gpu_settings.h
gpu/core/gpu_shader_cache_hash.h
gpu/core/gpuav_settings.h
gpu/core/gpuav_shader_cache_hash.h
gpu/core/gpuav_constants.h
gpu/cmd_validation/gpuav_cmd_validation_common.h
gpu/cmd_validation/gpuav_cmd_validation_common.cpp
Expand All @@ -245,18 +245,18 @@ target_sources(vvl PRIVATE
gpu/debug_printf/debug_printf.h
gpu/error_message/gpuav_vuids.cpp
gpu/error_message/gpuav_vuids.h
gpu/instrumentation/gpu_shader_instrumentor.cpp
gpu/instrumentation/gpu_shader_instrumentor.h
gpu/instrumentation/gpuav_shader_instrumentor.cpp
gpu/instrumentation/gpuav_shader_instrumentor.h
gpu/instrumentation/gpuav_instrumentation.h
gpu/instrumentation/gpuav_instrumentation.cpp
gpu/resources/gpuav_subclasses.cpp
gpu/resources/gpuav_subclasses.h
gpu/resources/gpu_shader_resources.h
gpu/resources/gpu_resources.h
gpu/resources/gpu_resources.cpp
gpu/shaders/gpu_error_codes.h
gpu/shaders/gpu_error_header.h
gpu/shaders/gpu_shaders_constants.h
gpu/resources/gpuav_shader_resources.h
gpu/resources/gpuav_resources.h
gpu/resources/gpuav_resources.cpp
gpu/shaders/gpuav_error_codes.h
gpu/shaders/gpuav_error_header.h
gpu/shaders/gpuav_shaders_constants.h
object_tracker/object_lifetime_validation.h
object_tracker/object_tracker_utils.cpp
state_tracker/buffer_state.cpp
Expand Down
2 changes: 1 addition & 1 deletion layers/gpu/cmd_validation/gpuav_cmd_validation_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "gpu/core/gpuav.h"
#include "gpu/core/gpuav_constants.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_shaders_constants.h"

#include "state_tracker/descriptor_sets.h"
#include "state_tracker/shader_object_state.h"
Expand Down
6 changes: 3 additions & 3 deletions layers/gpu/cmd_validation/gpuav_copy_buffer_to_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "gpu/core/gpuav.h"
#include "gpu/cmd_validation/gpuav_cmd_validation_common.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "gpu/shaders/gpuav_shaders_constants.h"
#include "generated/cmd_validation_copy_buffer_to_image_comp.h"

namespace gpuav {
Expand Down Expand Up @@ -169,7 +169,7 @@ void InsertCopyBufferToImageValidation(Validator &gpuav, const Location &loc, Co
uint32_t max_texels_count_in_regions = copy_buffer_to_img_info->pRegions[0].imageExtent.width *
copy_buffer_to_img_info->pRegions[0].imageExtent.height *
copy_buffer_to_img_info->pRegions[0].imageExtent.depth;
gpu::DeviceMemoryBlock copy_src_regions_mem_block;
DeviceMemoryBlock copy_src_regions_mem_block;
{
// Needs to be kept in sync with copy_buffer_to_image.comp
struct BufferImageCopy {
Expand Down
4 changes: 2 additions & 2 deletions layers/gpu/cmd_validation/gpuav_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "gpu/core/gpuav.h"
#include "gpu/cmd_validation/gpuav_cmd_validation_common.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "gpu/shaders/gpuav_shaders_constants.h"
#include "generated/cmd_validation_dispatch_comp.h"

namespace gpuav {
Expand Down
4 changes: 2 additions & 2 deletions layers/gpu/cmd_validation/gpuav_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "gpu/error_message/gpuav_vuids.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "state_tracker/render_pass_state.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "gpu/shaders/gpuav_shaders_constants.h"
#include "generated/cmd_validation_draw_vert.h"

// See gpu/shaders/cmd_validation/draw.vert
Expand Down
4 changes: 2 additions & 2 deletions layers/gpu/cmd_validation/gpuav_trace_rays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include "gpu/core/gpuav.h"
#include "gpu/cmd_validation/gpuav_cmd_validation_common.h"
#include "gpu/resources/gpu_resources.h"
#include "gpu/resources/gpuav_resources.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "generated/cmd_validation_trace_rays_rgen.h"

// See gpu/shaders/cmd_validation/trace_rays.rgen
Expand Down
8 changes: 4 additions & 4 deletions layers/gpu/core/gpuav.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#pragma once

#include "gpu/descriptor_validation/gpuav_descriptor_set.h"
#include "gpu/resources/gpu_resources.h"
#include "gpu/instrumentation/gpu_shader_instrumentor.h"
#include "gpu/resources/gpuav_resources.h"
#include "gpu/instrumentation/gpuav_shader_instrumentor.h"

#include <memory>

Expand Down Expand Up @@ -48,7 +48,7 @@ VALSTATETRACK_DERIVED_STATE_OBJECT(VkQueue, gpuav::Queue, vvl::Queue)

namespace gpuav {

class Validator : public gpu::GpuShaderInstrumentor {
class Validator : public GpuShaderInstrumentor {
using BaseClass = GpuShaderInstrumentor;
using Func = vvl::Func;
using Struct = vvl::Struct;
Expand Down Expand Up @@ -407,7 +407,7 @@ class Validator : public gpu::GpuShaderInstrumentor {

public:
std::optional<DescriptorHeap> desc_heap_{}; // optional only to defer construction
gpu::SharedResourcesManager shared_resources_manager;
SharedResourcesManager shared_resources_manager;

private:
std::string instrumented_shader_cache_path_{};
Expand Down
6 changes: 3 additions & 3 deletions layers/gpu/core/gpuav_record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#include "gpu/descriptor_validation/gpuav_image_layout.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/instrumentation/gpuav_instrumentation.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_shaders_constants.h"
#include "chassis/chassis_modification_state.h"
#include "gpu/core/gpu_shader_cache_hash.h"
#include "gpu/core/gpuav_shader_cache_hash.h"

// Generated shaders
#include "generated/gpu_av_shader_hash.h"
#include "generated/gpuav_shader_hash.h"

namespace gpuav {

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions layers/gpu/core/gpuav_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#include "gpu/core/gpuav.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "generated/layer_chassis_dispatch.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "gpu/shaders/gpuav_shaders_constants.h"
#include "generated/chassis.h"
#include "gpu/core/gpu_shader_cache_hash.h"
#include "gpu/core/gpuav_shader_cache_hash.h"

namespace gpuav {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#pragma once
// Default values for those settings should match layers/VkLayer_khronos_validation.json.in

#include "generated/gpu_av_shader_hash.h"
#include "gpu/core/gpu_settings.h"
#include "generated/gpuav_shader_hash.h"
#include "gpu/core/gpuav_settings.h"

// This structure is included in the shader cache to make sure is invalidated if a setting
// or a GPUAV shader changes.
Expand All @@ -31,4 +31,3 @@ struct ShaderCacheHash {
const char gpu_av_shader_git_hash[sizeof(GPU_AV_SHADER_GIT_HASH)] = GPU_AV_SHADER_GIT_HASH;
};
#pragma pack(pop)

16 changes: 8 additions & 8 deletions layers/gpu/debug_printf/debug_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
*/

#include "gpu/debug_printf/debug_printf.h"
#include "gpu/instrumentation/gpu_shader_instrumentor.h"
#include "gpu/instrumentation/gpuav_shader_instrumentor.h"
#include "error_message/log_message_type.h"
#include "error_message/logging.h"
#include "generated/layer_chassis_dispatch.h"
#include "chassis/chassis_modification_state.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "gpu/shaders/gpuav_shaders_constants.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/core/gpuav.h"

Expand Down Expand Up @@ -156,7 +156,7 @@ static std::vector<Substring> ParseFormatString(const std::string &format_string
return parsed_strings;
}

static std::string FindFormatString(const std::vector<gpu::spirv::Instruction> &instructions, uint32_t string_id) {
static std::string FindFormatString(const std::vector<gpuav::spirv::Instruction> &instructions, uint32_t string_id) {
std::string format_string;
for (const auto &insn : instructions) {
if (insn.Opcode() == spv::OpString && insn.Word(1) == string_id) {
Expand Down Expand Up @@ -205,7 +205,7 @@ void AnalyzeAndGenerateMessage(Validator &gpuav, VkCommandBuffer command_buffer,
OutputRecord *debug_record = reinterpret_cast<OutputRecord *>(&debug_output_buffer[index]);
// Lookup the VkShaderModule handle and SPIR-V code used to create the shader, using the unique shader ID value returned
// by the instrumented shader.
const gpu::GpuAssistedShaderTracker *tracker_info = nullptr;
const gpuav::GpuAssistedShaderTracker *tracker_info = nullptr;
auto it = gpuav.shader_map_.find(debug_record->shader_id);
if (it != gpuav.shader_map_.end()) {
tracker_info = &it->second;
Expand All @@ -217,8 +217,8 @@ void AnalyzeAndGenerateMessage(Validator &gpuav, VkCommandBuffer command_buffer,
return;
}

std::vector<gpu::spirv::Instruction> instructions;
gpu::spirv::GenerateInstructions(tracker_info->instrumented_spirv, instructions);
std::vector<gpuav::spirv::Instruction> instructions;
gpuav::spirv::GenerateInstructions(tracker_info->instrumented_spirv, instructions);

// Search through the shader source for the printf format string for this invocation
const std::string format_string = FindFormatString(instructions, debug_record->format_string_id);
Expand Down Expand Up @@ -358,7 +358,7 @@ void AnalyzeAndGenerateMessage(Validator &gpuav, VkCommandBuffer command_buffer,

bool UpdateInstrumentationDescSet(Validator &gpuav, CommandBuffer &cb_state, VkDescriptorSet instrumentation_desc_set,
VkPipelineBindPoint bind_point, const Location &loc) {
gpu::DeviceMemoryBlock debug_printf_output_buffer = {};
gpuav::DeviceMemoryBlock debug_printf_output_buffer = {};

// Allocate memory for the output block that the gpu will use to return values for printf
VkBufferCreateInfo buffer_info = vku::InitStructHelper();
Expand Down
6 changes: 3 additions & 3 deletions layers/gpu/debug_printf/debug_printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <vulkan/vulkan_core.h>

struct Location;
namespace gpu {
namespace gpuav {
struct DeviceMemoryBlock;
}
namespace gpuav {
Expand All @@ -31,8 +31,8 @@ class Validator;
namespace debug_printf {
bool UpdateInstrumentationDescSet(Validator& gpuav, CommandBuffer& cb_state, VkDescriptorSet instrumentation_desc_set,
VkPipelineBindPoint bind_point, const Location& loc);
void AnalyzeAndGenerateMessage(Validator& gpuav, VkCommandBuffer command_buffer, VkQueue queue,
gpuav::DebugPrintfBufferInfo& buffer_info, uint32_t* const debug_output_buffer, const Location& loc);
void AnalyzeAndGenerateMessage(Validator& gpuav, VkCommandBuffer command_buffer, VkQueue queue, DebugPrintfBufferInfo& buffer_info,
uint32_t* const debug_output_buffer, const Location& loc);
} // namespace debug_printf

} // namespace gpuav
4 changes: 2 additions & 2 deletions layers/gpu/descriptor_validation/gpuav_descriptor_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "gpu/core/gpuav.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/resources/gpu_shader_resources.h"
#include "gpu/shaders/gpu_shaders_constants.h"
#include "gpu/resources/gpuav_shader_resources.h"
#include "gpu/shaders/gpuav_shaders_constants.h"

using vvl::DescriptorClass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "drawdispatch/descriptor_validator.h"
#include "gpu/core/gpuav.h"
#include "gpu/resources/gpuav_subclasses.h"
#include "gpu/resources/gpu_shader_resources.h"
#include "gpu/resources/gpuav_shader_resources.h"

namespace gpuav {
void UpdateBoundPipeline(Validator &gpuav, CommandBuffer &cb_state, VkPipelineBindPoint pipeline_bind_point, VkPipeline pipeline,
Expand Down
10 changes: 5 additions & 5 deletions layers/gpu/instrumentation/gpuav_instrumentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "chassis/chassis_modification_state.h"
#include "gpu/core/gpuav.h"
#include "gpu/error_message/gpuav_vuids.h"
#include "gpu/resources/gpu_shader_resources.h"
#include "gpu/shaders/gpu_error_header.h"
#include "gpu/resources/gpuav_shader_resources.h"
#include "gpu/shaders/gpuav_error_header.h"
#include "gpu/debug_printf/debug_printf.h"
#include "state_tracker/shader_object_state.h"

Expand Down Expand Up @@ -759,17 +759,17 @@ bool LogInstrumentationError(Validator &gpuav, VkCommandBuffer cmd_buffer, const
if (error_found) {
// Lookup the VkShaderModule handle and SPIR-V code used to create the shader, using the unique shader ID value returned
// by the instrumented shader.
const gpu::GpuAssistedShaderTracker *tracker_info = nullptr;
const GpuAssistedShaderTracker *tracker_info = nullptr;
const uint32_t shader_id = error_record[glsl::kHeaderShaderIdOffset];
auto it = gpuav.shader_map_.find(shader_id);
if (it != gpuav.shader_map_.end()) {
tracker_info = &it->second;
}

// If we somehow can't find our state, we can still report our error message
std::vector<gpu::spirv::Instruction> instructions;
std::vector<spirv::Instruction> instructions;
if (tracker_info && !tracker_info->instrumented_spirv.empty()) {
gpu::spirv::GenerateInstructions(tracker_info->instrumented_spirv, instructions);
spirv::GenerateInstructions(tracker_info->instrumented_spirv, instructions);
}

std::string debug_info_message = gpuav.GenerateDebugInfoMessage(
Expand Down
Loading

0 comments on commit 9155710

Please sign in to comment.