diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aql_queue.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aql_queue.h index 0a6d6f7146..1f0bfa1215 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aql_queue.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aql_queue.h @@ -65,7 +65,7 @@ class AqlQueue : public core::Queue, private core::LocalSignal, public core::Doo // Acquires/releases queue resources and requests HW schedule/deschedule. AqlQueue(core::SharedQueue* shared_queue, GpuAgent* agent, size_t req_size_pkts, HSAuint32 node_id, ScratchInfo& scratch, core::HsaEventCallback callback, void* err_data, - uint64_t flags, bool is_kv = false); + uint64_t flags); ~AqlQueue(); @@ -303,9 +303,6 @@ class AqlQueue : public core::Queue, private core::LocalSignal, public core::Doo void* errors_data_; - // Is KV device queue - bool is_kv_queue_; - // GPU-visible indirect buffer holding PM4 commands. void* pm4_ib_buf_; uint32_t pm4_ib_size_b_; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_agent.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_agent.h index 5edd750b15..8cd55e95c6 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_agent.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_gpu_agent.h @@ -173,11 +173,6 @@ class GpuAgentInt : public core::Agent { virtual void SetRecSdmaEngOverride(bool flag) = 0; - // @brief Query if agent represent Kaveri GPU. - // - // @retval true if agent is Kaveri GPU. - virtual bool is_kv_device() const = 0; - // @brief Query the agent HSA profile. // // @retval HSA profile. @@ -402,9 +397,6 @@ class GpuAgent : public GpuAgentInt { const std::vector& supported_isas() const override { return supported_isas_;} - // @brief Override from AMD::GpuAgentInt. - __forceinline bool is_kv_device() const override { return is_kv_device_; } - // @brief Override from AMD::GpuAgentInt. __forceinline hsa_profile_t profile() const override { return profile_; } @@ -649,8 +641,6 @@ class GpuAgent : public GpuAgentInt { // @brief HSA profile. hsa_profile_t profile_; - bool is_kv_device_; - void* trap_code_buf_; size_t trap_code_buf_size_; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index 2fbc1a3af0..53f7acfbc6 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -77,7 +77,7 @@ namespace AMD { AqlQueue::AqlQueue(core::SharedQueue* shared_queue, GpuAgent* agent, size_t req_size_pkts, HSAuint32 node_id, ScratchInfo& scratch, core::HsaEventCallback callback, - void* err_data, uint64_t flags, bool is_kv) + void* err_data, uint64_t flags) : Queue(shared_queue, flags, !agent->is_xgmi_cpu_gpu()), LocalSignal(0, false), DoorbellSignal(signal()), @@ -89,7 +89,6 @@ AqlQueue::AqlQueue(core::SharedQueue* shared_queue, GpuAgent* agent, size_t req_ queue_scratch_(scratch), errors_callback_(callback), errors_data_(err_data), - is_kv_queue_(is_kv), pm4_ib_buf_(nullptr), pm4_ib_size_b_(0x1000), dynamicScratchState(0), diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 88d06b391b..800478e400 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -99,7 +99,6 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna current_coherency_type_(HSA_AMD_COHERENCY_TYPE_COHERENT), scratch_used_large_(0), queues_(), - is_kv_device_(false), trap_code_buf_(NULL), trap_code_buf_size_(0), doorbell_queue_map_(NULL), @@ -190,12 +189,6 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna supported_isas_.push_back(core::IsaRegistry::GetIsa(isa_->GetIsaGeneric())); } - // Check if the device is Kaveri, only on GPU device. - if (isa_->GetMajorVersion() == 7 && isa_->GetMinorVersion() == 0 && - isa_->GetStepping() == 0) { - is_kv_device_ = true; - } - current_coherency_type((profile_ == HSA_PROFILE_FULL) ? HSA_AMD_COHERENCY_TYPE_COHERENT : HSA_AMD_COHERENCY_TYPE_NONCOHERENT); @@ -1779,7 +1772,7 @@ hsa_status_t GpuAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type, u if (!shared_queue) return HSA_STATUS_ERROR_OUT_OF_RESOURCES; auto aql_queue = new AqlQueue(shared_queue, this, size, node_id(), scratch, event_callback, data, - flags, is_kv_device_); + flags); *queue = aql_queue; aql_queues_.push_back(aql_queue); @@ -2178,38 +2171,8 @@ uint64_t GpuAgent::TranslateTime(uint64_t tick) { return system_tick; } +/* This function is deprecated */ bool GpuAgent::current_coherency_type(hsa_amd_coherency_type_t type) { - if (!is_kv_device_) { - current_coherency_type_ = type; - return true; - } - - ScopedAcquire Lock(&coherency_lock_); - - if (ape1_base_ == 0 && ape1_size_ == 0) { - static const size_t kApe1Alignment = 64 * 1024; - ape1_size_ = kApe1Alignment; - ape1_base_ = reinterpret_cast( - _aligned_malloc(ape1_size_, kApe1Alignment)); - assert((ape1_base_ != 0) && ("APE1 allocation failed")); - } else if (type == current_coherency_type_) { - return true; - } - - HSA_CACHING_TYPE type0, type1; - if (type == HSA_AMD_COHERENCY_TYPE_COHERENT) { - type0 = HSA_CACHING_CACHED; - type1 = HSA_CACHING_NONCACHED; - } else { - type0 = HSA_CACHING_NONCACHED; - type1 = HSA_CACHING_CACHED; - } - - if (HSAKMT_CALL(hsaKmtSetMemoryPolicy(node_id(), type0, type1, - reinterpret_cast(ape1_base_), - ape1_size_)) != HSAKMT_STATUS_SUCCESS) { - return false; - } current_coherency_type_ = type; return true; } diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp index d4c950dff9..814a467e74 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp @@ -156,7 +156,7 @@ bool MallocedMemory::Freeze() class MappedMemory final: public SegmentMemory { public: - MappedMemory(bool is_kv = false): SegmentMemory(), is_kv_(is_kv), ptr_(nullptr), size_(0) {} + MappedMemory(): SegmentMemory(), ptr_(nullptr), size_(0) {} ~MappedMemory() {} void* Address(size_t offset = 0) const override @@ -175,7 +175,6 @@ private: MappedMemory(const MappedMemory&); MappedMemory& operator=(const MappedMemory&); - bool is_kv_; void *ptr_; size_t size_; }; @@ -188,8 +187,7 @@ bool MappedMemory::Allocate(size_t size, size_t align, bool zero) #if defined(_WIN32) || defined(_WIN64) ptr_ = (void*)VirtualAlloc(nullptr, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); #else - ptr_ = is_kv_ ? - mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0) : + ptr_ = mmap(nullptr, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_NORESERVE | MAP_PRIVATE, -1, 0); #endif // _WIN32 || _WIN64 if (nullptr == ptr_) { @@ -468,7 +466,7 @@ void* LoaderContext::SegmentAlloc(amdgpu_hsa_elf_segment_t segment, mem = new (std::nothrow) RegionMemory(RegionMemory::AgentLocal(agent, true), true); break; case HSA_PROFILE_FULL: - mem = new (std::nothrow) MappedMemory(((AMD::GpuAgentInt*)core::Agent::Convert(agent))->is_kv_device()); + mem = new (std::nothrow) MappedMemory(); break; default: assert(false);