Initial implementation of Timestamp Packet write

Change-Id: Ic498bcf9795f54fbb5fb5a8d07ed17fa70dc4f1a
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-08-24 08:48:59 +02:00
committed by sys_ocldev
parent 02b8055897
commit a807b9a90b
32 changed files with 429 additions and 95 deletions

View File

@@ -30,6 +30,7 @@
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/basic_math.h"
#include "runtime/helpers/options.h"
#include "runtime/helpers/timestamp_packet.h"
#include "runtime/memory_manager/deferred_deleter.h"
#include "runtime/utilities/stackvec.h"
#include "runtime/utilities/tag_allocator.h"
@@ -37,8 +38,7 @@
#include <algorithm>
namespace OCLRT {
constexpr size_t ProfilingTagCount = 512;
constexpr size_t PerfCounterTagCount = 512;
constexpr size_t TagCount = 512;
struct ReusableAllocationRequirements {
size_t requiredMinimalSize;
@@ -226,11 +226,16 @@ void MemoryManager::applyCommonCleanup() {
if (this->paddingAllocation) {
this->freeGraphicsMemory(this->paddingAllocation);
}
if (profilingTimeStampAllocator)
if (profilingTimeStampAllocator) {
profilingTimeStampAllocator->cleanUpResources();
if (perfCounterAllocator)
}
if (perfCounterAllocator) {
perfCounterAllocator->cleanUpResources();
}
if (timestampPacketAllocator) {
timestampPacketAllocator->cleanUpResources();
}
cleanAllocationList(-1, TEMPORARY_ALLOCATION);
cleanAllocationList(-1, REUSABLE_ALLOCATION);
@@ -263,18 +268,25 @@ void MemoryManager::freeAllocationsList(uint32_t waitTaskCount, AllocationsList
TagAllocator<HwTimeStamps> *MemoryManager::getEventTsAllocator() {
if (profilingTimeStampAllocator.get() == nullptr) {
profilingTimeStampAllocator.reset(new TagAllocator<HwTimeStamps>(this, ProfilingTagCount, MemoryConstants::cacheLineSize));
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(this, TagCount, MemoryConstants::cacheLineSize);
}
return profilingTimeStampAllocator.get();
}
TagAllocator<HwPerfCounter> *MemoryManager::getEventPerfCountAllocator() {
if (perfCounterAllocator.get() == nullptr) {
perfCounterAllocator.reset(new TagAllocator<HwPerfCounter>(this, PerfCounterTagCount, MemoryConstants::cacheLineSize));
perfCounterAllocator = std::make_unique<TagAllocator<HwPerfCounter>>(this, TagCount, MemoryConstants::cacheLineSize);
}
return perfCounterAllocator.get();
}
TagAllocator<TimestampPacket> *MemoryManager::getTimestampPacketAllocator() {
if (timestampPacketAllocator.get() == nullptr) {
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacket>>(this, TagCount, MemoryConstants::cacheLineSize);
}
return timestampPacketAllocator.get();
}
void MemoryManager::pushAllocationForResidency(GraphicsAllocation *gfxAllocation) {
residencyAllocations.push_back(gfxAllocation);
}

View File

@@ -36,6 +36,7 @@ class Device;
class DeferredDeleter;
class GraphicsAllocation;
class CommandStreamReceiver;
class TimestampPacket;
struct HwPerfCounter;
struct HwTimeStamps;
@@ -192,6 +193,7 @@ class MemoryManager {
TagAllocator<HwTimeStamps> *getEventTsAllocator();
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
TagAllocator<TimestampPacket> *getTimestampPacketAllocator();
std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, bool isInternalAllocationRequired);
@@ -255,6 +257,7 @@ class MemoryManager {
std::recursive_mutex mtx;
std::unique_ptr<TagAllocator<HwTimeStamps>> profilingTimeStampAllocator;
std::unique_ptr<TagAllocator<HwPerfCounter>> perfCounterAllocator;
std::unique_ptr<TagAllocator<TimestampPacket>> timestampPacketAllocator;
bool force32bitAllocations = false;
bool virtualPaddingAvailable = false;
GraphicsAllocation *paddingAllocation = nullptr;