Rename TimestampPacket to TimestampPacketStorage.

Related-To: NEO-2872

Change-Id: Id1f78491912c44890ae7ead2cac12ec8eb073628
Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
Piotr Fusik 2019-04-16 14:07:50 +02:00 committed by sys_ocldev
parent 62e2ca05e1
commit 745c20c78a
16 changed files with 75 additions and 83 deletions

View File

@ -444,7 +444,7 @@ void CommandQueueHw<GfxFamily>::processDispatchForCacheFlush(Surface **surfaces,
uint64_t postSyncAddress = 0;
if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacketNodeForPostSync = timestampPacketContainer->peekNodes().at(0);
postSyncAddress = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacketNodeForPostSync, TimestampPacket::DataIndex::ContextStart);
postSyncAddress = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacketNodeForPostSync, TimestampPacketStorage::DataIndex::ContextStart);
}
submitCacheFlush(surfaces, numSurfaces, commandStream, postSyncAddress);

View File

@ -191,8 +191,8 @@ class GpgpuWalkerHelper {
static void setupTimestampPacket(
LinearStream *cmdStream,
WALKER_TYPE<GfxFamily> *walkerCmd,
TagNode<TimestampPacket> *timestampPacketNode,
TimestampPacket::WriteOperationType writeOperationType);
TagNode<TimestampPacketStorage> *timestampPacketNode,
TimestampPacketStorage::WriteOperationType writeOperationType);
static void dispatchScheduler(
LinearStream &commandStream,

View File

@ -171,11 +171,11 @@ template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(
LinearStream *cmdStream,
WALKER_TYPE<GfxFamily> *walkerCmd,
TagNode<TimestampPacket> *timestampPacketNode,
TimestampPacket::WriteOperationType writeOperationType) {
TagNode<TimestampPacketStorage> *timestampPacketNode,
TimestampPacketStorage::WriteOperationType writeOperationType) {
if (TimestampPacket::WriteOperationType::AfterWalker == writeOperationType) {
uint64_t address = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacketNode, TimestampPacket::DataIndex::ContextEnd);
if (TimestampPacketStorage::WriteOperationType::AfterWalker == writeOperationType) {
uint64_t address = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacketNode, TimestampPacketStorage::DataIndex::ContextEnd);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(cmdStream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, 0, false);
}
}

View File

@ -19,7 +19,6 @@ class DispatchInfo;
class IndirectHeap;
class Kernel;
class LinearStream;
class TimestampPacket;
struct HwPerfCounter;
struct HwTimeStamps;
struct KernelOperation;

View File

