-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathtest_debug.py
More file actions
60 lines (46 loc) · 1.57 KB
/
Copy pathtest_debug.py
File metadata and controls
60 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
import os
import subprocess
import sys
import zipfile
from cuda.tile._exception import Loc
def _run_crash_dump():
import torch
import cuda.tile as ct
import cuda.tile._compile as tile_compile
from cuda.tile._exception import TileCompilerExecutionError
def fail_compilation(*args, **kwargs):
raise TileCompilerExecutionError(
1, "error: compiler error", Loc.unknown(), "--compiler-flag", "13.3"
)
tile_compile.compile_cubin = fail_compilation
@ct.kernel
def kernel():
pass
try:
ct.launch(torch.cuda.current_stream(), (1,), kernel, ())
except TileCompilerExecutionError:
pass
else:
raise AssertionError("Expected tile compiler failure")
def test_crash_dump_enabled_by_env(tmp_path):
env = os.environ.copy()
env["CUDA_TILE_ENABLE_CRASH_DUMP"] = "1"
env["CUDA_TILE_TEMP_DIR"] = str(tmp_path / "temp")
env["CUDA_TILE_CACHE_DIR"] = "0"
subprocess.run(
[sys.executable, os.path.abspath(__file__)],
check=True,
cwd=tmp_path,
env=env,
)
[dump_path] = tmp_path.glob("crash_dump_*.zip")
with zipfile.ZipFile(dump_path) as dump:
artifacts = dump.namelist()
assert "debug_info.txt" in artifacts
assert any(name.endswith(".bytecode") for name in artifacts)
assert any(name.endswith(".cutileir") for name in artifacts)
if __name__ == "__main__":
_run_crash_dump()