Minor cleanup.
Change-Id: I0f345c4fbf49f6464dce7bafd8b8d59347ff2d77 Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
parent
148774ee7a
commit
92584d8c64
|
@ -181,16 +181,13 @@ class GpgpuWalkerHelper {
|
|||
uint32_t registerAddress);
|
||||
|
||||
static void dispatchPerfCountersGeneralPurposeCounterCommands(
|
||||
CommandQueue &commandQueue,
|
||||
TagNode<HwPerfCounter> &hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
bool start);
|
||||
uint64_t baseAddress);
|
||||
|
||||
static void dispatchPerfCountersUserCounterCommands(
|
||||
CommandQueue &commandQueue,
|
||||
TagNode<HwPerfCounter> &hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
bool start);
|
||||
uint64_t baseAddress);
|
||||
|
||||
static void dispatchPerfCountersOABufferStateCommands(
|
||||
TagNode<HwPerfCounter> &hwPerfCounter,
|
||||
|
|
|
@ -165,14 +165,8 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchStoreRegisterCommand(
|
|||
|
||||
template <typename GfxFamily>
|
||||
void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersGeneralPurposeCounterCommands(
|
||||
CommandQueue &commandQueue,
|
||||
TagNode<HwPerfCounter> &hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
bool start) {
|
||||
|
||||
uint64_t baseAddress = hwPerfCounter.getGpuAddress();
|
||||
baseAddress += start ? offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportBegin.Gp)
|
||||
: offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportEnd.Gp);
|
||||
uint64_t baseAddress) {
|
||||
|
||||
// Read General Purpose counters
|
||||
for (auto i = 0u; i < NEO::INSTR_GENERAL_PURPOSE_COUNTERS_COUNT; i++) {
|
||||
|
@ -186,19 +180,15 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersGeneralPurposeCounterComm
|
|||
template <typename GfxFamily>
|
||||
void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersUserCounterCommands(
|
||||
CommandQueue &commandQueue,
|
||||
TagNode<HwPerfCounter> &hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
bool start) {
|
||||
uint64_t baseAddress) {
|
||||
|
||||
uint64_t baseAddr = hwPerfCounter.getGpuAddress();
|
||||
baseAddr += start ? offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportBegin.User)
|
||||
: offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportEnd.User);
|
||||
auto userRegs = &commandQueue.getPerfCountersConfigData()->ReadRegs;
|
||||
|
||||
for (uint32_t i = 0; i < userRegs->RegsCount; i++) {
|
||||
uint32_t regAddr = userRegs->Reg[i].Offset;
|
||||
//offset between base (low) registers is cl_ulong wide
|
||||
uint64_t address = baseAddr + i * sizeof(cl_ulong);
|
||||
uint64_t address = baseAddress + i * sizeof(cl_ulong);
|
||||
dispatchStoreRegisterCommand(commandStream, address, regAddr);
|
||||
|
||||
if (userRegs->Reg[i].BitSize > 32) {
|
||||
|
@ -240,7 +230,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(
|
|||
//Read Core Frequency
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchStoreRegisterCommand(commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.CoreFreqBegin), INSTR_MMIO_RPSTAT1);
|
||||
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersGeneralPurposeCounterCommands(commandQueue, hwPerfCounter, commandStream, true);
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersGeneralPurposeCounterCommands(commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportBegin.Gp));
|
||||
|
||||
auto pReportPerfCount = commandStream->getSpaceForCmd<MI_REPORT_PERF_COUNT>();
|
||||
*pReportPerfCount = GfxFamily::cmdInitReportPerfCount;
|
||||
|
@ -252,7 +242,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(
|
|||
|
||||
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(commandStream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, address, 0llu, false);
|
||||
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersUserCounterCommands(commandQueue, hwPerfCounter, commandStream, true);
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersUserCounterCommands(commandQueue, commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportBegin.User));
|
||||
|
||||
commandQueue.sendPerfCountersConfig();
|
||||
}
|
||||
|
@ -286,7 +276,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(
|
|||
address = hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportEnd.Oa);
|
||||
pReportPerfCount->setMemoryAddress(address);
|
||||
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersGeneralPurposeCounterCommands(commandQueue, hwPerfCounter, commandStream, false);
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersGeneralPurposeCounterCommands(commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportEnd.Gp));
|
||||
|
||||
//Store value of NOOPID register
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchStoreRegisterCommand(commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.DMAFenceIdEnd), INSTR_MMIO_NOOPID);
|
||||
|
@ -294,7 +284,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(
|
|||
//Read Core Frequency
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchStoreRegisterCommand(commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.CoreFreqEnd), INSTR_MMIO_RPSTAT1);
|
||||
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersUserCounterCommands(commandQueue, hwPerfCounter, commandStream, false);
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersUserCounterCommands(commandQueue, commandStream, hwPerfCounter.getGpuAddress() + offsetof(HwPerfCounter, HWPerfCounters.HwPerfReportEnd.User));
|
||||
|
||||
perfCounters->setCpuTimestamp();
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace NEO {
|
|||
template <typename GfxFamily>
|
||||
void ExperimentalCommandBuffer::injectBufferStart(LinearStream &parentStream, size_t cmdBufferOffset) {
|
||||
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
|
||||
auto pCmd = static_cast<MI_BATCH_BUFFER_START *>(parentStream.getSpace(sizeof(MI_BATCH_BUFFER_START)));
|
||||
auto commandStreamReceiverHw = reinterpret_cast<CommandStreamReceiverHw<GfxFamily> *>(commandStreamReceiver);
|
||||
auto pCmd = parentStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
|
||||
auto commandStreamReceiverHw = static_cast<CommandStreamReceiverHw<GfxFamily> *>(commandStreamReceiver);
|
||||
commandStreamReceiverHw->addBatchBufferStart(pCmd, currentStream->getGraphicsAllocation()->getGpuAddress() + cmdBufferOffset, true);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ size_t ExperimentalCommandBuffer::programExperimentalCommandBuffer() {
|
|||
addTimeStampPipeControl<GfxFamily>();
|
||||
|
||||
//end
|
||||
auto pCmd = static_cast<MI_BATCH_BUFFER_END *>(currentStream->getSpace(sizeof(MI_BATCH_BUFFER_END)));
|
||||
auto pCmd = currentStream->getSpaceForCmd<MI_BATCH_BUFFER_END>();
|
||||
*pCmd = GfxFamily::cmdInitBatchBufferEnd;
|
||||
|
||||
return returnOffset;
|
||||
|
@ -70,7 +70,7 @@ template <typename GfxFamily>
|
|||
void ExperimentalCommandBuffer::addTimeStampPipeControl() {
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
|
||||
auto pCmd = static_cast<PIPE_CONTROL *>(currentStream->getSpace(sizeof(PIPE_CONTROL)));
|
||||
auto pCmd = currentStream->getSpaceForCmd<PIPE_CONTROL>();
|
||||
*pCmd = GfxFamily::cmdInitPipeControl;
|
||||
pCmd->setCommandStreamerStallEnable(true);
|
||||
|
||||
|
@ -88,12 +88,11 @@ template <typename GfxFamily>
|
|||
void ExperimentalCommandBuffer::addExperimentalCommands() {
|
||||
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
||||
|
||||
uintptr_t semaphoreAddr = reinterpret_cast<uintptr_t>(experimentalAllocation->getUnderlyingBuffer()) + experimentalAllocationOffset;
|
||||
uint32_t *semaphoreData = reinterpret_cast<uint32_t *>(semaphoreAddr);
|
||||
uint32_t *semaphoreData = reinterpret_cast<uint32_t *>(ptrOffset(experimentalAllocation->getUnderlyingBuffer(), experimentalAllocationOffset));
|
||||
*semaphoreData = 1;
|
||||
uint64_t gpuAddr = experimentalAllocation->getGpuAddress() + experimentalAllocationOffset;
|
||||
|
||||
auto semaphoreCmd = reinterpret_cast<MI_SEMAPHORE_WAIT *>(currentStream->getSpace(sizeof(MI_SEMAPHORE_WAIT)));
|
||||
auto semaphoreCmd = currentStream->getSpaceForCmd<MI_SEMAPHORE_WAIT>();
|
||||
*semaphoreCmd = GfxFamily::cmdInitMiSemaphoreWait;
|
||||
semaphoreCmd->setCompareOperation(MI_SEMAPHORE_WAIT::COMPARE_OPERATION_SAD_EQUAL_SDD);
|
||||
semaphoreCmd->setSemaphoreDataDword(*semaphoreData);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include <mutex>
|
||||
|
||||
namespace NEO {
|
||||
class CommandStreamReceiver;
|
||||
class Device;
|
||||
class GraphicsAllocation;
|
||||
class CommandStreamReceiver;
|
||||
class MemoryManager;
|
||||
|
||||
struct SvmAllocationData {
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace NEO {
|
|||
|
||||
class DeviceFactory;
|
||||
struct HardwareInfo;
|
||||
struct FeatureTable;
|
||||
|
||||
struct DeviceDescriptor {
|
||||
unsigned short deviceId;
|
||||
|
|
|
@ -41,12 +41,12 @@ class AUBCommandStreamFixture : public CommandStreamFixture {
|
|||
void expectMMIO(uint32_t mmioRegister, uint32_t expectedValue) {
|
||||
CommandStreamReceiver *csr = pCommandStreamReceiver;
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
csr = reinterpret_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
|
||||
csr = static_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
|
||||
}
|
||||
|
||||
if (csr) {
|
||||
// Write our pseudo-op to the AUB file
|
||||
auto aubCsr = reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(csr);
|
||||
auto aubCsr = static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(csr);
|
||||
aubCsr->expectMMIO(mmioRegister, expectedValue);
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ class AUBCommandStreamFixture : public CommandStreamFixture {
|
|||
void expectMemory(void *gfxAddress, const void *srcAddress, size_t length) {
|
||||
CommandStreamReceiver *csr = pCommandStreamReceiver;
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
auto tbxCsr = reinterpret_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
|
||||
auto tbxCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
|
||||
tbxCsr->expectMemoryEqual(gfxAddress, srcAddress, length);
|
||||
|
||||
csr = reinterpret_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
|
||||
csr = static_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
|
||||
}
|
||||
|
||||
if (csr) {
|
||||
auto aubCsr = reinterpret_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
|
||||
auto aubCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
|
||||
aubCsr->expectMemoryEqual(gfxAddress, srcAddress, length);
|
||||
}
|
||||
}
|
||||
|
@ -71,21 +71,21 @@ class AUBCommandStreamFixture : public CommandStreamFixture {
|
|||
void expectMemoryNotEqual(void *gfxAddress, const void *srcAddress, size_t length) {
|
||||
CommandStreamReceiver *csr = pCommandStreamReceiver;
|
||||
if (testMode == TestMode::AubTestsWithTbx) {
|
||||
auto tbxCsr = reinterpret_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
|
||||
auto tbxCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
|
||||
tbxCsr->expectMemoryNotEqual(gfxAddress, srcAddress, length);
|
||||
|
||||
csr = reinterpret_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
|
||||
csr = static_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
|
||||
}
|
||||
|
||||
if (csr) {
|
||||
auto aubCsr = reinterpret_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
|
||||
auto aubCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
|
||||
aubCsr->expectMemoryNotEqual(gfxAddress, srcAddress, length);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr() {
|
||||
return reinterpret_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
|
||||
CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr() const {
|
||||
return static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
|
|
|
@ -56,10 +56,8 @@ class AUBFixture : public CommandQueueHwFixture {
|
|||
GraphicsAllocation *createHostPtrAllocationFromSvmPtr(void *svmPtr, size_t size);
|
||||
|
||||
template <typename FamilyType>
|
||||
CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr() {
|
||||
CommandStreamReceiverSimulatedCommonHw<FamilyType> *simulatedCsr = nullptr;
|
||||
simulatedCsr = reinterpret_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
|
||||
return simulatedCsr;
|
||||
CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr() const {
|
||||
return static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
|
|
|
@ -1138,13 +1138,8 @@ TEST_F(EventTest, hwTimeStampsMemoryIsPlacedInGraphicsAllocation) {
|
|||
void *memoryStorage = allocation->getUnderlyingBuffer();
|
||||
size_t graphicsAllocationSize = allocation->getUnderlyingBufferSize();
|
||||
|
||||
uintptr_t timeStampAddress = reinterpret_cast<uintptr_t>(timeStamps);
|
||||
uintptr_t graphicsAllocationStart = reinterpret_cast<uintptr_t>(memoryStorage);
|
||||
|
||||
if (!((timeStampAddress >= graphicsAllocationStart) &&
|
||||
((timeStampAddress + sizeof(HwTimeStamps)) <= (graphicsAllocationStart + graphicsAllocationSize)))) {
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
EXPECT_GE(timeStamps, memoryStorage);
|
||||
EXPECT_LE(timeStamps + 1, ptrOffset(memoryStorage, graphicsAllocationSize));
|
||||
}
|
||||
|
||||
TEST_F(EventTest, getHwPerfCounterReturnsValidPointer) {
|
||||
|
|
|
@ -371,10 +371,10 @@ TEST(TestCreateImageUseHostPtr, CheckMemoryAllocationForDifferenHostPtrAlignment
|
|||
imageDesc.image_slice_pitch = 0;
|
||||
|
||||
void *pageAlignedPointer = alignedMalloc(imageDesc.image_row_pitch * height * 1 * 4 + 256, 4096);
|
||||
void *hostPtr[] = {reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(pageAlignedPointer) + 16), // 16 - byte alignment
|
||||
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(pageAlignedPointer) + 32), // 32 - byte alignment
|
||||
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(pageAlignedPointer) + 64), // 64 - byte alignment
|
||||
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(pageAlignedPointer) + 128)}; // 128 - byte alignment
|
||||
void *hostPtr[] = {ptrOffset(pageAlignedPointer, 16), // 16 - byte alignment
|
||||
ptrOffset(pageAlignedPointer, 32), // 32 - byte alignment
|
||||
ptrOffset(pageAlignedPointer, 64), // 64 - byte alignment
|
||||
ptrOffset(pageAlignedPointer, 128)}; // 128 - byte alignment
|
||||
|
||||
bool result[] = {false,
|
||||
false,
|
||||
|
|
|
@ -1753,6 +1753,7 @@ TEST_F(MemoryAllocatorTest, whenCommandStreamerIsNotRegisteredThenReturnNullEngi
|
|||
auto engineControl = memoryManager->getRegisteredEngineForCsr(dummyCsr);
|
||||
EXPECT_EQ(nullptr, engineControl);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerCopyMemoryTest, givenAllocationWithNoStorageWhenCopyMemoryToAllocationThenReturnFalse) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
|
@ -1760,6 +1761,7 @@ TEST(MemoryManagerCopyMemoryTest, givenAllocationWithNoStorageWhenCopyMemoryToAl
|
|||
MockGraphicsAllocation invalidAllocation{nullptr, 0u};
|
||||
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(&invalidAllocation, &memory, sizeof(memory)));
|
||||
}
|
||||
|
||||
TEST(MemoryManagerCopyMemoryTest, givenValidAllocationAndMemoryWhenCopyMemoryToAllocationThenDataIsCopied) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
|
|
|
@ -1198,7 +1198,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
|||
memoryManager->getHostPtrManager()->storeFragment(fragment);
|
||||
|
||||
auto offset = 80;
|
||||
auto allocationPtr = reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(ptr) + offset);
|
||||
auto allocationPtr = ptrOffset(ptr, offset);
|
||||
AllocationData allocationData;
|
||||
allocationData.size = size;
|
||||
allocationData.hostPtr = allocationPtr;
|
||||
|
|
Loading…
Reference in New Issue