@ -196,7 +196,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
if (commandQueue.getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacketNode = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex);
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(commandStream, nullptr, timestampPacketNode, TimestampPacket::WriteOperationType::BeforeWalker);
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(commandStream, nullptr, timestampPacketNode, TimestampPacketStorage::WriteOperationType::BeforeWalker);
}
programWalker(*commandStream, kernel, commandQueue, currentTimestampPacketNodes, *dsh, *ioh, *ssh, globalWorkSizes,

View File

@ -113,7 +113,7 @@ inline void HardwareInterface<GfxFamily>::programWalker(
if (currentTimestampPacketNodes && commandQueue.getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacketNode = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex);
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, walkerCmd, timestampPacketNode, TimestampPacket::WriteOperationType::AfterWalker);
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, walkerCmd, timestampPacketNode, TimestampPacketStorage::WriteOperationType::AfterWalker);
}
KernelCommandsHelper<GfxFamily>::sendIndirectState(

View File

@ -391,9 +391,9 @@ TagAllocator<HwPerfCounter> *CommandStreamReceiver::getEventPerfCountAllocator()
return perfCounterAllocator.get();
}
TagAllocator<TimestampPacket> *CommandStreamReceiver::getTimestampPacketAllocator() {
TagAllocator<TimestampPacketStorage> *CommandStreamReceiver::getTimestampPacketAllocator() {
if (timestampPacketAllocator.get() == nullptr) {
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacket>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
timestampPacketAllocator = std::make_unique<TagAllocator<TimestampPacketStorage>>(getMemoryManager(), getPreferredTagPoolSize(), MemoryConstants::cacheLineSize);
}
return timestampPacketAllocator.get();
}

View File

@ -37,9 +37,9 @@ class MemoryManager;
class OsContext;
class OSInterface;
class ScratchSpaceController;
class TimestampPacket;
struct HwPerfCounter;
struct HwTimeStamps;
struct TimestampPacketStorage;
template <typename T1>
class TagAllocator;
@ -167,7 +167,7 @@ class CommandStreamReceiver {
TagAllocator<HwTimeStamps> *getEventTsAllocator();
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
TagAllocator<TimestampPacket> *getTimestampPacketAllocator();
TagAllocator<TimestampPacketStorage> *getTimestampPacketAllocator();
virtual cl_int expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation);
@ -194,7 +194,7 @@ class CommandStreamReceiver {
std::unique_ptr<ScratchSpaceController> scratchSpaceController;
std::unique_ptr<TagAllocator<HwTimeStamps>> profilingTimeStampAllocator;
std::unique_ptr<TagAllocator<HwPerfCounter>> perfCounterAllocator;
std::unique_ptr<TagAllocator<TimestampPacket>> timestampPacketAllocator;
std::unique_ptr<TagAllocator<TimestampPacketStorage>> timestampPacketAllocator;
ResidencyContainer residencyAllocations;
ResidencyContainer evictionAllocations;

View File

@ -256,19 +256,19 @@ bool Event::calcProfilingData() {
if (timestampPacketContainer && timestampPacketContainer->peekNodes().size() > 0) {
const auto timestamps = timestampPacketContainer->peekNodes();
uint64_t contextStartTS = timestamps[0]->tagForCpuAccess->getData(TimestampPacket::DataIndex::ContextStart);
uint64_t contextEndTS = timestamps[0]->tagForCpuAccess->getData(TimestampPacket::DataIndex::ContextEnd);
uint64_t globalStartTS = timestamps[0]->tagForCpuAccess->getData(TimestampPacket::DataIndex::GlobalStart);
uint64_t contextStartTS = timestamps[0]->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::ContextStart);
uint64_t contextEndTS = timestamps[0]->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::ContextEnd);
uint64_t globalStartTS = timestamps[0]->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::GlobalStart);
for (const auto &timestamp : timestamps) {
if (timestamp->tagForCpuAccess->getData(TimestampPacket::DataIndex::ContextStart) < contextStartTS) {
contextStartTS = timestamp->tagForCpuAccess->getData(TimestampPacket::DataIndex::ContextStart);
if (timestamp->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::ContextStart) < contextStartTS) {
contextStartTS = timestamp->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::ContextStart);
}
if (timestamp->tagForCpuAccess->getData(TimestampPacket::DataIndex::ContextEnd) > contextEndTS) {
contextEndTS = timestamp->tagForCpuAccess->getData(TimestampPacket::DataIndex::ContextEnd);
if (timestamp->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::ContextEnd) > contextEndTS) {
contextEndTS = timestamp->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::ContextEnd);
}
if (timestamp->tagForCpuAccess->getData(TimestampPacket::DataIndex::GlobalStart) < globalStartTS) {
globalStartTS = timestamp->tagForCpuAccess->getData(TimestampPacket::DataIndex::GlobalStart);
if (timestamp->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::GlobalStart) < globalStartTS) {
globalStartTS = timestamp->tagForCpuAccess->getData(TimestampPacketStorage::DataIndex::GlobalStart);
}
}
calculateProfilingDataInternal(contextStartTS, contextEndTS, &contextEndTS, globalStartTS);

View File

