Skip to content

Commit 3a37788

Browse files
briancoutinhofacebook-github-bot
authored andcommitted
Fix CUPTI Range Profiler test (pytorch#1091)
Summary: Pull Request resolved: pytorch#1091 Simple fix that was causing a test failure earlier. The test mocks the object but the destructor calls CUDA deinit() API. This should have been fused out basically. https://github.com/pytorch/kineto/blob/main/libkineto/src/CuptiRangeProfilerApi.cpp#L716-L719 Reviewed By: sraikund16 Differential Revision: D75494874 fbshipit-source-id: 1426e7ee82592c57a4e5716fd423625819da2918
1 parent 84ab323 commit 3a37788

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

libkineto/src/CuptiRangeProfilerApi.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ CuptiRBProfilerSession::CuptiRBProfilerSession(
336336
// used in unittests only
337337
if (opts.unitTest) {
338338
initSuccess_ = true;
339+
unitTest_ = true;
339340
profiler_map[deviceId_] = this;
340341
return;
341342
}
@@ -714,7 +715,7 @@ bool CuptiRBProfilerSession::createCounterDataImage() {
714715
}
715716

716717
CuptiRBProfilerSession::~CuptiRBProfilerSession() {
717-
if (initSuccess_) {
718+
if (initSuccess_ && !unitTest_) {
718719
CuptiRBProfilerSession::deInitCupti();
719720
}
720721
}

libkineto/src/CuptiRangeProfilerApi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class CuptiRBProfilerSession {
209209

210210
bool initSuccess_ = false;
211211
bool profilingActive_ = false;
212+
bool unitTest_ = false;
212213

213214
friend void __trackCudaKernelLaunch(CUcontext ctx, const char* kernelName);
214215
};

0 commit comments

Comments
 (0)