[SWDEV-479204] Fix the hipGraph AQL package fill issue

This patch fixes this potential issue that filling AQL header before
filling the AQL body. The hsa spec specifies "Packet processors may
process AQL packets after the packet format field is updated, but
before the doorbell is signaled."
However, the hipGraph AQL package with valid header will be filled
before fill the body, which may have the potential issue that CP
receive invalid AQL body.

Change-Id: I84af798c19ee2b8805ba19732b0eabdea2958a96
This commit is contained in:
Shane Xiao
2024-08-14 16:14:33 +08:00
committed by yao xiao
parent 432bdd7bf2
commit 3959b5be1e
+10 -1
View File
@@ -999,7 +999,16 @@ inline bool VirtualGPU::dispatchAqlPacket(
auto packet = reinterpret_cast<hsa_kernel_dispatch_packet_t*>(aqlpacket);
ClPrint(amd::LOG_INFO, amd::LOG_KERN, "Graph shader name : %s",
kernelName.c_str());
dispatchGenericAqlPacket(packet, packet->header, packet->setup, false);
// The Aqlpacket with valid header will trigger the issue that AQL fill
// the header before filling the body. However, the CP can handle the AQL package
// after seeing the valid AQL header with the AQL package's body is NULL.
// This patch fixes this potential issue that filling AQL header before
// filling the AQL body.
uint16_t packetHeader = packet->header;
packet->header = (HSA_PACKET_TYPE_INVALID << HSA_PACKET_HEADER_TYPE);
dispatchGenericAqlPacket(packet, packetHeader, packet->setup, false);
packet->header = packetHeader;
profilingEnd(*vcmd);