Skip to content

Commit 710e5d6

Browse files
committed
also output code objects
1 parent 67bb866 commit 710e5d6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/libkernelbot/run_eval.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,18 @@ def compile_cuda_script( # # noqa: C901
233233

234234

235235
def run_program(
236-
args: list[str], seed: Optional[int], timeout: int, multi_gpu: bool = False
236+
args: list[str],
237+
seed: Optional[int],
238+
timeout: int,
239+
multi_gpu: bool = False,
240+
extra_env: Optional[dict[str, str]] = None,
237241
) -> RunResult:
238242
print("[Running]")
239243
# set up a pipe so the tester can communicate its verdict with us
240244
env = os.environ.copy()
245+
if extra_env is not None:
246+
env.update(extra_env)
247+
241248
pipe_read, pipe_write = os.pipe()
242249
env["POPCORN_FD"] = str(pipe_write)
243250
if seed is not None:
@@ -344,7 +351,10 @@ def profile_program(
344351
"--",
345352
] + call
346353

347-
run_result = run_program(call, seed=seed, timeout=timeout, multi_gpu=multi_gpu)
354+
run_result = run_program(call, seed=seed, timeout=timeout, multi_gpu=multi_gpu, extra_env={
355+
"GPU_DUMP_CODE_OBJECT": "1",
356+
})
357+
348358
profile_result = None
349359

350360
if run_result.success:
@@ -362,6 +372,10 @@ def profile_program(
362372
# keeping the individual traces around.
363373
trace_path.unlink()
364374

375+
# Also move the code objects to the profiling output directory.
376+
for code_obj in list(Path.cwd().glob("_code_object*.o")):
377+
code_obj.rename(output_dir / code_obj.name)
378+
365379
profile_result = ProfileResult(
366380
profiler='rocPROF',
367381
download_url=None,

0 commit comments

Comments
 (0)