librocdxg: Increase AQL frame size calculation

to prevent PM4 command buffer overflow

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Longlong Yao <Longlong.Yao@amd.com>
Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/113>
Este cometimento está contido em:
Flora Cui cometeu 2025-11-28 14:53:07 +08:00
1 ascendente 3c17717624
cometimento 0761dd0146
2 ficheiros modificados
+25 -1

Não existem ficheiros que correspondam à sua pesquisa

+18
Ver ficheiro
@@ -723,6 +723,12 @@ ComputeQueue::KernelDispatchAqlToPm4(char *cpu, hsa_kernel_dispatch_packet_t *pa
else
i += cmd_util.BuildWriteData64Command(cpu + i, (uint64_t *)ring_rptr, cmdbuf_aql_frame_write_index + 1);
// Check if we exceeded the frame size
if ((i - ib_size) > cmdbuf_aql_frame_size) {
pr_err("PM4 command buffer overflow in KernelDispatch: used %d bytes, limit %d bytes\n", i - ib_size, cmdbuf_aql_frame_size);
return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
}
ib_size = i;
cmdbuf_aql_frame_write_index++;
packet->header = HSA_PACKET_TYPE_INVALID;
@@ -811,6 +817,12 @@ ComputeQueue::BarrierGenericAqlToPm4(char *cpu, hsa_barrier_and_packet_t *packet
else
i += cmd_util.BuildWriteData64Command(cpu + i, (uint64_t *)ring_rptr, cmdbuf_aql_frame_write_index + 1);
// Check if we exceeded the frame size
if ((i - ib_size) > cmdbuf_aql_frame_size) {
pr_err("PM4 command buffer overflow in BarrierGeneric: used %d bytes, limit %d bytes\n", i - ib_size, cmdbuf_aql_frame_size);
return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
}
ib_size = i;
cmdbuf_aql_frame_write_index++;
packet->header = HSA_PACKET_TYPE_INVALID;
@@ -881,6 +893,12 @@ hsa_status_t ComputeQueue::VendorSpecificAqlToPm4(char *cpu, amd_aql_pm4_ib *pac
else
i += cmd_util.BuildWriteData64Command(cpu + i, (uint64_t *)ring_rptr, cmdbuf_aql_frame_write_index + 1);
// Check if we exceeded the frame size
if ((i - ib_size) > cmdbuf_aql_frame_size) {
pr_err("PM4 command buffer overflow in VendorSpecific: used %d bytes, limit %d bytes\n", i - ib_size, cmdbuf_aql_frame_size);
return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
}
ib_size = i;
cmdbuf_aql_frame_write_index++;
packet->header = HSA_PACKET_TYPE_INVALID;