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
This commit is contained in:
Saleel Kudchadker
2020-07-22 11:35:15 -07:00
parent 39d681b6be
commit 2ef062480b
4 ha cambiato i file con 38 aggiunte e 19 eliminazioni
+8 -5
Vedi File
@@ -249,7 +249,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
size_t localWorkSize[3] = { blockDimX, blockDimY, blockDimZ };
amd::NDRangeContainer ndrange(3, globalWorkOffset, globalWorkSize, localWorkSize);
amd::Command::EventWaitList waitList;
bool profileNDRange = false;
address kernargs = nullptr;
// 'extra' is a struct that contains the following info: {
@@ -273,13 +273,16 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX,
desc.type_ == T_POINTER/*svmBound*/);
} else {
assert(extra == nullptr);
kernel->parameters().set(i, desc.size_, kernelParams[i], desc.type_ == T_POINTER/*svmBound*/);
kernel->parameters().set(i, desc.size_, kernelParams[i],
desc.type_ == T_POINTER/*svmBound*/);
}
}
profileNDRange = (startEvent != nullptr && stopEvent != nullptr);
amd::NDRangeKernelCommand* command = new amd::NDRangeKernelCommand(
*queue, waitList, *kernel, ndrange, sharedMemBytes,
params, gridId, numGrids, prevGridSum, allGridSum, firstDevice);
params, gridId, numGrids, prevGridSum, allGridSum, firstDevice, profileNDRange);
if (!command) {
return hipErrorOutOfMemory;
}
@@ -472,7 +475,7 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
uint64_t prevGridSize = 0;
uint32_t firstDevice = 0;
// Sync the execution streams on all devices
// Sync the execution streams on all devices
if ((flags & hipCooperativeLaunchMultiDeviceNoPreSync) == 0) {
for (int i = 0; i < numDevices; ++i) {
amd::HostQueue* queue =
@@ -520,7 +523,7 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
prevGridSize += launch.gridDim.x * launch.gridDim.y * launch.gridDim.z;
}
// Sync the execution streams on all devices
// Sync the execution streams on all devices
if ((flags & hipCooperativeLaunchMultiDeviceNoPostSync) == 0) {
for (int i = 0; i < numDevices; ++i) {
amd::HostQueue* queue =