Pass AubHelper to reserveAddressPPGTT().

- get PageTable entry data hints and address space from AubHelper
based on local memory flag
- add enableLocalMemory flag in CSR HW

Change-Id: I061bda62be8da55d52cff48ecddcf26c4212dc67
This commit is contained in:
Hoppe, Mateusz 2018-09-14 05:31:37 -07:00 committed by sys_ocldev
parent 873a58382b
commit 619d2217cb
19 changed files with 286 additions and 27 deletions

View File

@ -22,6 +22,7 @@ set(RUNTIME_SRCS_AUB
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/aub_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.inl
)
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_AUB})
set_property(GLOBAL PROPERTY RUNTIME_SRCS_AUB ${RUNTIME_SRCS_AUB})

View File

@ -32,5 +32,4 @@ int AubHelper::getMemTrace(uint64_t pdEntryBits) {
uint64_t AubHelper::getPTEntryBits(uint64_t pdEntryBits) {
return pdEntryBits;
}
} // namespace OCLRT

View File

@ -39,5 +39,37 @@ class AubHelper {
}
static int getMemTrace(uint64_t pdEntryBits);
static uint64_t getPTEntryBits(uint64_t pdEntryBits);
virtual int getDataHintForPml4Entry() const = 0;
virtual int getDataHintForPdpEntry() const = 0;
virtual int getDataHintForPdEntry() const = 0;
virtual int getDataHintForPtEntry() const = 0;
virtual int getMemTraceForPml4Entry() const = 0;
virtual int getMemTraceForPdpEntry() const = 0;
virtual int getMemTraceForPdEntry() const = 0;
virtual int getMemTraceForPtEntry() const = 0;
};
template <typename GfxFamily>
class AubHelperHw : public AubHelper {
public:
AubHelperHw(bool localMemoryEnabled) : localMemoryEnabled(localMemoryEnabled){};
~AubHelperHw() = default;
AubHelperHw(AubHelperHw &) = delete;
int getDataHintForPml4Entry() const override;
int getDataHintForPdpEntry() const override;
int getDataHintForPdEntry() const override;
int getDataHintForPtEntry() const override;
int getMemTraceForPml4Entry() const override;
int getMemTraceForPdpEntry() const override;
int getMemTraceForPdEntry() const override;
int getMemTraceForPtEntry() const override;
protected:
bool localMemoryEnabled;
};
} // namespace OCLRT

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/aub_mem_dump/aub_mem_dump.h"
namespace OCLRT {
template <typename Family>
int AubHelperHw<Family>::getDataHintForPml4Entry() const {
return AubMemDump::DataTypeHintValues::TraceNotype;
}
template <typename Family>
int AubHelperHw<Family>::getDataHintForPdpEntry() const {
return AubMemDump::DataTypeHintValues::TraceNotype;
}
template <typename Family>
int AubHelperHw<Family>::getDataHintForPdEntry() const {
return AubMemDump::DataTypeHintValues::TraceNotype;
}
template <typename Family>
int AubHelperHw<Family>::getDataHintForPtEntry() const {
return AubMemDump::DataTypeHintValues::TraceNotype;
}
template <typename Family>
int AubHelperHw<Family>::getMemTraceForPml4Entry() const {
if (localMemoryEnabled) {
return AubMemDump::AddressSpaceValues::TraceLocal;
}
return AubMemDump::AddressSpaceValues::TracePml4Entry;
}
template <typename Family>
int AubHelperHw<Family>::getMemTraceForPdpEntry() const {
if (localMemoryEnabled) {
return AubMemDump::AddressSpaceValues::TraceLocal;
}
return AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry;
}
template <typename Family>
int AubHelperHw<Family>::getMemTraceForPdEntry() const {
if (localMemoryEnabled) {
return AubMemDump::AddressSpaceValues::TraceLocal;
}
return AubMemDump::AddressSpaceValues::TracePpgttPdEntry;
}
template <typename Family>
int AubHelperHw<Family>::getMemTraceForPtEntry() const {
if (localMemoryEnabled) {
return AubMemDump::AddressSpaceValues::TraceLocal;
}
return AubMemDump::AddressSpaceValues::TracePpgttEntry;
}
} // namespace OCLRT

