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
förälder 093f7fa3ca
incheckning ec73340348
4 ändrade filer med 15 tillägg och 6 borttagningar
+1 -1
Visa fil
@@ -763,7 +763,7 @@ bool VirtualGPU::create() {
gpu_queue_ = roc_device_.acquireQueue(queue_size, cooperative_, cuMask_, priority_);
if (!gpu_queue_) return false;
if (!initPool(dev().settings().kernargPoolSize_, (profiling_) ? queue_size : 0)) {
if (!initPool(dev().settings().kernargPoolSize_, (amd::IS_HIP) ? queue_size : 0)) {
LogError("Couldn't allocate arguments/signals for the queue");
return false;
}
+8 -2
Visa fil
@@ -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
Visa fil
@@ -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); }
+3 -1
Visa fil
@@ -237,7 +237,9 @@ release(uint, HIP_HIDDEN_FREE_MEM, 0, \
release(size_t, GPU_FORCE_BLIT_COPY_SIZE, 0, \
"Size in KB of the threshold below which to force blit instead for sdma") \
release(bool, ROC_ENABLE_LARGE_BAR, true, \
"Enable Large Bar if supported by the device")
"Enable Large Bar if supported by the device") \
release(bool, HIP_FORCE_QUEUE_PROFILING, false, \
"Force command queue profiling by default")
namespace amd {