Don't use double mappings on GFX9 APUs.
Change-Id: I1225696211d4eac9ce982243ea0a1a9e8b2a318f
This commit is contained in:
@@ -471,7 +471,7 @@ uint32_t AqlQueue::ComputeRingBufferMaxPkts() {
|
||||
}
|
||||
|
||||
void AqlQueue::AllocRegisteredRingBuffer(uint32_t queue_size_pkts) {
|
||||
if (agent_->profile() == HSA_PROFILE_FULL) {
|
||||
if ((agent_->profile() == HSA_PROFILE_FULL) && queue_full_workaround_) {
|
||||
// Compute the physical and virtual size of the queue.
|
||||
uint32_t ring_buf_phys_size_bytes =
|
||||
uint32_t(queue_size_pkts * sizeof(core::AqlPacket));
|
||||
@@ -602,23 +602,22 @@ void AqlQueue::AllocRegisteredRingBuffer(uint32_t queue_size_pkts) {
|
||||
} else {
|
||||
// Allocate storage for the ring buffer.
|
||||
ring_buf_alloc_bytes_ = AlignUp(
|
||||
queue_size_pkts * static_cast<uint32_t>(sizeof(core::AqlPacket)), 4096);
|
||||
queue_size_pkts * sizeof(core::AqlPacket), 4096);
|
||||
|
||||
ring_buf_ = core::Runtime::runtime_singleton_->system_allocator()(
|
||||
ring_buf_alloc_bytes_, 0x1000,
|
||||
core::MemoryRegion::AllocateExecutable |
|
||||
core::MemoryRegion::AllocateDoubleMap);
|
||||
ring_buf_alloc_bytes_, 0x1000, core::MemoryRegion::AllocateExecutable |
|
||||
(queue_full_workaround_ ? core::MemoryRegion::AllocateDoubleMap : 0));
|
||||
|
||||
assert(ring_buf_ != NULL && "AQL queue memory allocation failure");
|
||||
|
||||
// The virtual ring allocation is twice as large as requested.
|
||||
// Each half maps to the same set of physical pages.
|
||||
ring_buf_alloc_bytes_ *= 2;
|
||||
if (queue_full_workaround_) ring_buf_alloc_bytes_ *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
void AqlQueue::FreeRegisteredRingBuffer() {
|
||||
if (agent_->profile() == HSA_PROFILE_FULL) {
|
||||
if ((agent_->profile() == HSA_PROFILE_FULL) && queue_full_workaround_) {
|
||||
#ifdef __linux__
|
||||
munmap(ring_buf_, ring_buf_alloc_bytes_);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user