diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index 88dca80160..23a75f5e45 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -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; } diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index 48ccea15b4..1cba93affa 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -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(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(); } diff --git a/rocclr/platform/command.hpp b/rocclr/platform/command.hpp index 1eb7d0f0b0..2e242ce125 100644 --- a/rocclr/platform/command.hpp +++ b/rocclr/platform/command.hpp @@ -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); } diff --git a/rocclr/utils/flags.hpp b/rocclr/utils/flags.hpp index da982e8892..d4d5398fef 100644 --- a/rocclr/utils/flags.hpp +++ b/rocclr/utils/flags.hpp @@ -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 {