@ -26,9 +26,8 @@ constexpr uint32_t preferedChunkCount = 16u;
}
#pragma pack(1)
class TimestampPacket {
public:
TimestampPacket() {
struct TimestampPacketStorage {
TimestampPacketStorage() {
initialize();
}
@ -71,12 +70,12 @@ class TimestampPacket {
};
#pragma pack()
static_assert(((static_cast<uint32_t>(TimestampPacket::DataIndex::Max) * TimestampPacketSizeControl::preferedChunkCount + 1) * sizeof(uint32_t)) == sizeof(TimestampPacket),
static_assert(((static_cast<uint32_t>(TimestampPacketStorage::DataIndex::Max) * TimestampPacketSizeControl::preferedChunkCount + 1) * sizeof(uint32_t)) == sizeof(TimestampPacketStorage),
"This structure is consumed by GPU and has to follow specific restrictions for padding and size");
class TimestampPacketContainer : public NonCopyableOrMovableClass {
public:
using Node = TagNode<TimestampPacket>;
using Node = TagNode<TimestampPacketStorage>;
TimestampPacketContainer() = default;
MOCKABLE_VIRTUAL ~TimestampPacketContainer();
@ -93,10 +92,10 @@ class TimestampPacketContainer : public NonCopyableOrMovableClass {
struct TimestampPacketHelper {
template <typename GfxFamily>
static void programSemaphoreWithImplicitDependency(LinearStream &cmdStream, TagNode<TimestampPacket> &timestampPacketNode) {
static void programSemaphoreWithImplicitDependency(LinearStream &cmdStream, TagNode<TimestampPacketStorage> &timestampPacketNode) {
using MI_ATOMIC = typename GfxFamily::MI_ATOMIC;
auto compareAddress = getGpuAddressForDataWrite(timestampPacketNode, TimestampPacket::DataIndex::ContextEnd);
auto dependenciesCountAddress = timestampPacketNode.getGpuAddress() + offsetof(TimestampPacket, implicitDependenciesCount);
auto compareAddress = getGpuAddressForDataWrite(timestampPacketNode, TimestampPacketStorage::DataIndex::ContextEnd);
auto dependenciesCountAddress = timestampPacketNode.getGpuAddress() + offsetof(TimestampPacketStorage, implicitDependenciesCount);
KernelCommandsHelper<GfxFamily>::programMiSemaphoreWait(cmdStream, compareAddress, 1);
@ -107,7 +106,7 @@ struct TimestampPacketHelper {
MI_ATOMIC::DATA_SIZE::DATA_SIZE_DWORD);
}
static uint64_t getGpuAddressForDataWrite(TagNode<TimestampPacket> &timestampPacketNodes, TimestampPacket::DataIndex dataIndex) {
static uint64_t getGpuAddressForDataWrite(TagNode<TimestampPacketStorage> &timestampPacketNodes, TimestampPacketStorage::DataIndex dataIndex) {
auto offset = static_cast<uint32_t>(dataIndex) * sizeof(uint32_t);
return timestampPacketNodes.getGpuAddress() + offset;
}

View File

@ -54,13 +54,13 @@ HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolve
expectMemory<FamilyType>(reinterpret_cast<void *>(buffer->getGraphicsAllocation()->getGpuAddress()), writePattern2, bufferSize);
uint32_t expectedDepsCount = 0;
auto dependenciesGpuAddress = node1->getGpuAddress() + offsetof(TimestampPacket, implicitDependenciesCount);
auto dependenciesGpuAddress = node1->getGpuAddress() + offsetof(TimestampPacketStorage, implicitDependenciesCount);
expectMemory<FamilyType>(reinterpret_cast<void *>(dependenciesGpuAddress),
&expectedDepsCount, sizeof(uint32_t));
uint32_t expectedEndTimestamp[2] = {0, 0};
auto endTimestampAddress1 = TimestampPacketHelper::getGpuAddressForDataWrite(*node1, TimestampPacket::DataIndex::ContextEnd);
auto endTimestampAddress2 = TimestampPacketHelper::getGpuAddressForDataWrite(*node2, TimestampPacket::DataIndex::ContextEnd);
auto endTimestampAddress1 = TimestampPacketHelper::getGpuAddressForDataWrite(*node1, TimestampPacketStorage::DataIndex::ContextEnd);
auto endTimestampAddress2 = TimestampPacketHelper::getGpuAddressForDataWrite(*node2, TimestampPacketStorage::DataIndex::ContextEnd);
expectMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress1), expectedEndTimestamp, 2 * sizeof(uint32_t));
expectMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress2), expectedEndTimestamp, 2 * sizeof(uint32_t));
@ -86,8 +86,8 @@ HWTEST_F(TimestampPacketAubTests, givenMultipleWalkersWhenEnqueueingThenWriteAll
EXPECT_EQ(2u, timestampNodes.size());
uint32_t expectedEndTimestamp[2] = {0, 0};
auto endTimestampAddress1 = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampNodes.at(0), TimestampPacket::DataIndex::ContextEnd);
auto endTimestampAddress2 = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampNodes.at(1), TimestampPacket::DataIndex::ContextEnd);
auto endTimestampAddress1 = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampNodes.at(0), TimestampPacketStorage::DataIndex::ContextEnd);
auto endTimestampAddress2 = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampNodes.at(1), TimestampPacketStorage::DataIndex::ContextEnd);
expectMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress1), expectedEndTimestamp, 2 * sizeof(uint32_t));
expectMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress2), expectedEndTimestamp, 2 * sizeof(uint32_t));

