mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 20:39:56 +08:00
Move stamps allocators from memory manager to CSR.
Change-Id: Ib399e462cdddad89fcc470df4c4f0f5e4591a6b2
This commit is contained in:
@@ -82,7 +82,7 @@ CommandQueue::CommandQueue(Context *context,
|
|||||||
if (device) {
|
if (device) {
|
||||||
engine = &device->getEngine(engineId);
|
engine = &device->getEngine(engineId);
|
||||||
if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
||||||
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(device->getMemoryManager());
|
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -580,9 +580,7 @@ void CommandQueue::dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes) {
|
void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes) {
|
||||||
auto preferredPoolSize = getCommandStreamReceiver().getPreferredTagPoolSize();
|
auto allocator = getCommandStreamReceiver().getTimestampPacketAllocator();
|
||||||
|
|
||||||
auto allocator = device->getMemoryManager()->obtainTimestampPacketAllocator(preferredPoolSize);
|
|
||||||
|
|
||||||
previousNodes.swapNodes(*timestampPacketContainer);
|
previousNodes.swapNodes(*timestampPacketContainer);
|
||||||
previousNodes.resolveDependencies(isOOQEnabled());
|
previousNodes.resolveDependencies(isOOQEnabled());
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
|
|||||||
blocking = true;
|
blocking = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimestampPacketContainer previousTimestampPacketNodes(device->getMemoryManager());
|
TimestampPacketContainer previousTimestampPacketNodes;
|
||||||
EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event);
|
EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event);
|
||||||
|
|
||||||
if (multiDispatchInfo.empty() == false) {
|
if (multiDispatchInfo.empty() == false) {
|
||||||
|
|||||||
@@ -16,10 +16,12 @@
|
|||||||
#include "runtime/helpers/cache_policy.h"
|
#include "runtime/helpers/cache_policy.h"
|
||||||
#include "runtime/helpers/flush_stamp.h"
|
#include "runtime/helpers/flush_stamp.h"
|
||||||
#include "runtime/helpers/string.h"
|
#include "runtime/helpers/string.h"
|
||||||
|
#include "runtime/helpers/timestamp_packet.h"
|
||||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
#include "runtime/memory_manager/surface.h"
|
#include "runtime/memory_manager/surface.h"
|
||||||
#include "runtime/os_interface/os_interface.h"
|
#include "runtime/os_interface/os_interface.h"
|
||||||
|
#include "runtime/utilities/tag_allocator.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
// Global table of CommandStreamReceiver factories for HW and tests
|
// Global table of CommandStreamReceiver factories for HW and tests
|
||||||
@@ -366,4 +368,25 @@ bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surfa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TagAllocator<HwTimeStamps> *CommandStreamReceiver::getEventTsAllocator() {
|
||||||
|
if (profilingTimeStampAllocator.get() == nullptr) {
|
||||||
|
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||||
|
}
|
||||||
|
return profilingTimeStampAllocator.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
TagAllocator<HwPerfCounter> *CommandStreamReceiver::getEventPerfCountAllocator() {
|
||||||
|
if (perfCounterAllocator.get() == nullptr) {
|
||||||
|
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||||
|
}
|
||||||
|
return perfCounterAllocator.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
TagAllocator<TimestampPacket> *CommandStreamReceiver::getTimestampPacketAllocator() {
|
||||||
|
if (timestampPacketAllocator.get() == nullptr) {
|
||||||
|
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacket>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
|
||||||
|
}
|
||||||
|
return timestampPacketAllocator.get();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ class LinearStream;
|
|||||||
class MemoryManager;
|
class MemoryManager;
|
||||||
class OsContext;
|
class OsContext;
|
||||||
class OSInterface;
|
class OSInterface;
|
||||||
|
class TimestampPacket;
|
||||||
|
struct HwPerfCounter;
|
||||||
|
struct HwTimeStamps;
|
||||||
|
|
||||||
|
template <typename T1>
|
||||||
|
class TagAllocator;
|
||||||
|
|
||||||
enum class DispatchMode {
|
enum class DispatchMode {
|
||||||
DeviceDefault = 0, //default for given device
|
DeviceDefault = 0, //default for given device
|
||||||
@@ -85,7 +91,7 @@ class CommandStreamReceiver {
|
|||||||
MOCKABLE_VIRTUAL void waitForTaskCountAndCleanAllocationList(uint32_t requiredTaskCount, uint32_t allocationUsage);
|
MOCKABLE_VIRTUAL void waitForTaskCountAndCleanAllocationList(uint32_t requiredTaskCount, uint32_t allocationUsage);
|
||||||
|
|
||||||
LinearStream &getCS(size_t minRequiredSize = 1024u);
|
LinearStream &getCS(size_t minRequiredSize = 1024u);
|
||||||
OSInterface *getOSInterface() { return osInterface; };
|
OSInterface *getOSInterface() const { return osInterface; };
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL void setTagAllocation(GraphicsAllocation *allocation);
|
MOCKABLE_VIRTUAL void setTagAllocation(GraphicsAllocation *allocation);
|
||||||
GraphicsAllocation *getTagAllocation() const {
|
GraphicsAllocation *getTagAllocation() const {
|
||||||
@@ -110,8 +116,8 @@ class CommandStreamReceiver {
|
|||||||
virtual void overrideMediaVFEStateDirty(bool dirty) { mediaVfeStateDirty = dirty; }
|
virtual void overrideMediaVFEStateDirty(bool dirty) { mediaVfeStateDirty = dirty; }
|
||||||
|
|
||||||
void setRequiredScratchSize(uint32_t newRequiredScratchSize);
|
void setRequiredScratchSize(uint32_t newRequiredScratchSize);
|
||||||
GraphicsAllocation *getScratchAllocation() { return scratchAllocation; }
|
GraphicsAllocation *getScratchAllocation() const { return scratchAllocation; }
|
||||||
GraphicsAllocation *getDebugSurfaceAllocation() { return debugSurface; }
|
GraphicsAllocation *getDebugSurfaceAllocation() const { return debugSurface; }
|
||||||
GraphicsAllocation *allocateDebugSurface(size_t size);
|
GraphicsAllocation *allocateDebugSurface(size_t size);
|
||||||
|
|
||||||
void setPreemptionCsrAllocation(GraphicsAllocation *allocation) { preemptionCsrAllocation = allocation; }
|
void setPreemptionCsrAllocation(GraphicsAllocation *allocation) { preemptionCsrAllocation = allocation; }
|
||||||
@@ -124,7 +130,7 @@ class CommandStreamReceiver {
|
|||||||
|
|
||||||
void setSamplerCacheFlushRequired(SamplerCacheFlushState value) { this->samplerCacheFlushRequired = value; }
|
void setSamplerCacheFlushRequired(SamplerCacheFlushState value) { this->samplerCacheFlushRequired = value; }
|
||||||
|
|
||||||
FlatBatchBufferHelper &getFlatBatchBufferHelper() { return *flatBatchBufferHelper.get(); }
|
FlatBatchBufferHelper &getFlatBatchBufferHelper() const { return *flatBatchBufferHelper; }
|
||||||
void overwriteFlatBatchBufferHelper(FlatBatchBufferHelper *newHelper) { flatBatchBufferHelper.reset(newHelper); }
|
void overwriteFlatBatchBufferHelper(FlatBatchBufferHelper *newHelper) { flatBatchBufferHelper.reset(newHelper); }
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL void initProgrammingFlags();
|
MOCKABLE_VIRTUAL void initProgrammingFlags();
|
||||||
@@ -158,6 +164,10 @@ class CommandStreamReceiver {
|
|||||||
void setOsContext(OsContext *osContext) { this->osContext = osContext; }
|
void setOsContext(OsContext *osContext) { this->osContext = osContext; }
|
||||||
OsContext &getOsContext() const { return *osContext; }
|
OsContext &getOsContext() const { return *osContext; }
|
||||||
|
|
||||||
|
TagAllocator<HwTimeStamps> *getEventTsAllocator();
|
||||||
|
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
|
||||||
|
TagAllocator<TimestampPacket> *getTimestampPacketAllocator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void cleanupResources();
|
void cleanupResources();
|
||||||
void setDisableL3Cache(bool val) {
|
void setDisableL3Cache(bool val) {
|
||||||
@@ -170,6 +180,9 @@ class CommandStreamReceiver {
|
|||||||
std::unique_ptr<ExperimentalCommandBuffer> experimentalCmdBuffer;
|
std::unique_ptr<ExperimentalCommandBuffer> experimentalCmdBuffer;
|
||||||
std::unique_ptr<InternalAllocationStorage> internalAllocationStorage;
|
std::unique_ptr<InternalAllocationStorage> internalAllocationStorage;
|
||||||
std::unique_ptr<KmdNotifyHelper> kmdNotifyHelper;
|
std::unique_ptr<KmdNotifyHelper> kmdNotifyHelper;
|
||||||
|
std::unique_ptr<TagAllocator<HwTimeStamps>> profilingTimeStampAllocator;
|
||||||
|
std::unique_ptr<TagAllocator<HwPerfCounter>> perfCounterAllocator;
|
||||||
|
std::unique_ptr<TagAllocator<TimestampPacket>> timestampPacketAllocator;
|
||||||
|
|
||||||
ResidencyContainer residencyAllocations;
|
ResidencyContainer residencyAllocations;
|
||||||
ResidencyContainer evictionAllocations;
|
ResidencyContainer evictionAllocations;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
class CommandStreamReceiver;
|
|
||||||
class GraphicsAllocation;
|
class GraphicsAllocation;
|
||||||
class MemoryManager;
|
class MemoryManager;
|
||||||
class OSTime;
|
class OSTime;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ Event::Event(
|
|||||||
if ((this->ctx == nullptr) && (cmdQueue != nullptr)) {
|
if ((this->ctx == nullptr) && (cmdQueue != nullptr)) {
|
||||||
this->ctx = &cmdQueue->getContext();
|
this->ctx = &cmdQueue->getContext();
|
||||||
if (cmdQueue->getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
if (cmdQueue->getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
||||||
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(cmdQueue->getDevice().getMemoryManager());
|
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,12 +124,10 @@ Event::~Event() {
|
|||||||
|
|
||||||
if (cmdQueue != nullptr) {
|
if (cmdQueue != nullptr) {
|
||||||
if (timeStampNode != nullptr) {
|
if (timeStampNode != nullptr) {
|
||||||
TagAllocator<HwTimeStamps> *allocator = cmdQueue->getDevice().getMemoryManager()->peekEventTsAllocator();
|
timeStampNode->returnTag();
|
||||||
allocator->returnTag(timeStampNode);
|
|
||||||
}
|
}
|
||||||
if (perfCounterNode != nullptr) {
|
if (perfCounterNode != nullptr) {
|
||||||
TagAllocator<HwPerfCounter> *allocator = cmdQueue->getDevice().getMemoryManager()->peekEventPerfCountAllocator();
|
perfCounterNode->returnTag();
|
||||||
allocator->returnTag(perfCounterNode);
|
|
||||||
}
|
}
|
||||||
cmdQueue->decRefInternal();
|
cmdQueue->decRefInternal();
|
||||||
}
|
}
|
||||||
@@ -669,20 +667,14 @@ void Event::setEndTimeStamp() {
|
|||||||
|
|
||||||
TagNode<HwTimeStamps> *Event::getHwTimeStampNode() {
|
TagNode<HwTimeStamps> *Event::getHwTimeStampNode() {
|
||||||
if (!timeStampNode) {
|
if (!timeStampNode) {
|
||||||
auto &device = getCommandQueue()->getDevice();
|
timeStampNode = cmdQueue->getCommandStreamReceiver().getEventTsAllocator()->getTag();
|
||||||
auto preferredPoolSize = cmdQueue->getCommandStreamReceiver().getPreferredTagPoolSize();
|
|
||||||
|
|
||||||
timeStampNode = device.getMemoryManager()->obtainEventTsAllocator(preferredPoolSize)->getTag();
|
|
||||||
}
|
}
|
||||||
return timeStampNode;
|
return timeStampNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
TagNode<HwPerfCounter> *Event::getHwPerfCounterNode() {
|
TagNode<HwPerfCounter> *Event::getHwPerfCounterNode() {
|
||||||
if (!perfCounterNode) {
|
if (!perfCounterNode) {
|
||||||
auto &device = getCommandQueue()->getDevice();
|
perfCounterNode = cmdQueue->getCommandStreamReceiver().getEventPerfCountAllocator()->getTag();
|
||||||
auto preferredPoolSize = cmdQueue->getCommandStreamReceiver().getPreferredTagPoolSize();
|
|
||||||
|
|
||||||
perfCounterNode = device.getMemoryManager()->obtainEventPerfCountAllocator(preferredPoolSize)->getTag();
|
|
||||||
}
|
}
|
||||||
return perfCounterNode;
|
return perfCounterNode;
|
||||||
}
|
}
|
||||||
@@ -692,7 +684,7 @@ void Event::copyPerfCounters(InstrPmRegsCfg *config) {
|
|||||||
memcpy_s(perfConfigurationData, sizeof(InstrPmRegsCfg), config, sizeof(InstrPmRegsCfg));
|
memcpy_s(perfConfigurationData, sizeof(InstrPmRegsCfg), config, sizeof(InstrPmRegsCfg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::addTimestampPacketNodes(TimestampPacketContainer &inputTimestampPacketContainer) {
|
void Event::addTimestampPacketNodes(const TimestampPacketContainer &inputTimestampPacketContainer) {
|
||||||
timestampPacketContainer->assignAndIncrementNodesRefCounts(inputTimestampPacketContainer);
|
timestampPacketContainer->assignAndIncrementNodesRefCounts(inputTimestampPacketContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class Event : public BaseObject<_cl_event>, public IDNode<Event> {
|
|||||||
cl_ulong endTime);
|
cl_ulong endTime);
|
||||||
bool calcProfilingData();
|
bool calcProfilingData();
|
||||||
void setCPUProfilingPath(bool isCPUPath) { this->profilingCpuPath = isCPUPath; }
|
void setCPUProfilingPath(bool isCPUPath) { this->profilingCpuPath = isCPUPath; }
|
||||||
bool isCPUProfilingPath() {
|
bool isCPUProfilingPath() const {
|
||||||
return profilingCpuPath;
|
return profilingCpuPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,16 +104,16 @@ class Event : public BaseObject<_cl_event>, public IDNode<Event> {
|
|||||||
void *paramValue,
|
void *paramValue,
|
||||||
size_t *paramValueSizeRet);
|
size_t *paramValueSizeRet);
|
||||||
|
|
||||||
bool isProfilingEnabled() { return profilingEnabled; }
|
bool isProfilingEnabled() const { return profilingEnabled; }
|
||||||
|
|
||||||
void setProfilingEnabled(bool profilingEnabled) { this->profilingEnabled = profilingEnabled; }
|
void setProfilingEnabled(bool profilingEnabled) { this->profilingEnabled = profilingEnabled; }
|
||||||
|
|
||||||
TagNode<HwTimeStamps> *getHwTimeStampNode();
|
TagNode<HwTimeStamps> *getHwTimeStampNode();
|
||||||
|
|
||||||
void addTimestampPacketNodes(TimestampPacketContainer &inputTimestampPacketContainer);
|
void addTimestampPacketNodes(const TimestampPacketContainer &inputTimestampPacketContainer);
|
||||||
TimestampPacketContainer *getTimestampPacketNodes() const;
|
TimestampPacketContainer *getTimestampPacketNodes() const;
|
||||||
|
|
||||||
bool isPerfCountersEnabled() {
|
bool isPerfCountersEnabled() const {
|
||||||
return perfCountersEnabled;
|
return perfCountersEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,10 +229,10 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandComputeKernel::setTimestampPacketNode(TimestampPacketContainer ¤t, TimestampPacketContainer &previous) {
|
void CommandComputeKernel::setTimestampPacketNode(TimestampPacketContainer ¤t, TimestampPacketContainer &previous) {
|
||||||
currentTimestampPacketNodes = std::make_unique<TimestampPacketContainer>(commandQueue.getDevice().getMemoryManager());
|
currentTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
|
||||||
currentTimestampPacketNodes->assignAndIncrementNodesRefCounts(current);
|
currentTimestampPacketNodes->assignAndIncrementNodesRefCounts(current);
|
||||||
|
|
||||||
previousTimestampPacketNodes = std::make_unique<TimestampPacketContainer>(commandQueue.getDevice().getMemoryManager());
|
previousTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
|
||||||
previousTimestampPacketNodes->assignAndIncrementNodesRefCounts(previous);
|
previousTimestampPacketNodes->assignAndIncrementNodesRefCounts(previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,20 +10,17 @@
|
|||||||
#include "runtime/event/event.h"
|
#include "runtime/event/event.h"
|
||||||
#include "runtime/helpers/kernel_commands.h"
|
#include "runtime/helpers/kernel_commands.h"
|
||||||
#include "runtime/helpers/timestamp_packet.h"
|
#include "runtime/helpers/timestamp_packet.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
|
||||||
#include "runtime/utilities/tag_allocator.h"
|
#include "runtime/utilities/tag_allocator.h"
|
||||||
|
|
||||||
using namespace OCLRT;
|
using namespace OCLRT;
|
||||||
|
|
||||||
TimestampPacketContainer::TimestampPacketContainer(MemoryManager *memoryManager) : memoryManager(memoryManager){};
|
|
||||||
|
|
||||||
void TimestampPacketContainer::add(Node *timestampPacketNode) {
|
void TimestampPacketContainer::add(Node *timestampPacketNode) {
|
||||||
timestampPacketNodes.push_back(timestampPacketNode);
|
timestampPacketNodes.push_back(timestampPacketNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimestampPacketContainer::~TimestampPacketContainer() {
|
TimestampPacketContainer::~TimestampPacketContainer() {
|
||||||
for (auto &node : timestampPacketNodes) {
|
for (auto node : timestampPacketNodes) {
|
||||||
memoryManager->peekTimestampPacketAllocator()->returnTag(node);
|
node->returnTag();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,9 +31,9 @@ void TimestampPacketContainer::swapNodes(TimestampPacketContainer ×tampPack
|
|||||||
void TimestampPacketContainer::resolveDependencies(bool clearAllDependencies) {
|
void TimestampPacketContainer::resolveDependencies(bool clearAllDependencies) {
|
||||||
std::vector<Node *> pendingNodes;
|
std::vector<Node *> pendingNodes;
|
||||||
|
|
||||||
for (auto &node : timestampPacketNodes) {
|
for (auto node : timestampPacketNodes) {
|
||||||
if (node->tag->canBeReleased() || clearAllDependencies) {
|
if (node->tag->canBeReleased() || clearAllDependencies) {
|
||||||
memoryManager->peekTimestampPacketAllocator()->returnTag(node);
|
node->returnTag();
|
||||||
} else {
|
} else {
|
||||||
pendingNodes.push_back(node);
|
pendingNodes.push_back(node);
|
||||||
}
|
}
|
||||||
@@ -45,17 +42,17 @@ void TimestampPacketContainer::resolveDependencies(bool clearAllDependencies) {
|
|||||||
std::swap(timestampPacketNodes, pendingNodes);
|
std::swap(timestampPacketNodes, pendingNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimestampPacketContainer::assignAndIncrementNodesRefCounts(TimestampPacketContainer &inputTimestampPacketContainer) {
|
void TimestampPacketContainer::assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer) {
|
||||||
auto &inputNodes = inputTimestampPacketContainer.peekNodes();
|
auto &inputNodes = inputTimestampPacketContainer.peekNodes();
|
||||||
std::copy(inputNodes.begin(), inputNodes.end(), std::back_inserter(timestampPacketNodes));
|
std::copy(inputNodes.begin(), inputNodes.end(), std::back_inserter(timestampPacketNodes));
|
||||||
|
|
||||||
for (auto &node : inputNodes) {
|
for (auto node : inputNodes) {
|
||||||
node->incRefCount();
|
node->incRefCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimestampPacketContainer::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
void TimestampPacketContainer::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
||||||
for (auto &node : timestampPacketNodes) {
|
for (auto node : timestampPacketNodes) {
|
||||||
commandStreamReceiver.makeResident(*node->getGraphicsAllocation());
|
commandStreamReceiver.makeResident(*node->getGraphicsAllocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
class CommandStreamReceiver;
|
class CommandStreamReceiver;
|
||||||
class LinearStream;
|
class LinearStream;
|
||||||
class MemoryManager;
|
|
||||||
template <typename TagType>
|
template <typename TagType>
|
||||||
struct TagNode;
|
struct TagNode;
|
||||||
|
|
||||||
@@ -96,19 +95,17 @@ struct TimestampPacketHelper {
|
|||||||
class TimestampPacketContainer : public NonCopyableOrMovableClass {
|
class TimestampPacketContainer : public NonCopyableOrMovableClass {
|
||||||
public:
|
public:
|
||||||
using Node = TagNode<TimestampPacket>;
|
using Node = TagNode<TimestampPacket>;
|
||||||
TimestampPacketContainer() = delete;
|
TimestampPacketContainer() = default;
|
||||||
TimestampPacketContainer(MemoryManager *memoryManager);
|
|
||||||
~TimestampPacketContainer();
|
~TimestampPacketContainer();
|
||||||
|
|
||||||
const std::vector<Node *> &peekNodes() const { return timestampPacketNodes; }
|
const std::vector<Node *> &peekNodes() const { return timestampPacketNodes; }
|
||||||
void add(Node *timestampPacketNode);
|
void add(Node *timestampPacketNode);
|
||||||
void swapNodes(TimestampPacketContainer ×tampPacketContainer);
|
void swapNodes(TimestampPacketContainer ×tampPacketContainer);
|
||||||
void assignAndIncrementNodesRefCounts(TimestampPacketContainer &inputTimestampPacketContainer);
|
void assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer);
|
||||||
void resolveDependencies(bool clearAllDependencies);
|
void resolveDependencies(bool clearAllDependencies);
|
||||||
void makeResident(CommandStreamReceiver &commandStreamReceiver);
|
void makeResident(CommandStreamReceiver &commandStreamReceiver);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<Node *> timestampPacketNodes;
|
std::vector<Node *> timestampPacketNodes;
|
||||||
MemoryManager *memoryManager = nullptr;
|
|
||||||
};
|
};
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|||||||
@@ -14,14 +14,12 @@
|
|||||||
#include "runtime/helpers/basic_math.h"
|
#include "runtime/helpers/basic_math.h"
|
||||||
#include "runtime/helpers/kernel_commands.h"
|
#include "runtime/helpers/kernel_commands.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
#include "runtime/helpers/timestamp_packet.h"
|
|
||||||
#include "runtime/memory_manager/deferred_deleter.h"
|
#include "runtime/memory_manager/deferred_deleter.h"
|
||||||
#include "runtime/memory_manager/host_ptr_manager.h"
|
#include "runtime/memory_manager/host_ptr_manager.h"
|
||||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||||
#include "runtime/os_interface/os_context.h"
|
#include "runtime/os_interface/os_context.h"
|
||||||
#include "runtime/os_interface/os_interface.h"
|
#include "runtime/os_interface/os_interface.h"
|
||||||
#include "runtime/utilities/stackvec.h"
|
#include "runtime/utilities/stackvec.h"
|
||||||
#include "runtime/utilities/tag_allocator.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -131,45 +129,8 @@ void MemoryManager::applyCommonCleanup() {
|
|||||||
if (this->paddingAllocation) {
|
if (this->paddingAllocation) {
|
||||||
this->freeGraphicsMemory(this->paddingAllocation);
|
this->freeGraphicsMemory(this->paddingAllocation);
|
||||||
}
|
}
|
||||||
if (profilingTimeStampAllocator) {
|
|
||||||
profilingTimeStampAllocator->cleanUpResources();
|
|
||||||
}
|
|
||||||
if (perfCounterAllocator) {
|
|
||||||
perfCounterAllocator->cleanUpResources();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (timestampPacketAllocator) {
|
|
||||||
timestampPacketAllocator->cleanUpResources();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TagAllocator<HwTimeStamps> *MemoryManager::obtainEventTsAllocator(size_t poolSize) {
|
|
||||||
if (profilingTimeStampAllocator.get() == nullptr) {
|
|
||||||
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(this, poolSize, MemoryConstants::cacheLineSize);
|
|
||||||
}
|
|
||||||
return profilingTimeStampAllocator.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
TagAllocator<HwPerfCounter> *MemoryManager::obtainEventPerfCountAllocator(size_t poolSize) {
|
|
||||||
if (perfCounterAllocator.get() == nullptr) {
|
|
||||||
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(this, poolSize, MemoryConstants::cacheLineSize);
|
|
||||||
}
|
|
||||||
return perfCounterAllocator.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
TagAllocator<TimestampPacket> *MemoryManager::obtainTimestampPacketAllocator(size_t poolSize) {
|
|
||||||
if (timestampPacketAllocator.get() == nullptr) {
|
|
||||||
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacket>>(this, poolSize, MemoryConstants::cacheLineSize);
|
|
||||||
}
|
|
||||||
return timestampPacketAllocator.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
TagAllocator<HwTimeStamps> *MemoryManager::peekEventTsAllocator() const { return profilingTimeStampAllocator.get(); }
|
|
||||||
|
|
||||||
TagAllocator<HwPerfCounter> *MemoryManager::peekEventPerfCountAllocator() const { return perfCounterAllocator.get(); }
|
|
||||||
|
|
||||||
TagAllocator<TimestampPacket> *MemoryManager::peekTimestampPacketAllocator() const { return timestampPacketAllocator.get(); }
|
|
||||||
|
|
||||||
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation) {
|
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation) {
|
||||||
freeGraphicsMemoryImpl(gfxAllocation);
|
freeGraphicsMemoryImpl(gfxAllocation);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,17 +26,6 @@ class HostPtrManager;
|
|||||||
class CommandStreamReceiver;
|
class CommandStreamReceiver;
|
||||||
class OsContext;
|
class OsContext;
|
||||||
class OSInterface;
|
class OSInterface;
|
||||||
class TimestampPacket;
|
|
||||||
|
|
||||||
struct HwPerfCounter;
|
|
||||||
struct HwTimeStamps;
|
|
||||||
|
|
||||||
template <typename T1>
|
|
||||||
class TagAllocator;
|
|
||||||
|
|
||||||
template <typename T1>
|
|
||||||
struct TagNode;
|
|
||||||
|
|
||||||
class AllocsTracker;
|
class AllocsTracker;
|
||||||
class MapBaseAllocationTracker;
|
class MapBaseAllocationTracker;
|
||||||
class SVMAllocsManager;
|
class SVMAllocsManager;
|
||||||
@@ -206,14 +195,6 @@ class MemoryManager {
|
|||||||
|
|
||||||
virtual uint64_t getInternalHeapBaseAddress() = 0;
|
virtual uint64_t getInternalHeapBaseAddress() = 0;
|
||||||
|
|
||||||
TagAllocator<HwTimeStamps> *obtainEventTsAllocator(size_t poolSize);
|
|
||||||
TagAllocator<HwPerfCounter> *obtainEventPerfCountAllocator(size_t poolSize);
|
|
||||||
MOCKABLE_VIRTUAL TagAllocator<TimestampPacket> *obtainTimestampPacketAllocator(size_t poolSize);
|
|
||||||
|
|
||||||
TagAllocator<HwTimeStamps> *peekEventTsAllocator() const;
|
|
||||||
TagAllocator<HwPerfCounter> *peekEventPerfCountAllocator() const;
|
|
||||||
TagAllocator<TimestampPacket> *peekTimestampPacketAllocator() const;
|
|
||||||
|
|
||||||
virtual GraphicsAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) = 0;
|
virtual GraphicsAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) = 0;
|
||||||
|
|
||||||
bool peek64kbPagesEnabled() const { return enable64kbpages; }
|
bool peek64kbPagesEnabled() const { return enable64kbpages; }
|
||||||
@@ -258,9 +239,6 @@ class MemoryManager {
|
|||||||
const void *hostPtr, size_t size, GraphicsAllocation::AllocationType type);
|
const void *hostPtr, size_t size, GraphicsAllocation::AllocationType type);
|
||||||
|
|
||||||
GraphicsAllocation *allocateGraphicsMemory(const AllocationData &allocationData);
|
GraphicsAllocation *allocateGraphicsMemory(const AllocationData &allocationData);
|
||||||
std::unique_ptr<TagAllocator<HwTimeStamps>> profilingTimeStampAllocator;
|
|
||||||
std::unique_ptr<TagAllocator<HwPerfCounter>> perfCounterAllocator;
|
|
||||||
std::unique_ptr<TagAllocator<TimestampPacket>> timestampPacketAllocator;
|
|
||||||
bool force32bitAllocations = false;
|
bool force32bitAllocations = false;
|
||||||
bool virtualPaddingAvailable = false;
|
bool virtualPaddingAvailable = false;
|
||||||
GraphicsAllocation *paddingAllocation = nullptr;
|
GraphicsAllocation *paddingAllocation = nullptr;
|
||||||
|
|||||||
@@ -19,18 +19,25 @@
|
|||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
class GraphicsAllocation;
|
class GraphicsAllocation;
|
||||||
|
|
||||||
|
template <typename TagType>
|
||||||
|
class TagAllocator;
|
||||||
|
|
||||||
template <typename TagType>
|
template <typename TagType>
|
||||||
struct TagNode : public IDNode<TagNode<TagType>> {
|
struct TagNode : public IDNode<TagNode<TagType>> {
|
||||||
public:
|
public:
|
||||||
TagType *tag;
|
TagType *tag;
|
||||||
GraphicsAllocation *getGraphicsAllocation() {
|
|
||||||
return gfxAllocation;
|
GraphicsAllocation *getGraphicsAllocation() const { return gfxAllocation; }
|
||||||
}
|
|
||||||
|
|
||||||
void incRefCount() { refCount++; }
|
void incRefCount() { refCount++; }
|
||||||
|
|
||||||
|
void returnTag() {
|
||||||
|
allocator->returnTag(this);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TagNode() = default;
|
TagNode() = default;
|
||||||
|
TagAllocator<TagType> *allocator;
|
||||||
GraphicsAllocation *gfxAllocation;
|
GraphicsAllocation *gfxAllocation;
|
||||||
std::atomic<uint32_t> refCount{0};
|
std::atomic<uint32_t> refCount{0};
|
||||||
|
|
||||||
@@ -54,16 +61,13 @@ class TagAllocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cleanUpResources() {
|
void cleanUpResources() {
|
||||||
size_t size = gfxAllocations.size();
|
for (auto gfxAllocation : gfxAllocations) {
|
||||||
|
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||||
for (uint32_t i = 0; i < size; ++i) {
|
|
||||||
memoryManager->freeGraphicsMemory(gfxAllocations[i]);
|
|
||||||
}
|
}
|
||||||
gfxAllocations.clear();
|
gfxAllocations.clear();
|
||||||
|
|
||||||
size = tagPoolMemory.size();
|
for (auto nodesMemory : tagPoolMemory) {
|
||||||
for (uint32_t i = 0; i < size; ++i) {
|
delete[] nodesMemory;
|
||||||
delete[] tagPoolMemory[i];
|
|
||||||
}
|
}
|
||||||
tagPoolMemory.clear();
|
tagPoolMemory.clear();
|
||||||
}
|
}
|
||||||
@@ -121,8 +125,7 @@ class TagAllocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void populateFreeTags() {
|
void populateFreeTags() {
|
||||||
size_t tagSize = sizeof(TagType);
|
size_t tagSize = alignUp(sizeof(TagType), tagAlignment);
|
||||||
tagSize = alignUp(tagSize, tagAlignment);
|
|
||||||
size_t allocationSizeRequired = tagCount * tagSize;
|
size_t allocationSizeRequired = tagCount * tagSize;
|
||||||
|
|
||||||
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemory(allocationSizeRequired);
|
GraphicsAllocation *graphicsAllocation = memoryManager->allocateGraphicsMemory(allocationSizeRequired);
|
||||||
@@ -137,6 +140,7 @@ class TagAllocator {
|
|||||||
NodeType *nodesMemory = new NodeType[nodeCount];
|
NodeType *nodesMemory = new NodeType[nodeCount];
|
||||||
|
|
||||||
for (size_t i = 0; i < nodeCount; ++i) {
|
for (size_t i = 0; i < nodeCount; ++i) {
|
||||||
|
nodesMemory[i].allocator = this;
|
||||||
nodesMemory[i].gfxAllocation = graphicsAllocation;
|
nodesMemory[i].gfxAllocation = graphicsAllocation;
|
||||||
nodesMemory[i].tag = reinterpret_cast<TagType *>(Start);
|
nodesMemory[i].tag = reinterpret_cast<TagType *>(Start);
|
||||||
freeTags.pushTailOne(nodesMemory[i]);
|
freeTags.pushTailOne(nodesMemory[i]);
|
||||||
|
|||||||
@@ -9,11 +9,13 @@
|
|||||||
#include "runtime/command_stream/linear_stream.h"
|
#include "runtime/command_stream/linear_stream.h"
|
||||||
#include "runtime/command_stream/preemption.h"
|
#include "runtime/command_stream/preemption.h"
|
||||||
#include "runtime/helpers/cache_policy.h"
|
#include "runtime/helpers/cache_policy.h"
|
||||||
|
#include "runtime/helpers/timestamp_packet.h"
|
||||||
#include "runtime/mem_obj/buffer.h"
|
#include "runtime/mem_obj/buffer.h"
|
||||||
#include "runtime/memory_manager/graphics_allocation.h"
|
#include "runtime/memory_manager/graphics_allocation.h"
|
||||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||||
#include "runtime/memory_manager/memory_manager.h"
|
#include "runtime/memory_manager/memory_manager.h"
|
||||||
#include "runtime/memory_manager/surface.h"
|
#include "runtime/memory_manager/surface.h"
|
||||||
|
#include "runtime/utilities/tag_allocator.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "unit_tests/fixtures/device_fixture.h"
|
#include "unit_tests/fixtures/device_fixture.h"
|
||||||
#include "unit_tests/gen_common/matchers.h"
|
#include "unit_tests/gen_common/matchers.h"
|
||||||
@@ -277,6 +279,38 @@ HWTEST_F(CommandStreamReceiverTest, whenCsrIsCreatedThenUseTimestampPacketWriteI
|
|||||||
EXPECT_EQ(UnitTestHelper<FamilyType>::isTimestampPacketWriteSupported(), csr.peekTimestampPacketWriteEnabled());
|
EXPECT_EQ(UnitTestHelper<FamilyType>::isTimestampPacketWriteSupported(), csr.peekTimestampPacketWriteEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(CommandStreamReceiverTest, whenGetEventTsAllocatorIsCalledItReturnsSameTagAllocator) {
|
||||||
|
TagAllocator<HwTimeStamps> *allocator = commandStreamReceiver->getEventTsAllocator();
|
||||||
|
EXPECT_NE(nullptr, allocator);
|
||||||
|
TagAllocator<HwTimeStamps> *allocator2 = commandStreamReceiver->getEventTsAllocator();
|
||||||
|
EXPECT_EQ(allocator2, allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CommandStreamReceiverTest, whenGetEventPerfCountAllocatorIsCalledItReturnsSameTagAllocator) {
|
||||||
|
TagAllocator<HwPerfCounter> *allocator = commandStreamReceiver->getEventPerfCountAllocator();
|
||||||
|
EXPECT_NE(nullptr, allocator);
|
||||||
|
TagAllocator<HwPerfCounter> *allocator2 = commandStreamReceiver->getEventPerfCountAllocator();
|
||||||
|
EXPECT_EQ(allocator2, allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(CommandStreamReceiverTest, givenTimestampPacketAllocatorWhenAskingForTagThenReturnValidObject) {
|
||||||
|
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||||
|
EXPECT_EQ(nullptr, csr.timestampPacketAllocator.get());
|
||||||
|
|
||||||
|
TagAllocator<TimestampPacket> *allocator = csr.getTimestampPacketAllocator();
|
||||||
|
EXPECT_NE(nullptr, csr.timestampPacketAllocator.get());
|
||||||
|
EXPECT_EQ(allocator, csr.timestampPacketAllocator.get());
|
||||||
|
|
||||||
|
TagAllocator<TimestampPacket> *allocator2 = csr.getTimestampPacketAllocator();
|
||||||
|
EXPECT_EQ(allocator, allocator2);
|
||||||
|
|
||||||
|
auto node1 = allocator->getTag();
|
||||||
|
auto node2 = allocator->getTag();
|
||||||
|
EXPECT_NE(nullptr, node1);
|
||||||
|
EXPECT_NE(nullptr, node2);
|
||||||
|
EXPECT_NE(node1, node2);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(CommandStreamReceiverSimpleTest, givenCSRWithTagAllocationSetWhenGetTagAllocationIsCalledThenCorrectAllocationIsReturned) {
|
TEST(CommandStreamReceiverSimpleTest, givenCSRWithTagAllocationSetWhenGetTagAllocationIsCalledThenCorrectAllocationIsReturned) {
|
||||||
ExecutionEnvironment executionEnvironment;
|
ExecutionEnvironment executionEnvironment;
|
||||||
MockCommandStreamReceiver csr(executionEnvironment);
|
MockCommandStreamReceiver csr(executionEnvironment);
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ struct TimestampPacketSimpleTests : public ::testing::Test {
|
|||||||
public:
|
public:
|
||||||
using TimestampPacketContainer::timestampPacketNodes;
|
using TimestampPacketContainer::timestampPacketNodes;
|
||||||
|
|
||||||
MockTimestampPacketContainer(MemoryManager *memoryManager, size_t numberOfPreallocatedTags) : TimestampPacketContainer(memoryManager) {
|
MockTimestampPacketContainer(TagAllocator<TimestampPacket> &tagAllocator, size_t numberOfPreallocatedTags) {
|
||||||
for (size_t i = 0; i < numberOfPreallocatedTags; i++) {
|
for (size_t i = 0; i < numberOfPreallocatedTags; i++) {
|
||||||
add(memoryManager->obtainTimestampPacketAllocator(3)->getTag());
|
add(tagAllocator.getTag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,27 +205,9 @@ TEST_F(TimestampPacketSimpleTests, whenAskedForStampAddressThenReturnWithValidOf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(TimestampPacketTests, asd) {
|
HWTEST_F(TimestampPacketTests, givenCommandStreamReceiverHwWhenObtainingPreferredTagPoolSizeThenReturnCorrectValue) {
|
||||||
class MyMockMemoryManager : public OsAgnosticMemoryManager {
|
CommandStreamReceiverHw<FamilyType> csr(*platformDevices[0], executionEnvironment);
|
||||||
public:
|
EXPECT_EQ(512u, csr.getPreferredTagPoolSize());
|
||||||
MyMockMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(false, false, executionEnvironment){};
|
|
||||||
TagAllocator<TimestampPacket> *obtainTimestampPacketAllocator(size_t poolSize) override {
|
|
||||||
requestedPoolSize = poolSize;
|
|
||||||
return OsAgnosticMemoryManager::obtainTimestampPacketAllocator(poolSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t requestedPoolSize = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto myMockMemoryManager = new MyMockMemoryManager(executionEnvironment);
|
|
||||||
device->injectMemoryManager(myMockMemoryManager);
|
|
||||||
context->setMemoryManager(myMockMemoryManager);
|
|
||||||
|
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
|
||||||
mockCmdQ->timestampPacketContainer = std::make_unique<MockTimestampPacketContainer>(myMockMemoryManager, 0);
|
|
||||||
mockCmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
|
|
||||||
|
|
||||||
EXPECT_EQ(device->getUltCommandStreamReceiver<FamilyType>().getPreferredTagPoolSize(), myMockMemoryManager->requestedPoolSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStreamSizeThenAddPipeControl) {
|
HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStreamSizeThenAddPipeControl) {
|
||||||
@@ -289,7 +271,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEstimatingStr
|
|||||||
HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispatchingGpuWalkerThenAddTwoPcForLastWalker) {
|
HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispatchingGpuWalkerThenAddTwoPcForLastWalker) {
|
||||||
using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER;
|
using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER;
|
||||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||||
MockTimestampPacketContainer timestampPacket(device->getMemoryManager(), 2);
|
MockTimestampPacketContainer timestampPacket(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 2);
|
||||||
|
|
||||||
MockKernelWithInternals kernel2(*device);
|
MockKernelWithInternals kernel2(*device);
|
||||||
|
|
||||||
@@ -335,7 +317,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispat
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketDisabledWhenDispatchingGpuWalkerThenDontAddPipeControls) {
|
HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketDisabledWhenDispatchingGpuWalkerThenDontAddPipeControls) {
|
||||||
MockTimestampPacketContainer timestampPacket(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestampPacket(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockMultiDispatchInfo multiDispatchInfo(kernel->mockKernel);
|
MockMultiDispatchInfo multiDispatchInfo(kernel->mockKernel);
|
||||||
auto &cmdStream = mockCmdQ->getCS(0);
|
auto &cmdStream = mockCmdQ->getCS(0);
|
||||||
|
|
||||||
@@ -362,12 +344,13 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketDisabledWh
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThenObtainNewStampAndPassToEvent) {
|
HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThenObtainNewStampAndPassToEvent) {
|
||||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||||
|
csr.timestampPacketWriteEnabled = true;
|
||||||
auto mockMemoryManager = new MockMemoryManager(*device->getExecutionEnvironment());
|
auto mockMemoryManager = new MockMemoryManager(*device->getExecutionEnvironment());
|
||||||
device->injectMemoryManager(mockMemoryManager);
|
device->injectMemoryManager(mockMemoryManager);
|
||||||
context->setMemoryManager(mockMemoryManager);
|
context->setMemoryManager(mockMemoryManager);
|
||||||
auto mockTagAllocator = new MockTagAllocator<>(mockMemoryManager);
|
auto mockTagAllocator = new MockTagAllocator<>(mockMemoryManager);
|
||||||
mockMemoryManager->timestampPacketAllocator.reset(mockTagAllocator);
|
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||||
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
||||||
|
|
||||||
cl_event event1, event2;
|
cl_event event1, event2;
|
||||||
@@ -464,10 +447,10 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
|
|||||||
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
|
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
|
||||||
|
|
||||||
const cl_uint eventsOnWaitlist = 6;
|
const cl_uint eventsOnWaitlist = 6;
|
||||||
MockTimestampPacketContainer timestamp3(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp3(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer timestamp4(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp4(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer timestamp5(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp5(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer timestamp6(device->getMemoryManager(), 2);
|
MockTimestampPacketContainer timestamp6(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 2);
|
||||||
|
|
||||||
UserEvent event1;
|
UserEvent event1;
|
||||||
event1.setStatus(CL_COMPLETE);
|
event1.setStatus(CL_COMPLETE);
|
||||||
@@ -517,8 +500,8 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingBlo
|
|||||||
auto cmdQ1 = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
auto cmdQ1 = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
||||||
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
|
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
|
||||||
|
|
||||||
MockTimestampPacketContainer timestamp0(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp0(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer timestamp1(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp1(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
|
|
||||||
UserEvent userEvent;
|
UserEvent userEvent;
|
||||||
Event event0(cmdQ1.get(), 0, 0, 0);
|
Event event0(cmdQ1.get(), 0, 0, 0);
|
||||||
@@ -561,10 +544,10 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenDispatchingTh
|
|||||||
auto &cmdStream = mockCmdQ->getCS(0);
|
auto &cmdStream = mockCmdQ->getCS(0);
|
||||||
|
|
||||||
const cl_uint eventsOnWaitlist = 6;
|
const cl_uint eventsOnWaitlist = 6;
|
||||||
MockTimestampPacketContainer timestamp3(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp3(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer timestamp4(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp4(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer timestamp5(device->getMemoryManager(), 2);
|
MockTimestampPacketContainer timestamp5(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 2);
|
||||||
MockTimestampPacketContainer timestamp6(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer timestamp6(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
|
|
||||||
UserEvent event1;
|
UserEvent event1;
|
||||||
UserEvent event2;
|
UserEvent event2;
|
||||||
@@ -630,16 +613,16 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingNonBlockedT
|
|||||||
device->injectMemoryManager(mockMemoryManager);
|
device->injectMemoryManager(mockMemoryManager);
|
||||||
context->setMemoryManager(mockMemoryManager);
|
context->setMemoryManager(mockMemoryManager);
|
||||||
auto mockTagAllocator = new MockTagAllocator<>(mockMemoryManager, 1);
|
auto mockTagAllocator = new MockTagAllocator<>(mockMemoryManager, 1);
|
||||||
mockMemoryManager->timestampPacketAllocator.reset(mockTagAllocator);
|
|
||||||
|
|
||||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||||
|
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||||
|
csr.timestampPacketWriteEnabled = true;
|
||||||
|
|
||||||
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
TimestampPacketContainer previousNodes;
|
||||||
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
|
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
|
||||||
auto firstNode = cmdQ->timestampPacketContainer->peekNodes().at(0);
|
auto firstNode = cmdQ->timestampPacketContainer->peekNodes().at(0);
|
||||||
|
|
||||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
|
||||||
csr.storeMakeResidentAllocations = true;
|
csr.storeMakeResidentAllocations = true;
|
||||||
csr.timestampPacketWriteEnabled = true;
|
csr.timestampPacketWriteEnabled = true;
|
||||||
|
|
||||||
@@ -655,16 +638,16 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingBlockedThen
|
|||||||
device->injectMemoryManager(mockMemoryManager);
|
device->injectMemoryManager(mockMemoryManager);
|
||||||
context->setMemoryManager(mockMemoryManager);
|
context->setMemoryManager(mockMemoryManager);
|
||||||
auto mockTagAllocator = new MockTagAllocator<>(mockMemoryManager, 1);
|
auto mockTagAllocator = new MockTagAllocator<>(mockMemoryManager, 1);
|
||||||
mockMemoryManager->timestampPacketAllocator.reset(mockTagAllocator);
|
|
||||||
|
|
||||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||||
|
csr.timestampPacketAllocator.reset(mockTagAllocator);
|
||||||
|
csr.timestampPacketWriteEnabled = true;
|
||||||
|
|
||||||
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
TimestampPacketContainer previousNodes;
|
||||||
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
|
cmdQ->obtainNewTimestampPacketNodes(1, previousNodes);
|
||||||
auto firstNode = cmdQ->timestampPacketContainer->peekNodes().at(0);
|
auto firstNode = cmdQ->timestampPacketContainer->peekNodes().at(0);
|
||||||
|
|
||||||
auto &csr = device->getUltCommandStreamReceiver<FamilyType>();
|
|
||||||
csr.storeMakeResidentAllocations = true;
|
csr.storeMakeResidentAllocations = true;
|
||||||
csr.timestampPacketWriteEnabled = true;
|
csr.timestampPacketWriteEnabled = true;
|
||||||
|
|
||||||
@@ -683,7 +666,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingThenDontKee
|
|||||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
||||||
|
|
||||||
MockCommandQueueHw<FamilyType> cmdQ(context.get(), device.get(), nullptr);
|
MockCommandQueueHw<FamilyType> cmdQ(context.get(), device.get(), nullptr);
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
TimestampPacketContainer previousNodes;
|
||||||
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
|
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
|
||||||
auto firstNode = cmdQ.timestampPacketContainer->peekNodes().at(0);
|
auto firstNode = cmdQ.timestampPacketContainer->peekNodes().at(0);
|
||||||
setTagToReadyState(firstNode->tag);
|
setTagToReadyState(firstNode->tag);
|
||||||
@@ -711,10 +694,10 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingThenKeepDep
|
|||||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||||
using MI_ATOMIC = typename FamilyType::MI_ATOMIC;
|
using MI_ATOMIC = typename FamilyType::MI_ATOMIC;
|
||||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
||||||
MockTimestampPacketContainer firstNode(device->getMemoryManager(), 0);
|
MockTimestampPacketContainer firstNode(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 0);
|
||||||
|
|
||||||
MockCommandQueueHw<FamilyType> cmdQ(context.get(), device.get(), nullptr);
|
MockCommandQueueHw<FamilyType> cmdQ(context.get(), device.get(), nullptr);
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
TimestampPacketContainer previousNodes;
|
||||||
cmdQ.obtainNewTimestampPacketNodes(2, previousNodes);
|
cmdQ.obtainNewTimestampPacketNodes(2, previousNodes);
|
||||||
firstNode.add(cmdQ.timestampPacketContainer->peekNodes().at(0));
|
firstNode.add(cmdQ.timestampPacketContainer->peekNodes().at(0));
|
||||||
firstNode.add(cmdQ.timestampPacketContainer->peekNodes().at(1));
|
firstNode.add(cmdQ.timestampPacketContainer->peekNodes().at(1));
|
||||||
@@ -747,7 +730,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingToOoqThenDo
|
|||||||
|
|
||||||
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
|
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0};
|
||||||
MockCommandQueueHw<FamilyType> cmdQ(context.get(), device.get(), properties);
|
MockCommandQueueHw<FamilyType> cmdQ(context.get(), device.get(), properties);
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
TimestampPacketContainer previousNodes;
|
||||||
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
|
cmdQ.obtainNewTimestampPacketNodes(1, previousNodes);
|
||||||
|
|
||||||
cmdQ.enqueueKernel(kernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
cmdQ.enqueueKernel(kernel->mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
||||||
@@ -773,19 +756,17 @@ HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueu
|
|||||||
TagAllocator<TimestampPacket> tagAllocator(executionEnvironment.memoryManager.get(), 1, 1);
|
TagAllocator<TimestampPacket> tagAllocator(executionEnvironment.memoryManager.get(), 1, 1);
|
||||||
auto device2 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr, &executionEnvironment, 1u));
|
auto device2 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr, &executionEnvironment, 1u));
|
||||||
|
|
||||||
device->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
|
||||||
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
|
||||||
|
|
||||||
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
|
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
|
||||||
ultCsr.timestampPacketWriteEnabled = true;
|
ultCsr.timestampPacketWriteEnabled = true;
|
||||||
ultCsr.storeMakeResidentAllocations = true;
|
ultCsr.storeMakeResidentAllocations = true;
|
||||||
|
device2->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
|
||||||
MockContext context2(device2.get());
|
MockContext context2(device2.get());
|
||||||
|
|
||||||
auto cmdQ1 = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
auto cmdQ1 = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
|
||||||
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
|
auto cmdQ2 = std::make_unique<MockCommandQueueHw<FamilyType>>(&context2, device2.get(), nullptr);
|
||||||
|
|
||||||
MockTimestampPacketContainer node1(device->getMemoryManager(), 0);
|
MockTimestampPacketContainer node1(*ultCsr.getTimestampPacketAllocator(), 0);
|
||||||
MockTimestampPacketContainer node2(device->getMemoryManager(), 0);
|
MockTimestampPacketContainer node2(*ultCsr.getTimestampPacketAllocator(), 0);
|
||||||
|
|
||||||
auto tagNode1 = tagAllocator.getTag();
|
auto tagNode1 = tagAllocator.getTag();
|
||||||
node1.add(tagNode1);
|
node1.add(tagNode1);
|
||||||
@@ -842,10 +823,10 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWhenEnqueueingBlockedThenMake
|
|||||||
TEST_F(TimestampPacketTests, givenDispatchSizeWhenAskingForNewTimestampsThenObtainEnoughTags) {
|
TEST_F(TimestampPacketTests, givenDispatchSizeWhenAskingForNewTimestampsThenObtainEnoughTags) {
|
||||||
size_t dispatchSize = 3;
|
size_t dispatchSize = 3;
|
||||||
|
|
||||||
mockCmdQ->timestampPacketContainer = std::make_unique<MockTimestampPacketContainer>(device->getMemoryManager(), 0);
|
mockCmdQ->timestampPacketContainer = std::make_unique<MockTimestampPacketContainer>(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 0);
|
||||||
EXPECT_EQ(0u, mockCmdQ->timestampPacketContainer->peekNodes().size());
|
EXPECT_EQ(0u, mockCmdQ->timestampPacketContainer->peekNodes().size());
|
||||||
|
|
||||||
TimestampPacketContainer previousNodes(device->getMemoryManager());
|
TimestampPacketContainer previousNodes;
|
||||||
mockCmdQ->obtainNewTimestampPacketNodes(dispatchSize, previousNodes);
|
mockCmdQ->obtainNewTimestampPacketNodes(dispatchSize, previousNodes);
|
||||||
EXPECT_EQ(dispatchSize, mockCmdQ->timestampPacketContainer->peekNodes().size());
|
EXPECT_EQ(dispatchSize, mockCmdQ->timestampPacketContainer->peekNodes().size());
|
||||||
}
|
}
|
||||||
@@ -858,11 +839,11 @@ HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingWithoutK
|
|||||||
MockKernelWithInternals mockKernel(*device, context.get());
|
MockKernelWithInternals mockKernel(*device, context.get());
|
||||||
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); // obtain first TimestampPacket
|
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); // obtain first TimestampPacket
|
||||||
|
|
||||||
TimestampPacketContainer cmdQNodes(device->getMemoryManager());
|
TimestampPacketContainer cmdQNodes;
|
||||||
cmdQNodes.assignAndIncrementNodesRefCounts(*cmdQ.timestampPacketContainer);
|
cmdQNodes.assignAndIncrementNodesRefCounts(*cmdQ.timestampPacketContainer);
|
||||||
|
|
||||||
MockTimestampPacketContainer node1(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer node1(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
MockTimestampPacketContainer node2(device->getMemoryManager(), 1);
|
MockTimestampPacketContainer node2(*device->getCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||||
|
|
||||||
Event event0(&cmdQ, 0, 0, 0);
|
Event event0(&cmdQ, 0, 0, 0);
|
||||||
event0.addTimestampPacketNodes(node1);
|
event0.addTimestampPacketNodes(node1);
|
||||||
@@ -911,7 +892,7 @@ HWTEST_F(TimestampPacketTests, whenEnqueueingBarrierThenRequestPipeControlOnCsrF
|
|||||||
MockKernelWithInternals mockKernel(*device, context.get());
|
MockKernelWithInternals mockKernel(*device, context.get());
|
||||||
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); // obtain first TimestampPacket
|
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr); // obtain first TimestampPacket
|
||||||
|
|
||||||
TimestampPacketContainer cmdQNodes(device->getMemoryManager());
|
TimestampPacketContainer cmdQNodes;
|
||||||
cmdQNodes.assignAndIncrementNodesRefCounts(*cmdQ.timestampPacketContainer);
|
cmdQNodes.assignAndIncrementNodesRefCounts(*cmdQ.timestampPacketContainer);
|
||||||
|
|
||||||
cmdQ.enqueueBarrierWithWaitList(0, nullptr, nullptr);
|
cmdQ.enqueueBarrierWithWaitList(0, nullptr, nullptr);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||||||
using BaseClass::CommandStreamReceiver::submissionAggregator;
|
using BaseClass::CommandStreamReceiver::submissionAggregator;
|
||||||
using BaseClass::CommandStreamReceiver::taskCount;
|
using BaseClass::CommandStreamReceiver::taskCount;
|
||||||
using BaseClass::CommandStreamReceiver::taskLevel;
|
using BaseClass::CommandStreamReceiver::taskLevel;
|
||||||
|
using BaseClass::CommandStreamReceiver::timestampPacketAllocator;
|
||||||
using BaseClass::CommandStreamReceiver::timestampPacketWriteEnabled;
|
using BaseClass::CommandStreamReceiver::timestampPacketWriteEnabled;
|
||||||
using BaseClass::CommandStreamReceiver::waitForTaskCountAndCleanAllocationList;
|
using BaseClass::CommandStreamReceiver::waitForTaskCountAndCleanAllocationList;
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||||||
}
|
}
|
||||||
|
|
||||||
void overrideCsrSizeReqFlags(CsrSizeRequestFlags &flags) { this->csrSizeRequestFlags = flags; }
|
void overrideCsrSizeReqFlags(CsrSizeRequestFlags &flags) { this->csrSizeRequestFlags = flags; }
|
||||||
GraphicsAllocation *getPreemptionCsrAllocation() { return this->preemptionCsrAllocation; }
|
GraphicsAllocation *getPreemptionCsrAllocation() const { return this->preemptionCsrAllocation; }
|
||||||
|
|
||||||
void makeResident(GraphicsAllocation &gfxAllocation) override {
|
void makeResident(GraphicsAllocation &gfxAllocation) override {
|
||||||
if (storeMakeResidentAllocations) {
|
if (storeMakeResidentAllocations) {
|
||||||
@@ -106,7 +107,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||||||
BaseClass::makeResident(gfxAllocation);
|
BaseClass::makeResident(gfxAllocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isMadeResident(GraphicsAllocation *graphicsAllocation) {
|
bool isMadeResident(GraphicsAllocation *graphicsAllocation) const {
|
||||||
return makeResidentAllocations.find(graphicsAllocation) != makeResidentAllocations.end();
|
return makeResidentAllocations.find(graphicsAllocation) != makeResidentAllocations.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "runtime/event/event.h"
|
#include "runtime/event/event.h"
|
||||||
#include "runtime/helpers/dispatch_info.h"
|
#include "runtime/helpers/dispatch_info.h"
|
||||||
#include "runtime/helpers/kernel_commands.h"
|
#include "runtime/helpers/kernel_commands.h"
|
||||||
#include "runtime/helpers/timestamp_packet.h"
|
|
||||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||||
#include "runtime/memory_manager/memory_constants.h"
|
#include "runtime/memory_manager/memory_constants.h"
|
||||||
#include "runtime/mem_obj/image.h"
|
#include "runtime/mem_obj/image.h"
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
#include "runtime/os_interface/os_interface.h"
|
#include "runtime/os_interface/os_interface.h"
|
||||||
#include "runtime/program/printf_handler.h"
|
#include "runtime/program/printf_handler.h"
|
||||||
#include "runtime/program/program.h"
|
#include "runtime/program/program.h"
|
||||||
#include "runtime/utilities/tag_allocator.h"
|
|
||||||
#include "unit_tests/fixtures/device_fixture.h"
|
#include "unit_tests/fixtures/device_fixture.h"
|
||||||
#include "unit_tests/fixtures/memory_allocator_fixture.h"
|
#include "unit_tests/fixtures/memory_allocator_fixture.h"
|
||||||
#include "unit_tests/fixtures/memory_manager_fixture.h"
|
#include "unit_tests/fixtures/memory_manager_fixture.h"
|
||||||
@@ -359,44 +357,6 @@ TEST_F(MemoryAllocatorTest, GivenPointerAndSizeWhenAskedToCreateGrahicsAllocatio
|
|||||||
delete allocation;
|
delete allocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MemoryAllocatorTest, getEventTsAllocator) {
|
|
||||||
TagAllocator<HwTimeStamps> *allocator = memoryManager->obtainEventTsAllocator(1);
|
|
||||||
EXPECT_NE(nullptr, allocator);
|
|
||||||
TagAllocator<HwTimeStamps> *allocator2 = memoryManager->obtainEventTsAllocator(1);
|
|
||||||
EXPECT_EQ(allocator2, allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryAllocatorTest, getEventPerfCountAllocator) {
|
|
||||||
TagAllocator<HwPerfCounter> *allocator = memoryManager->obtainEventPerfCountAllocator(1);
|
|
||||||
EXPECT_NE(nullptr, allocator);
|
|
||||||
TagAllocator<HwPerfCounter> *allocator2 = memoryManager->obtainEventPerfCountAllocator(1);
|
|
||||||
EXPECT_EQ(allocator2, allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryAllocatorTest, givenTimestampPacketAllocatorWhenAskingForTagThenReturnValidObject) {
|
|
||||||
ExecutionEnvironment executionEnvironment;
|
|
||||||
class MyMockMemoryManager : public OsAgnosticMemoryManager {
|
|
||||||
public:
|
|
||||||
using OsAgnosticMemoryManager::timestampPacketAllocator;
|
|
||||||
MyMockMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(false, false, executionEnvironment){};
|
|
||||||
} myMockMemoryManager(executionEnvironment);
|
|
||||||
|
|
||||||
EXPECT_EQ(nullptr, myMockMemoryManager.timestampPacketAllocator.get());
|
|
||||||
|
|
||||||
TagAllocator<TimestampPacket> *allocator = myMockMemoryManager.obtainTimestampPacketAllocator(1);
|
|
||||||
EXPECT_NE(nullptr, myMockMemoryManager.timestampPacketAllocator.get());
|
|
||||||
EXPECT_EQ(allocator, myMockMemoryManager.timestampPacketAllocator.get());
|
|
||||||
|
|
||||||
TagAllocator<TimestampPacket> *allocator2 = myMockMemoryManager.obtainTimestampPacketAllocator(1);
|
|
||||||
EXPECT_EQ(allocator, allocator2);
|
|
||||||
|
|
||||||
auto node1 = allocator->getTag();
|
|
||||||
auto node2 = allocator->getTag();
|
|
||||||
EXPECT_NE(nullptr, node1);
|
|
||||||
EXPECT_NE(nullptr, node2);
|
|
||||||
EXPECT_NE(node1, node2);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MemoryAllocatorTest, givenMemoryManagerWhensetForce32BitAllocationsIsCalledWithTrueMutlipleTimesThenAllocatorIsReused) {
|
TEST_F(MemoryAllocatorTest, givenMemoryManagerWhensetForce32BitAllocationsIsCalledWithTrueMutlipleTimesThenAllocatorIsReused) {
|
||||||
memoryManager->setForce32BitAllocations(true);
|
memoryManager->setForce32BitAllocations(true);
|
||||||
EXPECT_NE(nullptr, memoryManager->allocator32Bit.get());
|
EXPECT_NE(nullptr, memoryManager->allocator32Bit.get());
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class MockMemoryManager : public OsAgnosticMemoryManager {
|
|||||||
using MemoryManager::allocateGraphicsMemoryInPreferredPool;
|
using MemoryManager::allocateGraphicsMemoryInPreferredPool;
|
||||||
using MemoryManager::getAllocationData;
|
using MemoryManager::getAllocationData;
|
||||||
using MemoryManager::registeredOsContexts;
|
using MemoryManager::registeredOsContexts;
|
||||||
using MemoryManager::timestampPacketAllocator;
|
|
||||||
using OsAgnosticMemoryManager::OsAgnosticMemoryManager;
|
using OsAgnosticMemoryManager::OsAgnosticMemoryManager;
|
||||||
MockMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(false, false, executionEnvironment) {
|
MockMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(false, false, executionEnvironment) {
|
||||||
hostPtrManager.reset(new MockHostPtrManager);
|
hostPtrManager.reset(new MockHostPtrManager);
|
||||||
|
|||||||
@@ -678,12 +678,6 @@ TEST_F(DrmMemoryManagerTest, GivenMisalignedHostPtrAndMultiplePagesSizeWhenAsked
|
|||||||
EXPECT_EQ(0u, hostPtrManager->getFragmentCount());
|
EXPECT_EQ(0u, hostPtrManager->getFragmentCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, testProfilingAllocatorCleanup) {
|
|
||||||
MemoryManager *memMngr = memoryManager;
|
|
||||||
TagAllocator<HwTimeStamps> *allocator = memMngr->obtainEventTsAllocator(2);
|
|
||||||
EXPECT_NE(nullptr, allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedFor32BitAllocationThen32BitDrmAllocationIsBeingReturned) {
|
TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedFor32BitAllocationThen32BitDrmAllocationIsBeingReturned) {
|
||||||
mock->ioctl_expected.gemUserptr = 1;
|
mock->ioctl_expected.gemUserptr = 1;
|
||||||
mock->ioctl_expected.gemWait = 1;
|
mock->ioctl_expected.gemWait = 1;
|
||||||
|
|||||||
@@ -1432,7 +1432,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen
|
|||||||
std::unique_ptr<CommandStreamReceiver>(createCommandStream(*platformDevices, executionEnvironment));
|
std::unique_ptr<CommandStreamReceiver>(createCommandStream(*platformDevices, executionEnvironment));
|
||||||
executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(false, false, wddm.get(), executionEnvironment);
|
executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(false, false, wddm.get(), executionEnvironment);
|
||||||
EXPECT_EQ(executionEnvironment.commandStreamReceivers[0][0].get(), executionEnvironment.memoryManager->getCommandStreamReceiver(0));
|
EXPECT_EQ(executionEnvironment.commandStreamReceivers[0][0].get(), executionEnvironment.memoryManager->getCommandStreamReceiver(0));
|
||||||
auto tagAllocator = executionEnvironment.memoryManager->obtainEventPerfCountAllocator(1);
|
auto tagAllocator = executionEnvironment.commandStreamReceivers[0][0]->getEventPerfCountAllocator();
|
||||||
auto allocation = tagAllocator->getTag()->getGraphicsAllocation();
|
auto allocation = tagAllocator->getTag()->getGraphicsAllocation();
|
||||||
allocation->updateTaskCount(1, 0);
|
allocation->updateTaskCount(1, 0);
|
||||||
executionEnvironment.commandStreamReceivers.clear();
|
executionEnvironment.commandStreamReceivers.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user