SWDEV-444558 - SWDEV-444418 - Fix capturing of AQL packets when kernel arg size is 0
When graph doesn't have kernel nodes. Change-Id: I6b3b476654d7eedc9ff0cec4b7269168aa115360
This commit is contained in:
@@ -365,35 +365,38 @@ hipError_t GraphExec::CaptureAQLPackets() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto device = g_devices[ihipGetDevice()]->devices()[0];
|
||||
if (device->info().largeBar_) {
|
||||
// Pad kernel argument buffer with sentinal size bytes to do a readback later
|
||||
kernArgSizeForGraph += sizeof(int);
|
||||
kernarg_pool_graph_ =
|
||||
reinterpret_cast<address>(device->deviceLocalAlloc(kernArgSizeForGraph));
|
||||
device_kernarg_pool_ = true;
|
||||
} else {
|
||||
kernarg_pool_graph_ = reinterpret_cast<address>(
|
||||
device->hostAlloc(kernArgSizeForGraph, 0, amd::Device::MemorySegment::kKernArg));
|
||||
}
|
||||
if (kernArgSizeForGraph != 0) {
|
||||
if (device->info().largeBar_) {
|
||||
// Pad kernel argument buffer with sentinal size bytes to do a readback later
|
||||
kernArgSizeForGraph += sizeof(int);
|
||||
kernarg_pool_graph_ =
|
||||
reinterpret_cast<address>(device->deviceLocalAlloc(kernArgSizeForGraph));
|
||||
device_kernarg_pool_ = true;
|
||||
} else {
|
||||
kernarg_pool_graph_ = reinterpret_cast<address>(
|
||||
device->hostAlloc(kernArgSizeForGraph, 0, amd::Device::MemorySegment::kKernArg));
|
||||
}
|
||||
|
||||
if (kernarg_pool_graph_ == nullptr) {
|
||||
return hipErrorMemoryAllocation;
|
||||
if (kernarg_pool_graph_ == nullptr) {
|
||||
return hipErrorMemoryAllocation;
|
||||
}
|
||||
kernarg_pool_size_graph_ = kernArgSizeForGraph;
|
||||
}
|
||||
kernarg_pool_size_graph_ = kernArgSizeForGraph;
|
||||
|
||||
for (auto& node : topoOrder_) {
|
||||
if (node->GetType() == hipGraphNodeTypeKernel) {
|
||||
auto kernelNode = reinterpret_cast<hip::GraphKernelNode*>(node);
|
||||
// From the kernel pool allocate the kern arg size required for the current kernel node.
|
||||
address kernArgOffset = allocKernArg(kernelNode->GetKernargSegmentByteSize(),
|
||||
kernelNode->GetKernargSegmentAlignment());
|
||||
if (kernArgOffset == nullptr) {
|
||||
return hipErrorMemoryAllocation;
|
||||
address kernArgOffset = nullptr;
|
||||
if (kernelNode->GetKernargSegmentByteSize()) {
|
||||
kernArgOffset = allocKernArg(kernelNode->GetKernargSegmentByteSize(),
|
||||
kernelNode->GetKernargSegmentAlignment());
|
||||
if (kernArgOffset == nullptr) {
|
||||
return hipErrorMemoryAllocation;
|
||||
}
|
||||
}
|
||||
// Form GPU packet capture for the kernel node.
|
||||
kernelNode->CaptureAndFormPacket(capture_stream_, kernArgOffset) ;
|
||||
kernelNode->CaptureAndFormPacket(capture_stream_, kernArgOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +422,6 @@ hipError_t GraphExec::CaptureAQLPackets() {
|
||||
host_val++;
|
||||
}
|
||||
}
|
||||
|
||||
ResetQueueIndex();
|
||||
}
|
||||
return status;
|
||||
|
||||
@@ -597,9 +597,11 @@ struct GraphExec {
|
||||
// Release the kernel arg memory.
|
||||
auto device = g_devices[ihipGetDevice()]->devices()[0];
|
||||
if (DEBUG_CLR_GRAPH_PACKET_CAPTURE) {
|
||||
device->hostFree(kernarg_pool_graph_, kernarg_pool_size_graph_);
|
||||
for (auto& element : kernarg_graph_) {
|
||||
device->hostFree(element, kernarg_graph_size_);
|
||||
if (kernarg_pool_size_graph_ != 0) {
|
||||
device->hostFree(kernarg_pool_graph_, kernarg_pool_size_graph_);
|
||||
for (auto& element : kernarg_graph_) {
|
||||
device->hostFree(element, kernarg_graph_size_);
|
||||
}
|
||||
}
|
||||
}
|
||||
amd::ScopedLock lock(graphExecSetLock_);
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user