Initialize queue buffer with Invalid Pkt Headers

Change-Id: I4166f1359746ee6829b730bac2db358af72ab16e


[ROCm/ROCR-Runtime commit: 28c3f9a269]
This commit is contained in:
Ramesh Errabolu
2018-08-28 18:01:58 -05:00
orang tua 508124a012
melakukan efc2ac9024
2 mengubah file dengan 7 tambahan dan 1 penghapusan
@@ -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;