Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit ba7a596

Browse files
nicolasvasilacheftynse
authored andcommitted
Add a dump_ptx flag for deeper bug analysis
This commit was originally used for tracking an illegal memory access at the PTX level. It is useful independently.
1 parent b29ed63 commit ba7a596

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

tc/core/cuda/cuda_rtc.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ std::unique_ptr<CudaRTCFunction> CudaRTCFunction::Compile(
113113
res->nvrtc_ptx = std::vector<char>(ptx_size);
114114
TC_NVRTC_CHECK(nvrtcGetPTX(prog, res->nvrtc_ptx.data()));
115115
TC_NVRTC_CHECK(nvrtcDestroyProgram(&prog));
116-
116+
if (FLAGS_dump_ptx) {
117+
LOG(INFO) << "PTX:\n" << std::string(res->nvrtc_ptx.data());
118+
}
117119
return res;
118120
}
119121
namespace {

tc/core/flags.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ DEFINE_bool(
3636
false,
3737
"Print debug spew for the tc_mapper like cuda code, mapping options etc");
3838
DEFINE_bool(dump_cuda, false, "Print the generated source");
39+
DEFINE_bool(dump_ptx, false, "Dump the generated PTX");
3940

4041
// CPU codegen options
4142
DEFINE_bool(llvm_dump_before_opt, false, "Print IR before optimization");

tc/core/flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ DECLARE_bool(debug_tc_mapper);
2929
DECLARE_bool(debug_cuda);
3030
DECLARE_bool(debug_tuner);
3131
DECLARE_bool(dump_cuda);
32+
DECLARE_bool(dump_ptx);
3233

3334
// llvm codegen
3435
DECLARE_bool(llvm_dump_before_opt);

0 commit comments

Comments
 (0)