View File

@ -31,6 +31,10 @@
#include "runtime/aub_mem_dump/aub_data.h"
namespace OCLRT {
class AubHelper;
}
namespace AubMemDump {
#include "aub_services.h"
@ -248,7 +252,9 @@ struct AubPageTableHelper32 : public AubPageTableHelper<Traits>, PageTableTraits
typedef AubPageTableHelper<Traits> BaseClass;
static void createContext(typename Traits::Stream &stream, uint32_t context);
static uint64_t reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress, size_t blockSize, uint64_t physAddress, uint64_t additionalBits);
static uint64_t reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress,
size_t blockSize, uint64_t physAddress,
uint64_t additionalBits, const OCLRT::AubHelper &aubHelper);
static void fixupLRC(uint8_t *pLrc);
};
@ -262,7 +268,9 @@ struct AubPageTableHelper64 : public AubPageTableHelper<Traits>, PageTableTraits
}
static void createContext(typename Traits::Stream &stream, uint32_t context);
static uint64_t reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress, size_t blockSize, uint64_t physAddress, uint64_t additionalBits);
static uint64_t reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress,
size_t blockSize, uint64_t physAddress,
uint64_t additionalBits, const OCLRT::AubHelper &aubHelper);
static void fixupLRC(uint8_t *pLrc);
};
@ -296,7 +304,9 @@ struct AubDump : public TypeSelector<AubPageTableHelper32<TraitsIn>, AubPageTabl
static void addMemoryWrite(Stream &stream, uint64_t addr, const void *memory, size_t blockSize, int addressSpace, int hint = DataTypeHintValues::TraceNotype);
static uint64_t reserveAddressGGTT(Stream &stream, uint32_t addr, size_t size, uint64_t physStart, AubGTTData data);
static uint64_t reserveAddressGGTT(Stream &stream, const void *memory, size_t size, uint64_t physStart, AubGTTData data);
static void reserveAddressGGTTAndWriteMmeory(Stream &stream, uintptr_t gfxAddress, const void *memory, uint64_t physAddress, size_t size, size_t offset, uint64_t additionalBits);
static void reserveAddressGGTTAndWriteMmeory(Stream &stream, uintptr_t gfxAddress, const void *memory, uint64_t physAddress,
size_t size, size_t offset, uint64_t additionalBits, const OCLRT::AubHelper &aubHelper);
static void setGttEntry(MiGttEntry &entry, uint64_t address, AubGTTData data);
private:

View File

