Add Queue profling param and toggle for HIP

Use signal timestamps if NDRange command takes forceProfile flag.

Change-Id: Ib7f187d781fd78a7346818afb3344a9378f4c104
This commit is contained in:
Saleel Kudchadker
2020-07-29 12:55:10 -07:00
parent 093f7fa3ca
commit ec73340348
4 changed files with 15 additions and 6 deletions
+8 -2
View File
@@ -76,7 +76,7 @@ uint64_t Event::recordProfilingInfo(int32_t status, uint64_t timeStamp) {
break;
default:
profilingInfo_.end_ = timeStamp;
if (profilingInfo_.callback_ != NULL) {
if (profilingInfo_.callback_ != nullptr) {
profilingInfo_.callback_->callback(timeStamp - profilingInfo_.start_,
profilingInfo_.waves_);
}
@@ -270,7 +270,8 @@ NDRangeKernelCommand::NDRangeKernelCommand(HostQueue& queue, const EventWaitList
Kernel& kernel, const NDRangeContainer& sizes,
uint32_t sharedMemBytes, uint32_t extraParam,
uint32_t gridId, uint32_t numGrids,
uint64_t prevGridSum, uint64_t allGridSum, uint32_t firstDevice) :
uint64_t prevGridSum, uint64_t allGridSum,
uint32_t firstDevice, bool forceProfiling) :
Command(queue, CL_COMMAND_NDRANGE_KERNEL, eventWaitList, AMD_SERIALIZE_KERNEL),
kernel_(kernel),
sizes_(sizes),
@@ -285,6 +286,11 @@ NDRangeKernelCommand::NDRangeKernelCommand(HostQueue& queue, const EventWaitList
auto devKernel = const_cast<device::Kernel*>(kernel.getDeviceKernel(device));
profilingInfo_.setCallback(devKernel->getProfilingCallback(
queue.vdev()), devKernel->getWavesPerSH(queue.vdev()));
if (forceProfiling) {
profilingInfo_.enabled_ = true;
profilingInfo_.clear();
profilingInfo_.callback_ = nullptr;
}
kernel_.retain();
}
+3 -2
View File
@@ -100,7 +100,7 @@ class Event : public RuntimeObject {
ProfilingInfo(bool enabled = false) : enabled_(enabled), waves_(0) {
if (enabled) {
clear();
callback_ = NULL;
callback_ = nullptr;
}
}
@@ -801,7 +801,8 @@ class NDRangeKernelCommand : public Command {
NDRangeKernelCommand(HostQueue& queue, const EventWaitList& eventWaitList, Kernel& kernel,
const NDRangeContainer& sizes, uint32_t sharedMemBytes = 0,
uint32_t extraParam = 0, uint32_t gridId = 0, uint32_t numGrids = 0,
uint64_t prevGridSum = 0, uint64_t allGridSum = 0, uint32_t firstDevice = 0);
uint64_t prevGridSum = 0, uint64_t allGridSum = 0,
uint32_t firstDevice = 0, bool forceProfiling = false);
virtual void submit(device::VirtualDevice& device) { device.submitKernel(*this); }