mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Move initialization of AubCenter to RootDeviceEnvironment
make RootDeviceEnvironments vector of unique_ptr Related-To: NEO-3857 Change-Id: I23998502198307c8535cdd5c9c4af5223a5d69a5 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
8cc6a65e69
commit
3e1b15c31d
@ -8,10 +8,16 @@
|
||||
#include "core/execution_environment/root_device_environment.h"
|
||||
|
||||
#include "runtime/aub/aub_center.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
RootDeviceEnvironment::RootDeviceEnvironment() = default;
|
||||
RootDeviceEnvironment::RootDeviceEnvironment(RootDeviceEnvironment &&) = default;
|
||||
RootDeviceEnvironment::RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment) {}
|
||||
RootDeviceEnvironment::~RootDeviceEnvironment() = default;
|
||||
|
||||
void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
||||
if (!aubCenter) {
|
||||
aubCenter.reset(new AubCenter(executionEnvironment.getHardwareInfo(), localMemoryEnabled, aubFileName, csrType));
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -6,17 +6,25 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/helpers/options.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class AubCenter;
|
||||
class ExecutionEnvironment;
|
||||
|
||||
struct RootDeviceEnvironment {
|
||||
RootDeviceEnvironment();
|
||||
RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment);
|
||||
RootDeviceEnvironment(RootDeviceEnvironment &) = delete;
|
||||
RootDeviceEnvironment(RootDeviceEnvironment &&);
|
||||
~RootDeviceEnvironment();
|
||||
MOCKABLE_VIRTUAL ~RootDeviceEnvironment();
|
||||
|
||||
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
||||
|
||||
std::unique_ptr<AubCenter> aubCenter;
|
||||
ExecutionEnvironment &executionEnvironment;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -84,7 +84,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
|
||||
GraphicsAllocation(uint32_t rootDeviceIndex, AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn, MemoryPool::Type pool);
|
||||
|
||||
uint32_t getRootDeviceIndex() { return rootDeviceIndex; }
|
||||
uint32_t getRootDeviceIndex() const { return rootDeviceIndex; }
|
||||
void *getUnderlyingBuffer() const { return cpuPtr; }
|
||||
void *getDriverAllocatedCpuPtr() const { return driverAllocatedCpuPointer; }
|
||||
void setDriverAllocatedCpuPtr(void *allocatedCpuPtr) { driverAllocatedCpuPointer = allocatedCpuPtr; }
|
||||
|
@ -240,14 +240,14 @@ FragmentStorage *HostPtrManager::getFragmentAndCheckForOverlaps(const void *inPt
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OsHandleStorage HostPtrManager::prepareOsStorageForAllocation(MemoryManager &memoryManager, size_t size, const void *ptr) {
|
||||
OsHandleStorage HostPtrManager::prepareOsStorageForAllocation(MemoryManager &memoryManager, size_t size, const void *ptr, uint32_t rootDeviceIndex) {
|
||||
std::lock_guard<decltype(allocationsMutex)> lock(allocationsMutex);
|
||||
auto requirements = HostPtrManager::getAllocationRequirements(ptr, size);
|
||||
UNRECOVERABLE_IF(checkAllocationsForOverlapping(memoryManager, &requirements) == RequirementsStatus::FATAL);
|
||||
auto osStorage = populateAlreadyAllocatedFragments(requirements);
|
||||
if (osStorage.fragmentCount > 0) {
|
||||
if (memoryManager.populateOsHandles(osStorage) != MemoryManager::AllocationStatus::Success) {
|
||||
memoryManager.cleanOsHandles(osStorage);
|
||||
memoryManager.cleanOsHandles(osStorage, rootDeviceIndex);
|
||||
osStorage.fragmentCount = 0;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class MemoryManager;
|
||||
class HostPtrManager {
|
||||
public:
|
||||
FragmentStorage *getFragment(const void *inputPtr);
|
||||
OsHandleStorage prepareOsStorageForAllocation(MemoryManager &memoryManager, size_t size, const void *ptr);
|
||||
OsHandleStorage prepareOsStorageForAllocation(MemoryManager &memoryManager, size_t size, const void *ptr, uint32_t rootDeviceIndex);
|
||||
void releaseHandleStorage(OsHandleStorage &fragments);
|
||||
bool releaseHostPtr(const void *ptr);
|
||||
void storeFragment(AllocationStorageData &storageData);
|
||||
|
Reference in New Issue
Block a user