@ -130,11 +130,14 @@ uint64_t AubDump<Traits>::reserveAddressGGTT(typename Traits::Stream &stream, co
}
template <typename Traits>
void AubDump<Traits>::reserveAddressGGTTAndWriteMmeory(typename Traits::Stream &stream, uintptr_t gfxAddress, const void *memory, uint64_t physAddress, size_t size, size_t offset, uint64_t additionalBits) {
void AubDump<Traits>::reserveAddressGGTTAndWriteMmeory(typename Traits::Stream &stream, uintptr_t gfxAddress,
const void *memory, uint64_t physAddress,
size_t size, size_t offset,
uint64_t additionalBits, const OCLRT::AubHelper &aubHelper) {
auto vmAddr = (gfxAddress + offset) & ~(MemoryConstants::pageSize - 1);
auto pAddr = physAddress & ~(MemoryConstants::pageSize - 1);
AubDump<Traits>::reserveAddressPPGTT(stream, vmAddr, MemoryConstants::pageSize, pAddr, additionalBits);
AubDump<Traits>::reserveAddressPPGTT(stream, vmAddr, MemoryConstants::pageSize, pAddr, additionalBits, aubHelper);
int hint = OCLRT::AubHelper::getMemTrace(additionalBits);
@ -152,7 +155,9 @@ void AubDump<Traits>::setGttEntry(MiGttEntry &entry, uint64_t address, AubGTTDat
}
template <typename Traits>
uint64_t AubPageTableHelper32<Traits>::reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress, size_t blockSize, uint64_t physAddress, uint64_t additionalBits) {
uint64_t AubPageTableHelper32<Traits>::reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress,
size_t blockSize, uint64_t physAddress,
uint64_t additionalBits, const OCLRT::AubHelper &aubHelper) {
auto startAddress = gfxAddress;
auto endAddress = gfxAddress + blockSize - 1;
@ -169,7 +174,9 @@ uint64_t AubPageTableHelper32<Traits>::reserveAddressPPGTT(typename Traits::Stre
if (writePDE) {
auto start_address = BaseClass::getPDEAddress(startPDE);
stream.writeMemoryWriteHeader(start_address, numPDEs * sizeof(uint64_t), AddressSpaceValues::TracePpgttPdEntry);
stream.writeMemoryWriteHeader(start_address, numPDEs * sizeof(uint64_t),
aubHelper.getMemTraceForPdEntry(),
aubHelper.getDataHintForPdEntry());
auto currPDE = startPDE;
auto physPage = BaseClass::getPTEAddress(startPTE) & g_pageMask;
@ -189,7 +196,9 @@ uint64_t AubPageTableHelper32<Traits>::reserveAddressPPGTT(typename Traits::Stre
if (writePTE) {
auto start_address = BaseClass::getPTEAddress(startPTE);
stream.writeMemoryWriteHeader(start_address, numPTEs * sizeof(uint64_t), AddressSpaceValues::TracePpgttEntry);
stream.writeMemoryWriteHeader(start_address, numPTEs * sizeof(uint64_t),
aubHelper.getMemTraceForPtEntry(),
aubHelper.getDataHintForPtEntry());
auto currPTE = startPTE;
auto physPage = physAddress & g_pageMask;
@ -208,7 +217,9 @@ uint64_t AubPageTableHelper32<Traits>::reserveAddressPPGTT(typename Traits::Stre
}
template <typename Traits>
uint64_t AubPageTableHelper64<Traits>::reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress, size_t blockSize, uint64_t physAddress, uint64_t additionalBits) {
uint64_t AubPageTableHelper64<Traits>::reserveAddressPPGTT(typename Traits::Stream &stream, uintptr_t gfxAddress,
size_t blockSize, uint64_t physAddress,
uint64_t additionalBits, const OCLRT::AubHelper &aubHelper) {
auto startAddress = gfxAddress;
auto endAddress = gfxAddress + blockSize - 1;
@ -233,7 +244,9 @@ uint64_t AubPageTableHelper64<Traits>::reserveAddressPPGTT(typename Traits::Stre
if (writePML4) {
auto start_address = getPML4Address(startPML4);
stream.writeMemoryWriteHeader(start_address, numPML4s * sizeof(uint64_t), AddressSpaceValues::TracePml4Entry);
stream.writeMemoryWriteHeader(start_address, numPML4s * sizeof(uint64_t),
aubHelper.getMemTraceForPml4Entry(),
aubHelper.getDataHintForPml4Entry());
auto currPML4 = startPML4;
auto physPage = BaseClass::getPDPAddress(startPDP) & g_pageMask;
@ -253,7 +266,9 @@ uint64_t AubPageTableHelper64<Traits>::reserveAddressPPGTT(typename Traits::Stre
if (writePDPE) {
auto start_address = BaseClass::getPDPAddress(startPDP);
stream.writeMemoryWriteHeader(start_address, numPDPs * sizeof(uint64_t), AddressSpaceValues::TracePhysicalPdpEntry);
stream.writeMemoryWriteHeader(start_address, numPDPs * sizeof(uint64_t),
aubHelper.getMemTraceForPdpEntry(),
aubHelper.getDataHintForPdpEntry());
auto currPDP = startPDP;
auto physPage = BaseClass::getPDEAddress(startPDE) & g_pageMask;
@ -273,7 +288,9 @@ uint64_t AubPageTableHelper64<Traits>::reserveAddressPPGTT(typename Traits::Stre
if (writePDE) {
auto start_address = BaseClass::getPDEAddress(startPDE);
stream.writeMemoryWriteHeader(start_address, numPDEs * sizeof(uint64_t), AddressSpaceValues::TracePpgttPdEntry);
stream.writeMemoryWriteHeader(start_address, numPDEs * sizeof(uint64_t),
aubHelper.getMemTraceForPdEntry(),
aubHelper.getDataHintForPdEntry());
auto currPDE = startPDE;
auto physPage = BaseClass::getPTEAddress(startPTE) & g_pageMask;
@ -293,7 +310,9 @@ uint64_t AubPageTableHelper64<Traits>::reserveAddressPPGTT(typename Traits::Stre
if (writePTE) {
auto start_address = BaseClass::getPTEAddress(startPTE);
stream.writeMemoryWriteHeader(start_address, numPTEs * sizeof(uint64_t), AddressSpaceValues::TracePpgttEntry);
stream.writeMemoryWriteHeader(start_address, numPTEs * sizeof(uint64_t),
aubHelper.getMemTraceForPtEntry(),
aubHelper.getDataHintForPtEntry());
auto currPTE = startPTE;
auto physPage = physAddress & g_pageMask;

View File

@ -29,6 +29,7 @@
#include "runtime/gmm_helper/resource_info.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/string.h"
#include "runtime/memory_manager/graphics_allocation.h"
@ -294,8 +295,10 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
}
auto physBatchBuffer = ppgtt->map(static_cast<uintptr_t>(batchBufferGpuAddress), sizeBatchBuffer, PageTableHelper::getMemoryBankIndex(*batchBuffer.commandBufferAllocation));
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
AUB::reserveAddressPPGTT(*stream, static_cast<uintptr_t>(batchBufferGpuAddress), sizeBatchBuffer, physBatchBuffer,
getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation));
getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation),
aubHelperHw);
AUB::addMemoryWrite(
*stream,
@ -559,8 +562,11 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
gfxAllocation.setLocked(true);
}
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
PageWalker walker = [&](uint64_t physAddress, size_t size, size_t offset) {
AUB::reserveAddressGGTTAndWriteMmeory(*stream, static_cast<uintptr_t>(gpuAddress), cpuAddress, physAddress, size, offset, getPPGTTAdditionalBits(&gfxAllocation));
AUB::reserveAddressGGTTAndWriteMmeory(*stream, static_cast<uintptr_t>(gpuAddress), cpuAddress, physAddress, size, offset, getPPGTTAdditionalBits(&gfxAllocation),
aubHelperHw);
};
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), size, 0, walker, PageTableHelper::getMemoryBankIndex(gfxAllocation));
@ -654,6 +660,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::addGUCStartMessage(uint64_t batchBuf
typedef typename GfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
auto bufferSize = sizeof(uint32_t) + sizeof(MI_BATCH_BUFFER_START);
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
std::unique_ptr<void, std::function<void(void *)>> buffer(this->getMemoryManager()->alignedMallocWrapper(bufferSize, MemoryConstants::pageSize), [&](void *ptr) { this->getMemoryManager()->alignedFreeWrapper(ptr); });
LinearStream linearStream(buffer.get(), bufferSize);
@ -668,7 +675,9 @@ void AUBCommandStreamReceiverHw<GfxFamily>::addGUCStartMessage(uint64_t batchBuf
miBatchBufferStart->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
auto physBufferAddres = ppgtt->map(reinterpret_cast<uintptr_t>(buffer.get()), bufferSize, PageTableHelper::memoryBankNotSpecified);
AUB::reserveAddressPPGTT(*stream, reinterpret_cast<uintptr_t>(buffer.get()), bufferSize, physBufferAddres, getPPGTTAdditionalBits(linearStream.getGraphicsAllocation()));
AUB::reserveAddressPPGTT(*stream, reinterpret_cast<uintptr_t>(buffer.get()), bufferSize, physBufferAddres,
getPPGTTAdditionalBits(linearStream.getGraphicsAllocation()),
aubHelperHw);
AUB::addMemoryWrite(
*stream,

View File

@ -113,6 +113,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
const HardwareInfo &hwInfo;
CsrSizeRequestFlags csrSizeRequestFlags = {};
const bool localMemoryEnabled;
};
} // namespace OCLRT

View File

@ -27,6 +27,7 @@
#include "runtime/gtpin/gtpin_notify.h"
#include "runtime/helpers/cache_policy.h"
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/preamble.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/state_base_address.h"
@ -47,7 +48,8 @@ size_t CommandStreamReceiverHw<GfxFamily>::getSshHeapSize() {
template <typename GfxFamily>
CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment)
: CommandStreamReceiver(executionEnvironment), hwInfo(hwInfoIn) {
: CommandStreamReceiver(executionEnvironment), hwInfo(hwInfoIn),
localMemoryEnabled(HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily).isLocalMemoryEnabled(hwInfo)) {
requiredThreadArbitrationPolicy = PreambleHelper<GfxFamily>::getDefaultThreadArbitrationPolicy();
resetKmdNotifyHelper(new KmdNotifyHelper(&(hwInfoIn.capabilityTable.kmdNotifyProperties)));
flatBatchBufferHelper.reset(new FlatBatchBufferHelperHw<GfxFamily>(this->memoryManager));

View File

@ -21,9 +21,11 @@
*/
#include "hw_cmds.h"
#include "runtime/aub/aub_helper.h"
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
@ -209,7 +211,11 @@ FlushStamp TbxCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
auto sizeBatchBuffer = currentOffset - batchBuffer.startOffset;
{
auto physBatchBuffer = ppgtt->map(reinterpret_cast<uintptr_t>(pBatchBuffer), sizeBatchBuffer, PageTableHelper::getMemoryBankIndex(*batchBuffer.commandBufferAllocation));
AUB::reserveAddressPPGTT(stream, reinterpret_cast<uintptr_t>(pBatchBuffer), sizeBatchBuffer, physBatchBuffer, getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation));
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
AUB::reserveAddressPPGTT(stream, reinterpret_cast<uintptr_t>(pBatchBuffer), sizeBatchBuffer, physBatchBuffer,
getPPGTTAdditionalBits(batchBuffer.commandBufferAllocation),
aubHelperHw);
AUB::addMemoryWrite(
stream,
@ -359,8 +365,11 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
if (size == 0)
return false;
AubHelperHw<GfxFamily> aubHelperHw(this->localMemoryEnabled);
PageWalker walker = [&](uint64_t physAddress, size_t size, size_t offset) {
AUB::reserveAddressGGTTAndWriteMmeory(stream, static_cast<uintptr_t>(gpuAddress), cpuAddress, physAddress, size, offset, getPPGTTAdditionalBits(&gfxAllocation));
AUB::reserveAddressGGTTAndWriteMmeory(stream, static_cast<uintptr_t>(gpuAddress), cpuAddress, physAddress, size, offset, getPPGTTAdditionalBits(&gfxAllocation),
aubHelperHw);
};
ppgtt->pageWalk(static_cast<uintptr_t>(gpuAddress), size, 0, walker, PageTableHelper::getMemoryBankIndex(gfxAllocation));

View File

@ -20,6 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/aub/aub_helper.h"
#include "runtime/aub/aub_helper.inl"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/hw_helper_common.inl"
#include "runtime/helpers/flat_batch_buffer_helper_hw.inl"
@ -42,6 +44,7 @@ bool HwHelperHw<Family>::setupPreemptionRegisters(HardwareInfo *pHwInfo, bool en
return pHwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580;
}
template class AubHelperHw<Family>;
template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>;
} // namespace OCLRT

View File

@ -20,6 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/aub/aub_helper.h"
#include "runtime/aub/aub_helper.inl"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/hw_helper_common.inl"
#include "runtime/helpers/flat_batch_buffer_helper_hw.inl"
@ -41,6 +43,7 @@ void HwHelperHw<Family>::setupHardwareCapabilities(HardwareCapabilities *caps, c
caps->isStatelesToStatefullWithOffsetSupported = false;
}
template class AubHelperHw<Family>;
template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>;
} // namespace OCLRT

View File

@ -20,6 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/aub/aub_helper.h"
#include "runtime/aub/aub_helper.inl"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/hw_helper_common.inl"
#include "runtime/helpers/flat_batch_buffer_helper_hw.inl"
@ -41,6 +43,7 @@ SipKernelType HwHelperHw<Family>::getSipKernelType(bool debuggingActive) {
return SipKernelType::DbgCsrLocal;
}
template class AubHelperHw<Family>;
template class HwHelperHw<Family>;
template class FlatBatchBufferHelperHw<Family>;
} // namespace OCLRT

View File

@ -46,10 +46,10 @@ class HwHelper {
virtual void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) = 0;
virtual SipKernelType getSipKernelType(bool debuggingActive) = 0;
virtual uint32_t getConfigureAddressSpaceMode() = 0;
virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) = 0;
protected:
HwHelper(){};
virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) = 0;
};
template <typename GfxFamily>

View File

@ -20,6 +20,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/aub_mem_dump/aub_mem_dump.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/memory_manager/memory_constants.h"
@ -78,5 +79,4 @@ template <typename Family>
size_t HwHelperHw<Family>::getMaxBarrierRegisterPerSlice() const {
return 32;
}
} // namespace OCLRT

View File

@ -24,6 +24,8 @@
#include "runtime/aub/aub_helper.h"
#include "runtime/aub_mem_dump/aub_mem_dump.h"
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "test.h"
using namespace OCLRT;
@ -39,3 +41,77 @@ TEST(AubHelper, WhenGetPTEntryBitsIsCalledThenEntryBitsAreNotMasked) {
uint64_t maskedEntryBits = AubHelper::getPTEntryBits(entryBits);
EXPECT_EQ(entryBits, maskedEntryBits);
}
typedef Test<DeviceFixture> AubHelperHwTest;
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int dataHint = aubHelper.getDataHintForPml4Entry();
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdpEntryIsCalledThenTraceNotypeIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int dataHint = aubHelper.getDataHintForPdpEntry();
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdEntryIsCalledThenTraceNotypeIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int dataHint = aubHelper.getDataHintForPdEntry();
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPtEntryIsCalledThenTraceNotypeIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int dataHint = aubHelper.getDataHintForPtEntry();
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTracePml4EntryIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int addressSpace = aubHelper.getMemTraceForPml4Entry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePml4Entry, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTracePhysicalPdpEntryIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int addressSpace = aubHelper.getMemTraceForPdpEntry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTracePpgttPdEntryIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int addressSpace = aubHelper.getMemTraceForPdEntry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttPdEntry, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTracePpgttEntryIsReturned) {
AubHelperHw<FamilyType> aubHelper(false);
int addressSpace = aubHelper.getMemTraceForPtEntry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttEntry, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTraceNonlocalIsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
int addressSpace = aubHelper.getMemTraceForPml4Entry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTraceNonlocalIsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
int addressSpace = aubHelper.getMemTraceForPdpEntry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTraceNonlocalIsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
int addressSpace = aubHelper.getMemTraceForPdEntry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
}
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTraceNonlocalIsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
int addressSpace = aubHelper.getMemTraceForPtEntry();
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
}

View File

@ -21,6 +21,8 @@
*/
#include "aub_mem_dump_tests.h"
#include "runtime/aub/aub_helper.h"
#include "runtime/helpers/hw_helper.h"
#include "unit_tests/fixtures/device_fixture.h"
using OCLRT::AUBCommandStreamReceiver;
@ -92,7 +94,9 @@ HWTEST_F(AubMemDumpTests, reserveMaxAddress) {
auto gAddress = static_cast<uintptr_t>(-1) - 4096;
auto pAddress = static_cast<uint64_t>(gAddress) & 0xFFFFFFFF;
AUB::reserveAddressPPGTT(aubFile, gAddress, 4096, pAddress, 7);
OCLRT::AubHelperHw<FamilyType> aubHelperHw(pDevice->getHardwareCapabilities().localMemorySupported);
AUB::reserveAddressPPGTT(aubFile, gAddress, 4096, pAddress, 7, aubHelperHw);
aubFile.fileHandle.close();
}
@ -112,7 +116,9 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneBytePPGTT) {
uint8_t byte = 0xbf;
auto gAddress = reinterpret_cast<uintptr_t>(&byte);
uint64_t physAddress = reinterpret_cast<uint64_t>(&byte) & 0xFFFFFFFF;
AUB::reserveAddressPPGTT(aubFile, gAddress, sizeof(byte), physAddress, 7);
OCLRT::AubHelperHw<FamilyType> aubHelperHw(false);
AUB::reserveAddressPPGTT(aubFile, gAddress, sizeof(byte), physAddress, 7, aubHelperHw);
AUB::addMemoryWrite(aubFile, physAddress, &byte, sizeof(byte), AubMemDump::AddressSpaceValues::TraceNonlocal);
aubFile.expectMemory(physAddress, &byte, sizeof(byte));
@ -156,7 +162,9 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesPPGTT) {
uint8_t bytes[] = {0, 1, 2, 3, 4, 5, 6};
auto gAddress = reinterpret_cast<uintptr_t>(bytes);
auto physAddress = reinterpret_cast<uint64_t>(bytes) & 0xFFFFFFFF;
AUB::reserveAddressPPGTT(aubFile, gAddress, sizeof(bytes), physAddress, 7);
OCLRT::AubHelperHw<FamilyType> aubHelperHw(false);
AUB::reserveAddressPPGTT(aubFile, gAddress, sizeof(bytes), physAddress, 7, aubHelperHw);
AUB::addMemoryWrite(aubFile, physAddress, bytes, sizeof(bytes), AubMemDump::AddressSpaceValues::TraceNonlocal);
aubFile.expectMemory(physAddress, bytes, sizeof(bytes));

View File

@ -21,6 +21,7 @@
*/
#pragma once
#include "runtime/aub/aub_helper.h"
#include "unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h"
template <typename FamilyType>
@ -66,7 +67,10 @@ void setupAUBWithBatchBuffer(const OCLRT::Device *pDevice, OCLRT::EngineType eng
const auto sizeBatchBuffer = 0x1000;
auto gpuBatchBuffer = static_cast<uintptr_t>(gpuBatchBufferAddr);
physAddress += sizeBatchBuffer;
AUB::reserveAddressPPGTT(aubFile, gpuBatchBuffer, sizeBatchBuffer, physBatchBuffer, 7);
OCLRT::AubHelperHw<FamilyType> aubHelperHw(false);
AUB::reserveAddressPPGTT(aubFile, gpuBatchBuffer, sizeBatchBuffer, physBatchBuffer, 7, aubHelperHw);
uint8_t batchBuffer[sizeBatchBuffer];
auto noop = MI_NOOP::sInit();

View File

@ -21,6 +21,7 @@
*/
#pragma once
#include "runtime/aub/aub_helper.h"
#include "unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h"
template <typename FamilyType>
@ -67,7 +68,10 @@ void setupAUBWithBatchBuffer(const OCLRT::Device *pDevice, OCLRT::EngineType eng
const auto sizeBatchBuffer = 0x1000;
auto gpuBatchBuffer = static_cast<uintptr_t>(gpuBatchBufferAddr);
physAddress += sizeBatchBuffer;
AUB::reserveAddressPPGTT(aubFile, gpuBatchBuffer, sizeBatchBuffer, physBatchBuffer, 7);
OCLRT::AubHelperHw<FamilyType> aubHelperHw(false);
AUB::reserveAddressPPGTT(aubFile, gpuBatchBuffer, sizeBatchBuffer, physBatchBuffer, 7, aubHelperHw);
uint8_t batchBuffer[sizeBatchBuffer];
auto noop = MI_NOOP::sInit();