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
21 changes: 21 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,24 @@ command = [
"--",
"@{{PATHSFILE}}",
]

[[linter]]
code = 'ETVKNODEBUG'
include_patterns = [
"backends/vulkan/**/*.glsl",
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'grep_linter',
'--pattern=((DEBUG_MODE)|(GL_EXT_debug_printf))',
'--linter-name=ETVKNODEBUG',
'--error-name=Using DEBUG_MODE or GL_EXT_debug_printf in Vulkan shader',
"""--error-description=\
#define DEBUG_MODE or #extension GL_EXT_debug_printf should only be used during development!
""",
'--',
'@{{PATHSFILE}}',
]
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ ${define_required_extensions(DTYPE)}

layout(std430) buffer;

#extension GL_EXT_debug_printf : enable
#define DEBUG_MODE
#include "indexing.glslh"
#include "common.glslh"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ ${define_required_extensions(DTYPE)}

layout(std430) buffer;

#define DEBUG_MODE
#include "indexing.glslh"

${layout_declare_tensor(B, "w", "t_out", DTYPE, STORAGE)}
Expand Down
4 changes: 4 additions & 0 deletions backends/vulkan/runtime/graph/ops/glsl/common.glslh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#ifndef COMMON_GLSLH
#define COMMON_GLSLH

#ifdef DEBUG_MODE
#extension GL_EXT_debug_printf : enable
#endif

#define mul_2(x) ((x) << 1)
#define mul_4(x) ((x) << 2)
#define mul_8(x) ((x) << 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ ${define_required_extensions(DTYPE)}

layout(std430) buffer;

#define DEBUG_MODE
#include "indexing.glslh"

${layout_declare_tensor(B, "w", "t_out", DTYPE, "buffer")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ${define_required_extensions(DTYPE)}

layout(std430) buffer;

#define DEBUG_MODE
#include "common.glslh"
#include "indexing.glslh"

Expand Down
2 changes: 0 additions & 2 deletions backends/vulkan/runtime/graph/ops/glsl/indexing.glslh
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ TextureElementIndex tensor_idx_to_texture_element_idx_simple(

#ifdef DEBUG_MODE

#extension GL_EXT_debug_printf : enable

void printTensorIndex(const TensorIndex tidx) {
debugPrintfEXT(
"TensorIndex: tidx=[%u %u %u %u %u %u %u %u]\\n",
Expand Down
Loading