diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index 8ca9faee4a..7c9ac234ae 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -133,7 +133,7 @@ AqlQueue::AqlQueue(GpuAgent* agent, size_t req_size_pkts, HSAuint32 node_id, Scr // Fill the ring buffer with invalid packet headers. // Leave packet content uninitialized to help track errors. for (uint32_t pkt_id = 0; pkt_id < queue_size_pkts; ++pkt_id) { - ((uint32_t*)ring_buf_)[16 * pkt_id] = HSA_PACKET_TYPE_INVALID; + (((core::AqlPacket*)ring_buf_)[pkt_id]).dispatch.header = HSA_PACKET_TYPE_INVALID; } // Zero the amd_queue_ structure to clear RPTR/WPTR before queue attach. diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/host_queue.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/host_queue.cpp index ec9df377f9..1eff1fbbc4 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/host_queue.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/host_queue.cpp @@ -67,6 +67,12 @@ HostQueue::HostQueue(hsa_region_t region, uint32_t ring_size, hsa_queue_type32_t assert(IsMultipleOf(ring_, kRingAlignment)); assert(ring_ != NULL); + // Fill the ring buffer with invalid packet headers. + // Leave packet content uninitialized to help track errors. + for (uint32_t pkt_id = 0; pkt_id < size_; pkt_id++) { + (((AqlPacket*)ring_)[pkt_id]).dispatch.header = HSA_PACKET_TYPE_INVALID; + } + amd_queue_.hsa_queue.base_address = ring_; amd_queue_.hsa_queue.size = size_; amd_queue_.hsa_queue.doorbell_signal = doorbell_signal;