View File

@ -311,11 +311,11 @@ HWTEST_F(CommandStreamReceiverTest, givenTimestampPacketAllocatorWhenAskingForTa
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_EQ(nullptr, csr.timestampPacketAllocator.get());
TagAllocator<TimestampPacket> *allocator = csr.getTimestampPacketAllocator();
TagAllocator<TimestampPacketStorage> *allocator = csr.getTimestampPacketAllocator();
EXPECT_NE(nullptr, csr.timestampPacketAllocator.get());
EXPECT_EQ(allocator, csr.timestampPacketAllocator.get());
TagAllocator<TimestampPacket> *allocator2 = csr.getTimestampPacketAllocator();
TagAllocator<TimestampPacketStorage> *allocator2 = csr.getTimestampPacketAllocator();
EXPECT_EQ(allocator, allocator2);
auto node1 = allocator->getTag();

View File

@ -30,13 +30,7 @@
using namespace NEO;
struct TimestampPacketSimpleTests : public ::testing::Test {
class MockTimestampPacket : public TimestampPacket {
public:
using TimestampPacket::data;
using TimestampPacket::implicitDependenciesCount;
};
void setTagToReadyState(TagNode<TimestampPacket> *tagNode) {
void setTagToReadyState(TagNode<TimestampPacketStorage> *tagNode) {
auto &data = tagNode->tagForCpuAccess->data;
std::fill(data.begin(), data.end(), 0u);
tagNode->tagForCpuAccess->implicitDependenciesCount.store(0);
@ -60,23 +54,23 @@ struct TimestampPacketTests : public TimestampPacketSimpleTests {
}
template <typename MI_SEMAPHORE_WAIT>
void verifySemaphore(MI_SEMAPHORE_WAIT *semaphoreCmd, TagNode<TimestampPacket> *timestampPacketNode) {
void verifySemaphore(MI_SEMAPHORE_WAIT *semaphoreCmd, TagNode<TimestampPacketStorage> *timestampPacketNode) {
EXPECT_NE(nullptr, semaphoreCmd);
EXPECT_EQ(semaphoreCmd->getCompareOperation(), MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD);
EXPECT_EQ(1u, semaphoreCmd->getSemaphoreDataDword());
auto dataAddress = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacketNode, TimestampPacket::DataIndex::ContextEnd);
auto dataAddress = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacketNode, TimestampPacketStorage::DataIndex::ContextEnd);
EXPECT_EQ(dataAddress, semaphoreCmd->getSemaphoreGraphicsAddress());
};
template <typename MI_ATOMIC>
void verifyMiAtomic(MI_ATOMIC *miAtomicCmd, TagNode<TimestampPacket> *timestampPacketNode) {
void verifyMiAtomic(MI_ATOMIC *miAtomicCmd, TagNode<TimestampPacketStorage> *timestampPacketNode) {
EXPECT_NE(nullptr, miAtomicCmd);
auto writeAddress = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacket, implicitDependenciesCount);
auto writeAddress = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacketStorage, implicitDependenciesCount);
EXPECT_EQ(MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_4B_DECREMENT, miAtomicCmd->getAtomicOpcode());
EXPECT_EQ(static_cast<uint32_t>(writeAddress & 0x0000FFFFFFFFULL), miAtomicCmd->getMemoryAddress());
EXPECT_EQ(static_cast<uint32_t>(writeAddress), miAtomicCmd->getMemoryAddress());
EXPECT_EQ(static_cast<uint32_t>(writeAddress >> 32), miAtomicCmd->getMemoryAddressHigh());
};
@ -99,11 +93,11 @@ HWTEST_F(TimestampPacketTests, givenTagNodeWhenSemaphoreAndAtomicAreProgrammedTh
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
using MI_ATOMIC = typename FamilyType::MI_ATOMIC;
struct MockTagNode : public TagNode<TimestampPacket> {
using TagNode<TimestampPacket>::gpuAddress;
struct MockTagNode : public TagNode<TimestampPacketStorage> {
using TagNode<TimestampPacketStorage>::gpuAddress;
};
TimestampPacket tag;
TimestampPacketStorage tag;
MockTagNode mockNode;
mockNode.tagForCpuAccess = &tag;
mockNode.gpuAddress = 0x1230000;
@ -120,9 +114,9 @@ HWTEST_F(TimestampPacketTests, givenTagNodeWhenSemaphoreAndAtomicAreProgrammedTh
}
TEST_F(TimestampPacketSimpleTests, whenEndTagIsNotOneThenCanBeReleased) {
MockTimestampPacket timestampPacket;
auto contextEndIndex = static_cast<uint32_t>(TimestampPacket::DataIndex::ContextEnd);
auto globalEndIndex = static_cast<uint32_t>(TimestampPacket::DataIndex::GlobalEnd);
TimestampPacketStorage timestampPacket;
auto contextEndIndex = static_cast<uint32_t>(TimestampPacketStorage::DataIndex::ContextEnd);
auto globalEndIndex = static_cast<uint32_t>(TimestampPacketStorage::DataIndex::GlobalEnd);
timestampPacket.data[contextEndIndex] = 1;
timestampPacket.data[globalEndIndex] = 1;
@ -142,9 +136,9 @@ TEST_F(TimestampPacketSimpleTests, whenEndTagIsNotOneThenCanBeReleased) {
}
TEST_F(TimestampPacketSimpleTests, givenImplicitDependencyWhenEndTagIsWrittenThenCantBeReleased) {
MockTimestampPacket timestampPacket;
auto contextEndIndex = static_cast<uint32_t>(TimestampPacket::DataIndex::ContextEnd);
auto globalEndIndex = static_cast<uint32_t>(TimestampPacket::DataIndex::GlobalEnd);
TimestampPacketStorage timestampPacket;
auto contextEndIndex = static_cast<uint32_t>(TimestampPacketStorage::DataIndex::ContextEnd);
auto globalEndIndex = static_cast<uint32_t>(TimestampPacketStorage::DataIndex::GlobalEnd);
timestampPacket.data[contextEndIndex] = 0;
timestampPacket.data[globalEndIndex] = 0;
@ -157,10 +151,10 @@ TEST_F(TimestampPacketSimpleTests, givenImplicitDependencyWhenEndTagIsWrittenThe
TEST_F(TimestampPacketSimpleTests, whenNewTagIsTakenThenReinitialize) {
MockExecutionEnvironment executionEnvironment(*platformDevices);
MockMemoryManager memoryManager(executionEnvironment);
MockTagAllocator<TimestampPacket> allocator(&memoryManager, 1);
MockTagAllocator<TimestampPacketStorage> allocator(&memoryManager, 1);
auto firstNode = allocator.getTag();
for (uint32_t i = 0; i < static_cast<uint32_t>(TimestampPacket::DataIndex::Max) * TimestampPacketSizeControl::preferedChunkCount; i++) {
for (uint32_t i = 0; i < static_cast<uint32_t>(TimestampPacketStorage::DataIndex::Max) * TimestampPacketSizeControl::preferedChunkCount; i++) {
auto dataAccess = reinterpret_cast<uint32_t *>(ptrOffset(firstNode->tagForCpuAccess, i * sizeof(uint32_t)));
*dataAccess = i;
}
@ -175,15 +169,15 @@ TEST_F(TimestampPacketSimpleTests, whenNewTagIsTakenThenReinitialize) {
EXPECT_EQ(secondNode, firstNode);
EXPECT_EQ(0u, dependenciesCount.load());
for (uint32_t i = 0; i < static_cast<uint32_t>(TimestampPacket::DataIndex::Max) * TimestampPacketSizeControl::preferedChunkCount; i++) {
for (uint32_t i = 0; i < static_cast<uint32_t>(TimestampPacketStorage::DataIndex::Max) * TimestampPacketSizeControl::preferedChunkCount; i++) {
auto dataAccess = reinterpret_cast<uint32_t *>(ptrOffset(firstNode->tagForCpuAccess, i * sizeof(uint32_t)));
EXPECT_EQ(1u, *dataAccess);
}
}
TEST_F(TimestampPacketSimpleTests, whenObjectIsCreatedThenInitializeAllStamps) {
MockTimestampPacket timestampPacket;
auto entityElements = static_cast<uint32_t>(TimestampPacket::DataIndex::Max);
TimestampPacketStorage timestampPacket;
auto entityElements = static_cast<uint32_t>(TimestampPacketStorage::DataIndex::Max);
auto allElements = entityElements * TimestampPacketSizeControl::preferedChunkCount;
EXPECT_EQ(4u, entityElements);
EXPECT_EQ(64u, allElements);
@ -198,13 +192,13 @@ TEST_F(TimestampPacketSimpleTests, whenObjectIsCreatedThenInitializeAllStamps) {
TEST_F(TimestampPacketSimpleTests, whenAskedForStampAddressThenReturnWithValidOffset) {
MockExecutionEnvironment executionEnvironment(*platformDevices);
MockMemoryManager memoryManager(executionEnvironment);
MockTagAllocator<TimestampPacket> allocator(&memoryManager, 1);
MockTagAllocator<TimestampPacketStorage> allocator(&memoryManager, 1);
auto node = allocator.getTag();
auto tag = node->tagForCpuAccess;
for (size_t i = 0; i < static_cast<uint32_t>(TimestampPacket::DataIndex::Max); i++) {
auto dataIndex = static_cast<TimestampPacket::DataIndex>(i);
for (size_t i = 0; i < static_cast<uint32_t>(TimestampPacketStorage::DataIndex::Max); i++) {
auto dataIndex = static_cast<TimestampPacketStorage::DataIndex>(i);
auto address = TimestampPacketHelper::getGpuAddressForDataWrite(*node, dataIndex);
EXPECT_EQ(address, reinterpret_cast<uint64_t>(ptrOffset(tag, i * sizeof(uint32_t))));
@ -409,7 +403,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispat
if (genCmdCast<GPGPU_WALKER *>(*it)) {
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*++it);
EXPECT_NE(nullptr, pipeControl);
auto dataAddress = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacket.getNode(walkersFound), TimestampPacket::DataIndex::ContextEnd);
auto dataAddress = TimestampPacketHelper::getGpuAddressForDataWrite(*timestampPacket.getNode(walkersFound), TimestampPacketStorage::DataIndex::ContextEnd);
verifyPipeControl(pipeControl, dataAddress);
walkersFound++;
@ -1110,7 +1104,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingToOoqThenDo
}
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) {
TagAllocator<TimestampPacket> tagAllocator(executionEnvironment->memoryManager.get(), 1, 1);
TagAllocator<TimestampPacketStorage> tagAllocator(executionEnvironment->memoryManager.get(), 1, 1);
auto device2 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr, executionEnvironment, 1u));
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
@ -1145,7 +1139,7 @@ HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueu
}
HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentCSRsWhenEnqueueingThenMakeAllTimestampsResident) {
TagAllocator<TimestampPacket> tagAllocator(executionEnvironment->memoryManager.get(), 1, 1);
TagAllocator<TimestampPacketStorage> tagAllocator(executionEnvironment->memoryManager.get(), 1, 1);
auto &ultCsr = device->getUltCommandStreamReceiver<FamilyType>();
ultCsr.timestampPacketWriteEnabled = true;
@ -1251,7 +1245,7 @@ HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingWithoutK
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(context, device.get(), nullptr));
MockKernelWithInternals mockKernel(*device, context);
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 TimestampPacketStorage
TimestampPacketContainer cmdQNodes;
cmdQNodes.assignAndIncrementNodesRefCounts(*cmdQ->timestampPacketContainer);
@ -1310,7 +1304,7 @@ HWTEST_F(TimestampPacketTests, whenEnqueueingBarrierThenRequestPipeControlOnCsrF
MockCommandQueueHw<FamilyType> cmdQ(context, device.get(), nullptr);
MockKernelWithInternals mockKernel(*device, context);
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 TimestampPacketStorage
TimestampPacketContainer cmdQNodes;
cmdQNodes.assignAndIncrementNodesRefCounts(*cmdQ.timestampPacketContainer);

View File

@ -10,7 +10,7 @@
namespace NEO {
template <typename TagType = TimestampPacket>
template <typename TagType = TimestampPacketStorage>
class MockTagAllocator : public TagAllocator<TagType> {
public:
using BaseClass = TagAllocator<TagType>;
@ -38,13 +38,13 @@ class MockTimestampPacketContainer : public TimestampPacketContainer {
public:
using TimestampPacketContainer::timestampPacketNodes;
MockTimestampPacketContainer(TagAllocator<TimestampPacket> &tagAllocator, size_t numberOfPreallocatedTags) {
MockTimestampPacketContainer(TagAllocator<TimestampPacketStorage> &tagAllocator, size_t numberOfPreallocatedTags) {
for (size_t i = 0; i < numberOfPreallocatedTags; i++) {
add(tagAllocator.getTag());
}
}
TagNode<TimestampPacket> *getNode(size_t position) {
TagNode<TimestampPacketStorage> *getNode(size_t position) {
return timestampPacketNodes.at(position);
}
};

View File

@ -877,16 +877,16 @@ struct ProfilingTimestampPacketsTest : public ::testing::Test {
}
void addTimestampNode(int contextStart, int contextEnd, int globalStart) {
auto node = new MockTagNode<TimestampPacket>();
auto timestampPacket = new TimestampPacket();
auto node = new MockTagNode<TimestampPacketStorage>();
auto timestampPacket = new TimestampPacketStorage();
node->tagForCpuAccess = timestampPacket;
*reinterpret_cast<uint32_t *>(ptrOffset(timestampPacket,
sizeof(uint32_t) * static_cast<uint32_t>(TimestampPacket::DataIndex::ContextStart))) = contextStart;
sizeof(uint32_t) * static_cast<uint32_t>(TimestampPacketStorage::DataIndex::ContextStart))) = contextStart;
*reinterpret_cast<uint32_t *>(ptrOffset(timestampPacket,
sizeof(uint32_t) * static_cast<uint32_t>(TimestampPacket::DataIndex::ContextEnd))) = contextEnd;
sizeof(uint32_t) * static_cast<uint32_t>(TimestampPacketStorage::DataIndex::ContextEnd))) = contextEnd;
*reinterpret_cast<uint32_t *>(ptrOffset(timestampPacket,
sizeof(uint32_t) * static_cast<uint32_t>(TimestampPacket::DataIndex::GlobalStart))) = globalStart;
sizeof(uint32_t) * static_cast<uint32_t>(TimestampPacketStorage::DataIndex::GlobalStart))) = globalStart;
ev->timestampPacketContainer->add(node);
}

View File

@ -342,7 +342,7 @@ TEST_F(TagAllocatorTest, givenTagsOnDeferredListWhenReleasingItThenMoveReadyTags
}
TEST_F(TagAllocatorTest, givenTagAllocatorWhenGraphicsAllocationIsCreatedThenSetValidllocationType) {
TagAllocator<TimestampPacket> timestampPacketAllocator(memoryManager, 1, 1);
TagAllocator<TimestampPacketStorage> timestampPacketAllocator(memoryManager, 1, 1);
TagAllocator<HwTimeStamps> hwTimeStampsAllocator(memoryManager, 1, 1);
TagAllocator<HwPerfCounter> hwPerfCounterAllocator(memoryManager, 1, 1);