Initialize queue buffer with Invalid Pkt Headers

Change-Id: I4166f1359746ee6829b730bac2db358af72ab16e
This commit is contained in:
Ramesh Errabolu
2018-08-28 18:01:58 -05:00
vanhempi 8ea836017a
commit 28c3f9a269
2 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
@@ -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.
@@ -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;