[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
这个提交包含在:
Shane Xiao 编写, yao xiao 于 2024-08-21 21:49:11 -04:00 提交
1 父节点 432bdd7bf2
当前提交 3959b5be1e
1 个文件已更改
+10 -1
+10 -1
查看文件
@@ -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);