Skip to content

Commit adb0dec

Browse files
authored
[ET-VK][ez] Add lint rule to check no debug mode in shaders + clean up debug mode usage
Differential Revision: D86340342 Pull Request resolved: #15616
1 parent e3c5af8 commit adb0dec

File tree

7 files changed

+25
-7
lines changed

7 files changed

+25
-7
lines changed

.lintrunner.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,3 +449,24 @@ command = [
449449
"--",
450450
"@{{PATHSFILE}}",
451451
]
452+
453+
[[linter]]
454+
code = 'ETVKNODEBUG'
455+
include_patterns = [
456+
"backends/vulkan/**/*.glsl",
457+
]
458+
command = [
459+
'python',
460+
'-m',
461+
'lintrunner_adapters',
462+
'run',
463+
'grep_linter',
464+
'--pattern=((DEBUG_MODE)|(GL_EXT_debug_printf))',
465+
'--linter-name=ETVKNODEBUG',
466+
'--error-name=Using DEBUG_MODE or GL_EXT_debug_printf in Vulkan shader',
467+
"""--error-description=\
468+
#define DEBUG_MODE or #extension GL_EXT_debug_printf should only be used during development!
469+
""",
470+
'--',
471+
'@{{PATHSFILE}}',
472+
]

backends/vulkan/runtime/graph/ops/glsl/binary_q8ta_q8ta_q8to.glsl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ ${define_required_extensions(DTYPE)}
2525

2626
layout(std430) buffer;
2727

28-
#extension GL_EXT_debug_printf : enable
29-
#define DEBUG_MODE
3028
#include "indexing.glslh"
3129
#include "common.glslh"
3230

backends/vulkan/runtime/graph/ops/glsl/binary_scalar_texture.glsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ ${define_required_extensions(DTYPE)}
2222

2323
layout(std430) buffer;
2424

25-
#define DEBUG_MODE
2625
#include "indexing.glslh"
2726

2827
${layout_declare_tensor(B, "w", "t_out", DTYPE, STORAGE)}

backends/vulkan/runtime/graph/ops/glsl/common.glslh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#ifndef COMMON_GLSLH
1010
#define COMMON_GLSLH
1111

12+
#ifdef DEBUG_MODE
13+
#extension GL_EXT_debug_printf : enable
14+
#endif
15+
1216
#define mul_2(x) ((x) << 1)
1317
#define mul_4(x) ((x) << 2)
1418
#define mul_8(x) ((x) << 3)

backends/vulkan/runtime/graph/ops/glsl/embedding_buffer.glsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ${define_required_extensions(DTYPE)}
1919

2020
layout(std430) buffer;
2121

22-
#define DEBUG_MODE
2322
#include "indexing.glslh"
2423

2524
${layout_declare_tensor(B, "w", "t_out", DTYPE, "buffer")}

backends/vulkan/runtime/graph/ops/glsl/embedding_texture.glsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ ${define_required_extensions(DTYPE)}
2020

2121
layout(std430) buffer;
2222

23-
#define DEBUG_MODE
2423
#include "common.glslh"
2524
#include "indexing.glslh"
2625

backends/vulkan/runtime/graph/ops/glsl/indexing.glslh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ TextureElementIndex tensor_idx_to_texture_element_idx_simple(
278278

279279
#ifdef DEBUG_MODE
280280

281-
#extension GL_EXT_debug_printf : enable
282-
283281
void printTensorIndex(const TensorIndex tidx) {
284282
debugPrintfEXT(
285283
"TensorIndex: tidx=[%u %u %u %u %u %u %u %u]\\n",

0 commit comments

Comments
 (0)