From 492529d4db51701c5d82bca443db76ecf3f8173b Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Mon, 18 Dec 2023 15:54:44 +0100 Subject: [PATCH] Publish the header for the vulkan-shader-profiler embedded reflection non-semantic instruction set vulkan-shader-profiler is a tool based on perfetto to help vulkan developer profil their applications. First on the Host side using perfetto, but then using the extractor and the runner, this tools allow to get inside about a shader using counters (based on SPV_KHR_shader_clock) --- BUILD.bazel | 6 + BUILD.gn | 1 + .../unified1/NonSemanticVkspReflection.h | 57 ++++++++ ...st.nonsemantic.vkspreflection.grammar.json | 135 ++++++++++++++++++ tools/buildHeaders/bin/makeExtinstHeaders.py | 1 + 5 files changed, 200 insertions(+) create mode 100644 include/spirv/unified1/NonSemanticVkspReflection.h create mode 100644 include/spirv/unified1/extinst.nonsemantic.vkspreflection.grammar.json diff --git a/BUILD.bazel b/BUILD.bazel index c898ade80..25634d948 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -81,6 +81,11 @@ filegroup( srcs = ["include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json"], ) +filegroup( + name = "spirv_ext_inst_nonsemantic_vkspreflection_grammar_unified1", + srcs = ["include/spirv/unified1/extinst.nonsemantic.vkspreflection.grammar.json"], +) + filegroup( name = "spirv_ext_inst_nonsemantic_debugprintf_grammar_unified1", srcs = ["include/spirv/unified1/extinst.nonsemantic.debugprintf.grammar.json"], @@ -128,6 +133,7 @@ cc_library( "include/spirv/unified1/GLSL.std.450.h", "include/spirv/unified1/NonSemanticClspvReflection.h", "include/spirv/unified1/NonSemanticDebugPrintf.h", + "include/spirv/unified1/NonSemanticVkspReflection.h", "include/spirv/unified1/OpenCL.std.h", ], includes = ["include"], diff --git a/BUILD.gn b/BUILD.gn index be3f43b3f..c15c56e59 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -35,6 +35,7 @@ source_set("spv_headers") { "include/spirv/unified1/GLSL.std.450.h", "include/spirv/unified1/NonSemanticClspvReflection.h", "include/spirv/unified1/NonSemanticDebugPrintf.h", + "include/spirv/unified1/NonSemanticVkspReflection.h", "include/spirv/unified1/OpenCL.std.h", "include/spirv/unified1/spirv.h", "include/spirv/unified1/spirv.hpp", diff --git a/include/spirv/unified1/NonSemanticVkspReflection.h b/include/spirv/unified1/NonSemanticVkspReflection.h new file mode 100644 index 000000000..47a279d26 --- /dev/null +++ b/include/spirv/unified1/NonSemanticVkspReflection.h @@ -0,0 +1,57 @@ +// Copyright (c) 2020 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and/or associated documentation files (the +// "Materials"), to deal in the Materials without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Materials, and to +// permit persons to whom the Materials are furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT +// https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +// + +#ifndef SPIRV_UNIFIED1_NonSemanticVkspReflection_H_ +#define SPIRV_UNIFIED1_NonSemanticVkspReflection_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + NonSemanticVkspReflectionRevision = 1, + NonSemanticVkspReflectionRevision_BitWidthPadding = 0x7fffffff +}; + +enum NonSemanticVkspReflectionInstructions { + NonSemanticVkspReflectionConfiguration = 1, + NonSemanticVkspReflectionStartCounter = 2, + NonSemanticVkspReflectionStopCounter = 3, + NonSemanticVkspReflectionPushConstants = 4, + NonSemanticVkspReflectionSpecializationMapEntry = 5, + NonSemanticVkspReflectionDescriptorSetBuffer = 6, + NonSemanticVkspReflectionDescriptorSetImage = 7, + NonSemanticVkspReflectionDescriptorSetSampler = 8, + NonSemanticVkspReflectionInstructionsMax = 0x7fffffff +}; + + +#ifdef __cplusplus +} +#endif + +#endif // SPIRV_UNIFIED1_NonSemanticVkspReflection_H_ diff --git a/include/spirv/unified1/extinst.nonsemantic.vkspreflection.grammar.json b/include/spirv/unified1/extinst.nonsemantic.vkspreflection.grammar.json new file mode 100644 index 000000000..bee1bea3f --- /dev/null +++ b/include/spirv/unified1/extinst.nonsemantic.vkspreflection.grammar.json @@ -0,0 +1,135 @@ +{ + "revision" : 1, + "instructions" : [ + { + "opname" : "Configuration", + "opcode" : 1, + "operands" : [ + {"kind" : "LiteralString", "name" : "enabledExtensionNames" }, + {"kind" : "LiteralInteger", "name" : "specializationInfoDataSize" }, + {"kind" : "LiteralString", "name" : "specializationInfoData" }, + {"kind" : "LiteralString", "name" : "shaderName" }, + {"kind" : "LiteralString", "name" : "EntryPoint" }, + {"kind" : "LiteralInteger", "name" : "groupCountX" }, + {"kind" : "LiteralInteger", "name" : "groupCountY" }, + {"kind" : "LiteralInteger", "name" : "groupCountZ" } + ] + }, + { + "opname" : "StartCounter", + "opcode" : 2, + "operands" : [ + {"kind" : "LiteralString", "name" : "name" } + ] + }, + { + "opname" : "StopCounter", + "opcode" : 3, + "operands" : [ + {"kind" : "IdRef", "name" : "counter" } + ] + }, + { + "opname" : "PushConstants", + "opcode" : 4, + "operands" : [ + { "kind" : "LiteralInteger", "name" : "offset" }, + { "kind" : "LiteralInteger", "name" : "size" }, + { "kind" : "LiteralString", "name" : "pValues" }, + { "kind" : "LiteralInteger", "name" : "stageFlags" } + ] + }, + { + "opname" : "SpecializationMapEntry", + "opcode" : 5, + "operands" : [ + {"kind" : "LiteralInteger", "name" : "constantID" }, + {"kind" : "LiteralInteger", "name" : "offset" }, + {"kind" : "LiteralInteger", "name" : "size" } + ] + }, + { + "opname" : "DescriptorSetBuffer", + "opcode" : 6, + "operands" : [ + { "kind" : "LiteralInteger", "name" : "ds" }, + { "kind" : "LiteralInteger", "name" : "binding" }, + { "kind" : "LiteralInteger", "name" : "type" }, + { "kind" : "LiteralInteger", "name" : "flags" }, + { "kind" : "LiteralInteger", "name" : "queueFamilyIndexCount" }, + { "kind" : "LiteralInteger", "name" : "sharingMode" }, + { "kind" : "LiteralInteger", "name" : "size" }, + { "kind" : "LiteralInteger", "name" : "usage" }, + { "kind" : "LiteralInteger", "name" : "range" }, + { "kind" : "LiteralInteger", "name" : "offset" }, + { "kind" : "LiteralInteger", "name" : "memorySize" }, + { "kind" : "LiteralInteger", "name" : "memoryType" }, + { "kind" : "LiteralInteger", "name" : "bindOffset" } + ] + }, + { + "opname" : "DescriptorSetImage", + "opcode" : 7, + "operands" : [ + { "kind" : "LiteralInteger", "name" : "ds" }, + { "kind" : "LiteralInteger", "name" : "binding" }, + { "kind" : "LiteralInteger", "name" : "type" }, + { "kind" : "LiteralInteger", "name" : "imageLayout"}, + { "kind" : "LiteralInteger", "name" : "imageFlags"}, + { "kind" : "LiteralInteger", "name" : "imageType"}, + { "kind" : "LiteralInteger", "name" : "imageformat"}, + { "kind" : "LiteralInteger", "name" : "width"}, + { "kind" : "LiteralInteger", "name" : "height"}, + { "kind" : "LiteralInteger", "name" : "depth"}, + { "kind" : "LiteralInteger", "name" : "mipLevels"}, + { "kind" : "LiteralInteger", "name" : "arrayLayers"}, + { "kind" : "LiteralInteger", "name" : "samples"}, + { "kind" : "LiteralInteger", "name" : "tiling"}, + { "kind" : "LiteralInteger", "name" : "usage"}, + { "kind" : "LiteralInteger", "name" : "sharingMode"}, + { "kind" : "LiteralInteger", "name" : "queueFamilyIndexCount"}, + { "kind" : "LiteralInteger", "name" : "initialLayout"}, + { "kind" : "LiteralInteger", "name" : "aspectMask"}, + { "kind" : "LiteralInteger", "name" : "baseMipLevel"}, + { "kind" : "LiteralInteger", "name" : "levelCount"}, + { "kind" : "LiteralInteger", "name" : "baseArrayLayer"}, + { "kind" : "LiteralInteger", "name" : "layerCount"}, + { "kind" : "LiteralInteger", "name" : "viewFlags"}, + { "kind" : "LiteralInteger", "name" : "viewType"}, + { "kind" : "LiteralInteger", "name" : "viewFormat"}, + { "kind" : "LiteralInteger", "name" : "component_a"}, + { "kind" : "LiteralInteger", "name" : "component_b"}, + { "kind" : "LiteralInteger", "name" : "component_g"}, + { "kind" : "LiteralInteger", "name" : "component_r"}, + { "kind" : "LiteralInteger", "name" : "memorySize" }, + { "kind" : "LiteralInteger", "name" : "memoryType" }, + { "kind" : "LiteralInteger", "name" : "bindOffset"} + ] + }, + { + "opname" : "DescriptorSetSampler", + "opcode" : 8, + "operands" : [ + { "kind" : "LiteralInteger", "name" : "ds" }, + { "kind" : "LiteralInteger", "name" : "binding" }, + { "kind" : "LiteralInteger", "name" : "type" }, + { "kind" : "LiteralInteger", "name" : "flags"}, + { "kind" : "LiteralInteger", "name" : "magFilter"}, + { "kind" : "LiteralInteger", "name" : "minFilter"}, + { "kind" : "LiteralInteger", "name" : "mipmapMode"}, + { "kind" : "LiteralInteger", "name" : "addressModeU"}, + { "kind" : "LiteralInteger", "name" : "addressModeV"}, + { "kind" : "LiteralInteger", "name" : "addressModeW"}, + { "kind" : "LiteralFloat", "name" : "mipLodBias"}, + { "kind" : "LiteralInteger", "name" : "anisotropyEnable"}, + { "kind" : "LiteralFloat", "name" : "maxAnisotropy"}, + { "kind" : "LiteralInteger", "name" : "compareEnable"}, + { "kind" : "LiteralInteger", "name" : "compareOp"}, + { "kind" : "LiteralFloat", "name" : "minLod"}, + { "kind" : "LiteralFloat", "name" : "maxLod"}, + { "kind" : "LiteralInteger", "name" : "borderColor"}, + { "kind" : "LiteralInteger", "name" : "unnormalizedCoordinates"} + ] + } + ] +} diff --git a/tools/buildHeaders/bin/makeExtinstHeaders.py b/tools/buildHeaders/bin/makeExtinstHeaders.py index 8852d19c8..96ce008f6 100755 --- a/tools/buildHeaders/bin/makeExtinstHeaders.py +++ b/tools/buildHeaders/bin/makeExtinstHeaders.py @@ -27,3 +27,4 @@ def mk_extinst(name, grammar_file): mk_extinst('NonSemanticDebugPrintf', 'extinst.nonsemantic.debugprintf.grammar.json') mk_extinst('NonSemanticClspvReflection', 'extinst.nonsemantic.clspvreflection.grammar.json') mk_extinst('NonSemanticDebugBreak', 'extinst.nonsemantic.debugbreak.grammar.json') +mk_extinst('NonSemanticVkspReflection', 'extinst.nonsemantic.vkspreflection.grammar.json')