Skip to content

Commit

Permalink
opt: Remove bindless and buff addr instrumentation passes (KhronosGro…
Browse files Browse the repository at this point in the history
…up#5657)

These were only used by Vulkan-Validation layers, but they
have been replaced by other code for several months.
  • Loading branch information
jeremyg-lunarg authored May 2, 2024
1 parent bfc3a15 commit 9241a58
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 7,525 deletions.
2 changes: 0 additions & 2 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ SPVTOOLS_OPT_SRC_FILES := \
source/opt/inline_pass.cpp \
source/opt/inline_exhaustive_pass.cpp \
source/opt/inline_opaque_pass.cpp \
source/opt/inst_bindless_check_pass.cpp \
source/opt/inst_buff_addr_check_pass.cpp \
source/opt/inst_debug_printf_pass.cpp \
source/opt/instruction.cpp \
source/opt/instruction_list.cpp \
Expand Down
4 changes: 0 additions & 4 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,6 @@ static_library("spvtools_opt") {
"source/opt/inline_opaque_pass.h",
"source/opt/inline_pass.cpp",
"source/opt/inline_pass.h",
"source/opt/inst_bindless_check_pass.cpp",
"source/opt/inst_bindless_check_pass.h",
"source/opt/inst_buff_addr_check_pass.cpp",
"source/opt/inst_buff_addr_check_pass.h",
"source/opt/inst_debug_printf_pass.cpp",
"source/opt/inst_debug_printf_pass.h",
"source/opt/instruction.cpp",
Expand Down
9 changes: 1 addition & 8 deletions include/spirv-tools/instrument.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
// This file provides an external interface for applications that wish to
// communicate with shaders instrumented by passes created by:
//
// CreateInstBindlessCheckPass
// CreateInstBuffAddrCheckPass
// CreateInstDebugPrintfPass
//
// More detailed documentation of these routines can be found in optimizer.hpp
Expand All @@ -34,17 +32,12 @@ namespace spvtools {
//
// The following values provide offsets into the output buffer struct
// generated by InstrumentPass::GenDebugStreamWrite. This method is utilized
// by InstBindlessCheckPass, InstBuffAddrCheckPass, and InstDebugPrintfPass.
// by InstDebugPrintfPass.
//
// The 1st member of the debug output buffer contains a set of flags
// controlling the behavior of instrumentation code.
static const int kDebugOutputFlagsOffset = 0;

// Values stored at kDebugOutputFlagsOffset
enum kInstFlags : unsigned int {
kInstBufferOOBEnable = 0x1,
};

// The 2nd member of the debug output buffer contains the next available word
// in the data stream to be written. Shaders will atomically read and update
// this value so as not to overwrite each others records. This value must be
Expand Down
47 changes: 0 additions & 47 deletions include/spirv-tools/optimizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,53 +747,6 @@ Optimizer::PassToken CreateReduceLoadSizePass(
// them into a single instruction where possible.
Optimizer::PassToken CreateCombineAccessChainsPass();

// Create a pass to instrument bindless descriptor checking
// This pass instruments all bindless references to check that descriptor
// array indices are inbounds, and if the descriptor indexing extension is
// enabled, that the descriptor has been initialized. If the reference is
// invalid, a record is written to the debug output buffer (if space allows)
// and a null value is returned. This pass is designed to support bindless
// validation in the Vulkan validation layers.
//
// TODO(greg-lunarg): Add support for buffer references. Currently only does
// checking for image references.
//
// Dead code elimination should be run after this pass as the original,
// potentially invalid code is not removed and could cause undefined behavior,
// including crashes. It may also be beneficial to run Simplification
// (ie Constant Propagation), DeadBranchElim and BlockMerge after this pass to
// optimize instrument code involving the testing of compile-time constants.
// It is also generally recommended that this pass (and all
// instrumentation passes) be run after any legalization and optimization
// passes. This will give better analysis for the instrumentation and avoid
// potentially de-optimizing the instrument code, for example, inlining
// the debug record output function throughout the module.
//
// The instrumentation will write |shader_id| in each output record
// to identify the shader module which generated the record.
Optimizer::PassToken CreateInstBindlessCheckPass(uint32_t shader_id);

// Create a pass to instrument physical buffer address checking
// This pass instruments all physical buffer address references to check that
// all referenced bytes fall in a valid buffer. If the reference is
// invalid, a record is written to the debug output buffer (if space allows)
// and a null value is returned. This pass is designed to support buffer
// address validation in the Vulkan validation layers.
//
// Dead code elimination should be run after this pass as the original,
// potentially invalid code is not removed and could cause undefined behavior,
// including crashes. Instruction simplification would likely also be
// beneficial. It is also generally recommended that this pass (and all
// instrumentation passes) be run after any legalization and optimization
// passes. This will give better analysis for the instrumentation and avoid
// potentially de-optimizing the instrument code, for example, inlining
// the debug record output function throughout the module.
//
// The instrumentation will read and write buffers in debug
// descriptor set |desc_set|. It will write |shader_id| in each output record
// to identify the shader module which generated the record.
Optimizer::PassToken CreateInstBuffAddrCheckPass(uint32_t shader_id);

// Create a pass to instrument OpDebugPrintf instructions.
// This pass replaces all OpDebugPrintf instructions with instructions to write
// a record containing the string id and the all specified values into a special
Expand Down
4 changes: 0 additions & 4 deletions source/opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ set(SPIRV_TOOLS_OPT_SOURCES
inline_exhaustive_pass.h
inline_opaque_pass.h
inline_pass.h
inst_bindless_check_pass.h
inst_buff_addr_check_pass.h
inst_debug_printf_pass.h
instruction.h
instruction_list.h
Expand Down Expand Up @@ -186,8 +184,6 @@ set(SPIRV_TOOLS_OPT_SOURCES
inline_exhaustive_pass.cpp
inline_opaque_pass.cpp
inline_pass.cpp
inst_bindless_check_pass.cpp
inst_buff_addr_check_pass.cpp
inst_debug_printf_pass.cpp
instruction.cpp
instruction_list.cpp
Expand Down
Loading

0 comments on commit 9241a58

Please sign in to comment.