Enable queue profile only if we attach a profiler

Submit explicit profile marker for hipEventRecord to record
timestamps. Enable explicit signal profiling if the API specifies
start and stop events.

Toggle this with env var HIP_FORCE_QUEUE_PROFILING=0

Change-Id: Iae449a63ec3ebf6c2880e65d7b1dd1031a29018f
이 커밋은 다음에 포함됨:
Saleel Kudchadker가 2020-08-06 11:28:16 -04:00를 커밋했습니다
1 부모 c24f884c76
커밋 dec95e58e3
4 파일이 변경됨
+38 -19

검색과 일치하는 파일 없음

+12 -3
파일 보기
@@ -22,6 +22,9 @@
#include "hip_internal.hpp"
#include "hip_event.hpp"
#include "thread/monitor.hpp"
#include "hip_prof_api.h"
extern api_callbacks_table_t callbacks_table;
static amd::Monitor streamSetLock{"Guards global stream set"};
static std::unordered_set<hip::Stream*> streamSet;
@@ -50,7 +53,12 @@ Stream::Stream(hip::Device* dev, Priority p,
// ================================================================================================
bool Stream::Create() {
cl_command_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
// Enable queue profiling if a profiler is attached which sets the callback_table flag
// or if we force it with env var. This would enable time stamp collection for every
// command submitted to the stream(queue).
cl_command_queue_properties properties = (callbacks_table.is_enabled() ||
HIP_FORCE_QUEUE_PROFILING) ?
CL_QUEUE_PROFILING_ENABLE : 0;
amd::CommandQueue::Priority p;
switch (priority_) {
case Priority::High:
@@ -64,8 +72,9 @@ bool Stream::Create() {
p = amd::CommandQueue::Priority::Normal;
break;
}
amd::HostQueue* queue = new amd::HostQueue(*device_->asContext(), *device_->devices()[0], properties,
amd::CommandQueue::RealTimeDisabled, p, cuMask_);
amd::HostQueue* queue = new amd::HostQueue(*device_->asContext(), *device_->devices()[0],
properties, amd::CommandQueue::RealTimeDisabled,
p, cuMask_);
// Create a host queue
bool result = (queue != nullptr) ? queue->create() : false;