Make queue memory allocation non-paged

Non-paged allocation for queue memory necessary for binding wptr to
GART. Required to support usermode queue oversubscription with MES for
GFX11.

Adds AllocateNonPaged entry to MemoryRegion::AllocateEnum for clarity;
aliases AllocateIPC.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Change-Id: I1a97a1820da26cf2433d9c237b2e6d2b0b8628b4


[ROCm/ROCR-Runtime commit: 061aa04147]
This commit is contained in:
Graham Sider
2022-06-08 13:12:53 -04:00
committed by David Yat Sin
parent c4ae784f4b
commit ff52cbb201
4 changed files with 6 additions and 3 deletions
@@ -141,10 +141,10 @@ class Shared final : private BaseShared {
template <typename T> class Shared<T, PageAllocator<T>> final : private BaseShared { template <typename T> class Shared<T, PageAllocator<T>> final : private BaseShared {
public: public:
Shared() { Shared(int flags = 0) {
assert(allocate_ != nullptr && free_ != nullptr && "Shared object allocator is not set"); assert(allocate_ != nullptr && free_ != nullptr && "Shared object allocator is not set");
shared_object_ = PageAllocator<T>::alloc(); shared_object_ = PageAllocator<T>::alloc(flags);
} }
~Shared() { ~Shared() {
@@ -89,6 +89,7 @@ class MemoryRegion : public Checked<0x9C961F19EE175BB3> {
AllocateDoubleMap = (1 << 2), // Map twice VA allocation to backing store AllocateDoubleMap = (1 << 2), // Map twice VA allocation to backing store
AllocateDirect = (1 << 3), // Bypass fragment cache. AllocateDirect = (1 << 3), // Bypass fragment cache.
AllocateIPC = (1 << 4), // System memory that can be IPC-shared AllocateIPC = (1 << 4), // System memory that can be IPC-shared
AllocateNonPaged = (1 << 4), // Non-paged system memory (AllocateIPC alias)
AllocatePCIeRW = (1 << 5), // Enforce pseudo fine grain/RW memory AllocatePCIeRW = (1 << 5), // Enforce pseudo fine grain/RW memory
}; };
@@ -49,6 +49,7 @@
#include "core/common/shared.h" #include "core/common/shared.h"
#include "core/inc/checked.h" #include "core/inc/checked.h"
#include "core/inc/memory_region.h"
#include "core/util/utils.h" #include "core/util/utils.h"
#include "inc/amd_hsa_queue.h" #include "inc/amd_hsa_queue.h"
@@ -126,6 +127,7 @@ struct SharedQueue {
class LocalQueue { class LocalQueue {
public: public:
LocalQueue() : local_queue_(MemoryRegion::AllocateNonPaged) {}
SharedQueue* queue() const { return local_queue_.shared_object(); } SharedQueue* queue() const { return local_queue_.shared_object(); }
private: private:
@@ -185,7 +185,7 @@ hsa_status_t MemoryRegion::AllocateImpl(size_t& size, AllocateFlags alloc_flags,
(alloc_flags & AllocateExecutable ? 1 : 0); (alloc_flags & AllocateExecutable ? 1 : 0);
kmt_alloc_flags.ui32.AQLQueueMemory = kmt_alloc_flags.ui32.AQLQueueMemory =
(alloc_flags & AllocateDoubleMap ? 1 : 0); (alloc_flags & AllocateDoubleMap ? 1 : 0);
if (IsSystem() && (alloc_flags & AllocateIPC)) if (IsSystem() && (alloc_flags & AllocateNonPaged))
kmt_alloc_flags.ui32.NonPaged = 1; kmt_alloc_flags.ui32.NonPaged = 1;
// Allocate pseudo fine grain memory // Allocate pseudo fine grain memory