Skip to content
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
3 changes: 3 additions & 0 deletions layers/core_checks/cc_data_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,5 +409,8 @@ bool CoreChecks::PreCallValidateCmdDispatchDataGraphARM(VkCommandBuffer commandB
FormatHandle(cb_pipeline).c_str(), FormatHandle(session_state.create_info.dataGraphPipeline).c_str(), FormatHandle(session_state).c_str());
}

skip |=
ValidateDataGraphOperations(*last_bound_state.pipeline_state, cb_state.command_pool->queueFamilyIndex, error_obj.location);

return skip;
}
35 changes: 27 additions & 8 deletions layers/core_checks/cc_spirv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2894,19 +2894,32 @@ bool CoreChecks::ValidateTaskPayload(const spirv::Module *task_module, const spi
return skip;
}

bool CoreChecks::ValidateDataGraphPipelineShaderModuleSpirv(VkDevice device, const VkDataGraphPipelineCreateInfoARM &create_info,
const Location &create_info_loc,
const VkDataGraphPipelineShaderModuleCreateInfoARM &dg_shader_ci,
const vvl::Pipeline &pipeline) const {
bool skip = false;
static const ShaderStageState* GetDataGraphShaderStage(const vvl::Pipeline& pipeline) {
if (pipeline.stage_states.empty()) {
// no ShaderModule defined
return nullptr;
}
// the one and only stage for a datagraph
return &pipeline.stage_states[0];
}

bool CoreChecks::ValidateDataGraphPipelineShaderModuleSpirv(VkDevice device, const VkDataGraphPipelineCreateInfoARM& create_info,
const Location& create_info_loc,
const VkDataGraphPipelineShaderModuleCreateInfoARM& dg_shader_ci,
const vvl::Pipeline& pipeline) const {
bool skip = false;

const ShaderStageState* stage_state_ptr = GetDataGraphShaderStage(pipeline);
if (!stage_state_ptr) {
return skip;
}
const ShaderStageState& stage_state = *stage_state_ptr;
const spirv::Module* module_spirv_ptr = stage_state.spirv_state.get();
if (!module_spirv_ptr) {
return skip;
}
const spirv::Module& module_spirv = *module_spirv_ptr;

const auto &stage_state = pipeline.stage_states[0];
ASSERT_AND_RETURN_SKIP(stage_state.spirv_state.get());
const spirv::Module &module_spirv = *stage_state.spirv_state.get();
const Location dg_shader_ci_loc = create_info_loc.pNext(Struct::VkDataGraphPipelineShaderModuleCreateInfoARM);

// location where the VkShaderModule was defined: VkDataGraphPipelineShaderModuleCreateInfoARM or VkShaderModuleCreateInfo?
Expand Down Expand Up @@ -3203,6 +3216,12 @@ bool CoreChecks::ValidateDataGraphConstants(const spirv::Module &module_spirv, c
return skip;
}

bool CoreChecks::ValidateDataGraphOperations(const vvl::Pipeline& pipeline, uint32_t queueFamilyIndex, const Location& loc) const {
bool skip = false;
// TODO - https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/11713
return skip;
}

bool CoreChecks::ValidateShaderDescriptorSetAndBindingMappingInfo(const spirv::Module &module_state,
const spirv::EntryPoint &entrypoint,
const vvl::Pipeline *pipeline,
Expand Down
1 change: 1 addition & 0 deletions layers/core_checks/core_validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ class CoreChecks : public vvl::DeviceProxy {
bool ValidateTensorSemiStructuredSparsityInfo(VkDevice device, const VkDataGraphPipelineConstantARM& constant,
const Location& constant_loc, const vvl::Pipeline& pipeline) const;
bool ValidateDataGraphPipelineShaderModuleSpirv(VkDevice device, const VkDataGraphPipelineCreateInfoARM& create_info, const Location& create_info_loc, const VkDataGraphPipelineShaderModuleCreateInfoARM& dg_shader_ci, const vvl::Pipeline& pipeline) const;
bool ValidateDataGraphOperations(const vvl::Pipeline& pipeline, uint32_t queueFamilyIndex, const Location& loc) const;

bool PreCallValidateCreateDataGraphPipelinesARM(VkDevice device, VkDeferredOperationKHR deferredOperation,
VkPipelineCache pipelineCache, uint32_t createInfoCount,
Expand Down
38 changes: 38 additions & 0 deletions layers/error_message/error_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,41 @@
ss << "reservedRangeSize = " << info.reservedRangeSize << "";
return ss.str();
}

[[maybe_unused]] static std::string string_VkPhysicalDeviceDataGraphProcessingEngineARM(
const VkPhysicalDeviceDataGraphProcessingEngineARM& engine) {
std::stringstream ss;
ss << "{ type: " << string_VkPhysicalDeviceDataGraphProcessingEngineTypeARM(engine.type)
<< ", isForeign: " << string_VkBool32(engine.isForeign) << " }";
return ss.str();
}

[[maybe_unused]] static std::string string_VkPhysicalDeviceDataGraphOperationSupportARM(
const VkPhysicalDeviceDataGraphOperationSupportARM& operation) {
std::stringstream ss;
ss << "{ type: " << string_VkPhysicalDeviceDataGraphOperationTypeARM(operation.operationType) << ", name: \"" << operation.name
<< "\", version: " << operation.version << "}";
return ss.str();
}

[[maybe_unused]] static std::string string_VkQueueFamilyDataGraphPropertiesARM(
const VkQueueFamilyDataGraphPropertiesARM& property) {
std::stringstream ss;
ss << "{\n engine: " << string_VkPhysicalDeviceDataGraphProcessingEngineARM(property.engine)
<< ",\n operation: " << string_VkPhysicalDeviceDataGraphOperationSupportARM(property.operation) << "\n}\n";
return ss.str();
}

[[maybe_unused]] static std::string string_VkQueueFamilyDataGraphPropertiesARM(
const std::vector<VkQueueFamilyDataGraphPropertiesARM>& properties) {
if (properties.size() == 0) {
// with just a blank it's unclear if the function is wrong or there really are no properties.
return "EMPTY\n";
}

std::stringstream ss;
for (const auto& p : properties) {
ss << string_VkQueueFamilyDataGraphPropertiesARM(p) << '\n';
}
return ss.str();
}
12 changes: 9 additions & 3 deletions layers/state_tracker/shader_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ struct ParsedInfo {
std::vector<const Instruction*> debug_global_variables;

bool has_graph_constant_arm = false; // detects if any are found OpGraphConstantARM
bool uses_tosa_1_0 = false;

uint32_t total_entry_points = 0;
};
Expand Down Expand Up @@ -858,6 +859,7 @@ EntryPoint::EntryPoint(const Module& module_state, const Instruction& entrypoint
resource_interface_variables(GetResourceInterfaceVariables(module_state, *this, parsed)),
stage_interface_variables(GetStageInterfaceVariables(module_state, *this, parsed)),
datagraph_constants(GetDataGraphConstants(module_state, *this, parsed)),
uses_tosa_1_0(parsed.uses_tosa_1_0),
only_entry_point(parsed.total_entry_points == 1) {
// Tried to just create this map in GetResourceInterfaceVariables() but ran into errors because the function is static
for (const auto& variable : resource_interface_variables) {
Expand Down Expand Up @@ -1222,6 +1224,8 @@ Module::StaticData::StaticData(const Module& module_state, bool parse, Stateless
if (ext_instruction == NonSemanticShaderDebugInfo100DebugGlobalVariable) {
parsed.debug_global_variables.emplace_back(&insn);
}
} else if (set == extended.tosa_001000_1) {
parsed.uses_tosa_1_0 = true;
}
break;
}
Expand All @@ -1245,11 +1249,13 @@ Module::StaticData::StaticData(const Module& module_state, bool parse, Stateless
break;

case spv::OpExtInstImport: {
if (strcmp(insn.GetAsString(2), "GLSL.std.450") == 0) {
const char* ext_name = insn.GetAsString(2);
if (strcmp(ext_name, "GLSL.std.450") == 0) {
extended.glsl_std450 = insn.ResultId();
}
if (strcmp(insn.GetAsString(2), "NonSemantic.Shader.DebugInfo.100") == 0) {
} else if (strcmp(ext_name, "NonSemantic.Shader.DebugInfo.100") == 0) {
extended.shader_debug_info = insn.ResultId();
} else if (strncmp(ext_name, "TOSA.001000.1", strlen("TOSA.001000.1")) == 0) {
extended.tosa_001000_1 = insn.ResultId();
}
break;
}
Expand Down
3 changes: 3 additions & 0 deletions layers/state_tracker/shader_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ struct EntryPoint {
const std::vector<StageInterfaceVariable> stage_interface_variables;
const std::vector<const Instruction *> datagraph_constants;

bool uses_tosa_1_0{false};

// Easier to lookup without having to check for the is_builtin bool
// "Built-in interface variables" - vkspec.html#interfaces-iointerfaces-builtin
std::vector<const StageInterfaceVariable *> built_in_variables;
Expand Down Expand Up @@ -728,6 +730,7 @@ struct Module {
struct ExtendedInstructionSets {
uint32_t glsl_std450 = 0; // GLSL.std.450
uint32_t shader_debug_info = 0; // NonSemantic.Shader.DebugInfo.100
uint32_t tosa_001000_1 = 0; // TOSA.001000.1
} extended;

// EntryPoint has pointer references inside it that need to be preserved
Expand Down
13 changes: 10 additions & 3 deletions layers/utils/vk_struct_compare.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (c) 2024-2025 The Khronos Group Inc.
* Copyright (c) 2024-2025 Valve Corporation
* Copyright (c) 2024-2025 LunarG, Inc.
/* Copyright (c) 2024-2026 The Khronos Group Inc.
* Copyright (c) 2024-2026 Valve Corporation
* Copyright (c) 2024-2026 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 @@ -207,3 +207,10 @@ bool CompareDependencyInfo(const VkDependencyInfo &a, const VkDependencyInfo &b)
}
return true;
}

bool CompareVkQueueFamilyDataGraphPropertiesARM(const VkQueueFamilyDataGraphPropertiesARM& a,
const VkQueueFamilyDataGraphPropertiesARM& b) {
return (a.engine.type == b.engine.type && a.engine.isForeign == b.engine.isForeign &&
a.operation.operationType == b.operation.operationType && strcmp(a.operation.name, b.operation.name) == 0 &&
a.operation.version == b.operation.version);
}
9 changes: 6 additions & 3 deletions layers/utils/vk_struct_compare.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (c) 2024 The Khronos Group Inc.
* Copyright (c) 2025 Valve Corporation
* Copyright (c) 2025 LunarG, Inc.
/* Copyright (c) 2024-2026 The Khronos Group Inc.
* Copyright (c) 2025-2026 Valve Corporation
* Copyright (c) 2025-2026 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 @@ -39,3 +39,6 @@ bool ComparePipelineFragmentShadingRateStateCreateInfo(const VkPipelineFragmentS
bool CompareSamplerCreateInfo(const VkSamplerCreateInfo &a, const VkSamplerCreateInfo &b);

bool CompareDependencyInfo(const VkDependencyInfo& a, const VkDependencyInfo& b);

bool CompareVkQueueFamilyDataGraphPropertiesARM(const VkQueueFamilyDataGraphPropertiesARM& a,
const VkQueueFamilyDataGraphPropertiesARM& b);