Skip to content

Commit e7980d8

Browse files
sraikund16facebook-github-bot
authored andcommitted
Don't Allow Profiling Thread to pick up wrong config
Summary: Now that we have two types of on-demand threads accepting requests (GPU Traces + Memory Snapshots) we need to lock out one thread from using another's request. Right now there is a possibility that a user does memory profiling then gpu trace profiling which will cause the second trace to be invalid. NOTE: To get both types of requests working in a single run, we will need a follow up diff in which both threads can be instantiated and tracked. Currently, if we make one type of thread, we lock out the other. This diff is an incremental step towards getting both to work. Differential Revision: D72980123
1 parent 856c48c commit e7980d8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libkineto/src/ActivityProfilerController.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ bool ActivityProfilerController::shouldActivateTimestampConfig(
146146
if (asyncRequestConfig_->hasProfileStartIteration()) {
147147
return false;
148148
}
149+
if (asyncRequestConfig_->memoryProfilerEnabled()) {
150+
return false;
151+
}
149152
// Note on now + Config::kControllerIntervalMsecs:
150153
// Profiler interval does not align perfectly up to startTime - warmup.
151154
// Waiting until the next tick won't allow sufficient time for the profiler to
@@ -252,7 +255,8 @@ void ActivityProfilerController::memoryProfilerLoop() {
252255
// Perform Double-checked locking to reduce overhead of taking lock.
253256
if (asyncRequestConfig_ && !profiler_->isActive()) {
254257
std::lock_guard<std::mutex> lock(asyncConfigLock_);
255-
if (asyncRequestConfig_ && !profiler_->isActive()) {
258+
if (asyncRequestConfig_ && !profiler_->isActive() &&
259+
asyncRequestConfig_->memoryProfilerEnabled()) {
256260
logger_ = makeLogger(*asyncRequestConfig_);
257261
path = asyncRequestConfig_->activitiesLogFile();
258262
profile_time = asyncRequestConfig_->profileMemoryDuration();

0 commit comments

Comments
 (0)