SWDEV-467069 - Added safety check in activity prof for accumulate command

Adding a safety check prevents an invalid memory access
if timestamps and kernelNames vectors are of different size.

The patch also moves the addKernelNames for the accumulate command
into dispatchAqlPacket function.

Change-Id: Iea0927e1253800403a1ae3f3d72de1e7d96476c3


[ROCm/clr commit: d44f44a5b1]
This commit is contained in:
Ioannis Assiouras
2024-06-11 19:22:19 +01:00
parent af089a2171
commit dfe46a3093
6 changed files with 29 additions and 18 deletions
+15 -8
View File
@@ -983,19 +983,26 @@ bool VirtualGPU::dispatchAqlPacket(
}
// ================================================================================================
inline bool VirtualGPU::dispatchAqlPacket(uint8_t* aqlpacket, amd::AccumulateCommand* vcmd) {
amd::ScopedLock lock(execution());
if (vcmd != nullptr) {
profilingBegin(*vcmd, true);
inline bool VirtualGPU::dispatchAqlPacket(
uint8_t* aqlpacket, const std::string& kernelName, amd::AccumulateCommand* vcmd) {
if (vcmd == nullptr) {
return false;
}
vcmd->addKernelName(kernelName);
amd::ScopedLock lock(execution());
profilingBegin(*vcmd, true);
dispatchBlockingWait();
auto packet = reinterpret_cast<hsa_kernel_dispatch_packet_t*>(aqlpacket);
ClPrint(amd::LOG_INFO, amd::LOG_KERN, "Graph shader name : %s",
vcmd->getKernelNames().back().c_str());
kernelName.c_str());
dispatchGenericAqlPacket(packet, packet->header, packet->setup, false);
if (vcmd != nullptr) {
profilingEnd(*vcmd);
}
profilingEnd(*vcmd);
return true;
}