csullivan commented on code in PR #12411:
URL: https://github.com/apache/tvm/pull/12411#discussion_r952001668
##########
src/runtime/hexagon/hexagon_user_dma.cc:
##########
@@ -82,12 +95,13 @@ int HexagonUserDMA::Copy(void* dst, void* src, uint32_t
length) {
dmstart(dma_desc);
first_dma_ = false;
} else {
- // `dmlink` descriptor to tail
- dmlink(dma_descriptors_.back(), dma_desc);
+ // `dmlink` descriptor to tail descriptor
+ void* tail = GetDescriptorAddr(id_next_dma_desc_ - 1);
+ dmlink(tail, dma_desc);
}
- // set descriptor as new tail
- dma_descriptors_.push_back(dma_desc);
+ // update the ID of the next DMA descriptor
+ id_next_dma_desc_++;
Review Comment:
Interaction with the ring buffer here feels a bit like it should be
encapsulated into methods like "AllocDescriptor" "FreeDescriptor" or something
like that which manages the internal member `id_next_dma_desc_` and others.
##########
src/runtime/hexagon/hexagon_user_dma.cc:
##########
@@ -82,12 +95,13 @@ int HexagonUserDMA::Copy(void* dst, void* src, uint32_t
length) {
dmstart(dma_desc);
first_dma_ = false;
} else {
- // `dmlink` descriptor to tail
- dmlink(dma_descriptors_.back(), dma_desc);
+ // `dmlink` descriptor to tail descriptor
+ void* tail = GetDescriptorAddr(id_next_dma_desc_ - 1);
+ dmlink(tail, dma_desc);
}
- // set descriptor as new tail
- dma_descriptors_.push_back(dma_desc);
+ // update the ID of the next DMA descriptor
+ id_next_dma_desc_++;
Review Comment:
Interaction with the ring buffer here feels a bit like it should be
encapsulated into a class with methods like "AllocDescriptor" "FreeDescriptor"
or something like that which manages the internal member `id_next_dma_desc_`
and others.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]