Skip to content

Commit fd28ab7

Browse files
committed
Revert "Revert "[PTXAS] Fix ptxas lineinfo option (#5705)""
This reverts commit be51333.
1 parent 36fece6 commit fd28ab7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

python/test/unit/language/test_line_info.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,21 @@ def test_line_info_interpreter(func: str):
250250
expected_def_lineno = 68
251251
kernel.rewrite()
252252
assert kernel.rewriter.def_file_lineno == expected_def_lineno
253+
254+
255+
@pytest.mark.parametrize("status", ["0", "1"])
256+
def test_line_info_env(monkeypatch, status: str):
257+
if is_interpreter():
258+
pytest.skip("interpreter does not support warmup compilation")
259+
260+
try:
261+
obj_kind, command, anchor, separator = get_disassembler_command_and_debug_line_format()
262+
except BaseException:
263+
pytest.skip("disassembler is not available")
264+
265+
shape = (128, )
266+
monkeypatch.setenv("TRITON_DISABLE_LINE_INFO", status)
267+
kernel_single.device_caches.clear()
268+
kernel_info = kernel_single.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1, ))
269+
file_lines = extract_file_lines(command, anchor, separator, kernel_info.asm[obj_kind])
270+
assert len(file_lines) == 0 if status == "1" else len(file_lines) > 0

third_party/nvidia/backend/compiler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ def make_cubin(self, src, metadata, opt, capability):
393393
fsrc.flush()
394394
fbin = fsrc.name + '.o'
395395

396-
line_info = [] if os.environ.get('TRITON_DISABLE_LINE_INFO') else ['-lineinfo']
396+
line_info = ["-lineinfo", "-suppress-debug-info"] if os.environ.get("TRITON_DISABLE_LINE_INFO",
397+
"0") == "1" else ["-lineinfo"]
397398
fmad = [] if opt.enable_fp_fusion else ['--fmad=false']
398399
suffix = 'a' if capability >= 90 else ''
399400
opt_level = ['--opt-level', '0'] if os.environ.get("DISABLE_PTXAS_OPT", "0") == "1" else []

0 commit comments

Comments
 (0)