mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Fixes for AUBs
Change-Id: Iac55927eb96db8dd68b86d21e66392039ba1f058
This commit is contained in:
committed by
sys_ocldev
parent
64c891f0fd
commit
465e1a3165
@@ -450,7 +450,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
physLRCA + 0x101c,
|
||||
&engineInfo.tailRingBuffer,
|
||||
sizeof(engineInfo.tailRingBuffer),
|
||||
getAddressSpace(AubMemDump::DataTypeHintValues::TraceNotype));
|
||||
getAddressSpace(getCsTraits(engineType).aubHintLRCA));
|
||||
|
||||
DEBUG_BREAK_IF(engineInfo.tailRingBuffer >= engineInfo.sizeRingBuffer);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ uintptr_t PTE::map(uintptr_t vm, size_t size, uint64_t entryBits, uint32_t memor
|
||||
uintptr_t res = -1;
|
||||
bool updateEntryBits = entryBits != PageTableEntry::nonValidBits;
|
||||
uint64_t newEntryBits = entryBits & 0xfff;
|
||||
auto entriesMask = std::numeric_limits<uintptr_t>::max() & ~MemoryConstants::pageMask;
|
||||
newEntryBits |= 0x1;
|
||||
|
||||
for (size_t index = indexStart; index <= indexEnd; index++) {
|
||||
@@ -26,9 +27,9 @@ uintptr_t PTE::map(uintptr_t vm, size_t size, uint64_t entryBits, uint32_t memor
|
||||
uint64_t tmp = allocator->reservePage(memoryBank);
|
||||
entries[index] = reinterpret_cast<void *>(tmp | newEntryBits);
|
||||
} else if (updateEntryBits) {
|
||||
entries[index] = reinterpret_cast<void *>((reinterpret_cast<uintptr_t>(entries[index]) & 0xfffff000u) | newEntryBits);
|
||||
entries[index] = reinterpret_cast<void *>((reinterpret_cast<uintptr_t>(entries[index]) & entriesMask) | newEntryBits);
|
||||
}
|
||||
res = std::min(reinterpret_cast<uintptr_t>(entries[index]) & 0xfffff000u, res);
|
||||
res = std::min(reinterpret_cast<uintptr_t>(entries[index]) & entriesMask, res);
|
||||
}
|
||||
return (res & ~newEntryBits) + (vm & (pageSize - 1));
|
||||
}
|
||||
@@ -43,6 +44,7 @@ void PTE::pageWalk(uintptr_t vm, size_t size, size_t offset, uint64_t entryBits,
|
||||
uintptr_t rem = vm & (pageSize - 1);
|
||||
bool updateEntryBits = entryBits != PageTableEntry::nonValidBits;
|
||||
uint64_t newEntryBits = entryBits & 0xfff;
|
||||
auto entriesMask = std::numeric_limits<uintptr_t>::max() & ~MemoryConstants::pageMask;
|
||||
newEntryBits |= 0x1;
|
||||
|
||||
for (size_t index = indexStart; index <= indexEnd; index++) {
|
||||
@@ -50,9 +52,9 @@ void PTE::pageWalk(uintptr_t vm, size_t size, size_t offset, uint64_t entryBits,
|
||||
uint64_t tmp = allocator->reservePage(memoryBank);
|
||||
entries[index] = reinterpret_cast<void *>(tmp | newEntryBits);
|
||||
} else if (updateEntryBits) {
|
||||
entries[index] = reinterpret_cast<void *>((reinterpret_cast<uintptr_t>(entries[index]) & 0xfffff000u) | newEntryBits);
|
||||
entries[index] = reinterpret_cast<void *>((reinterpret_cast<uintptr_t>(entries[index]) & entriesMask) | newEntryBits);
|
||||
}
|
||||
res = reinterpret_cast<uintptr_t>(entries[index]) & 0xfffff000u;
|
||||
res = reinterpret_cast<uintptr_t>(entries[index]) & entriesMask;
|
||||
|
||||
size_t lSize = std::min(pageSize - rem, size);
|
||||
pageWalker((res & ~0x1) + rem, lSize, offset, reinterpret_cast<uintptr_t>(entries[index]) & 0xfffu);
|
||||
|
||||
@@ -18,7 +18,7 @@ struct AubWriteCopyReadBuffer : public AUBFixture,
|
||||
public ::testing::Test {
|
||||
|
||||
void SetUp() override {
|
||||
AUBFixture::SetUp();
|
||||
AUBFixture::SetUp(nullptr);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace OCLRT {
|
||||
|
||||
class AUBFixture : public CommandQueueHwFixture {
|
||||
public:
|
||||
void SetUp() {
|
||||
const HardwareInfo &hwInfo = *platformDevices[0];
|
||||
void SetUp(const HardwareInfo *hardwareInfo) {
|
||||
const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *platformDevices[0];
|
||||
uint32_t deviceIndex = 0;
|
||||
|
||||
const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
|
||||
@@ -71,5 +71,8 @@ class AUBFixture : public CommandQueueHwFixture {
|
||||
std::unique_ptr<MockDevice> device;
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
|
||||
private:
|
||||
using CommandQueueHwFixture::SetUp;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -215,6 +215,38 @@ TEST_F(PageTableTests48, givenReservedPhysicalAddressWhenPageWalkIsCalledThenPag
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenBigGpuAddressWhenPageWalkIsCalledThenPageTablesAreFilledWithProperAddresses) {
|
||||
if (is64Bit) {
|
||||
std::unique_ptr<MockPML4> pageTable(std::make_unique<MockPML4>(&allocator));
|
||||
|
||||
int shiftPML4 = is64Bit ? (47) : 0;
|
||||
int shiftPDP = is64Bit ? (9 + 9 + 12) : 0;
|
||||
|
||||
uintptr_t gpuVa = (uintptr_t(0x1) << (shiftPML4)) | (uintptr_t(0x1) << (shiftPDP)) | (uintptr_t(0x1) << (9 + 12)) | 0x100;
|
||||
|
||||
size_t size = 10 * pageSize;
|
||||
|
||||
size_t walked = 0u;
|
||||
auto address = allocator.mainAllocator.load();
|
||||
|
||||
PageWalker walker = [&](uint64_t physAddress, size_t size, size_t offset, uint64_t entryBits) {
|
||||
walked += size;
|
||||
};
|
||||
pageTable->pageWalk(gpuVa, size, 0, 0, walker, MemoryBanks::MainBank);
|
||||
|
||||
EXPECT_EQ(size, walked);
|
||||
|
||||
ASSERT_NE(nullptr, pageTable->entries[0x100]);
|
||||
ASSERT_NE(nullptr, pageTable->entries[0x100]->entries[1]);
|
||||
ASSERT_NE(nullptr, pageTable->entries[0x100]->entries[1]->entries[1]);
|
||||
|
||||
for (uint32_t i = 0; i < 10; i++) {
|
||||
EXPECT_EQ(reinterpret_cast<void *>(address | 0x1), pageTable->entries[0x100]->entries[1]->entries[1]->entries[i]);
|
||||
address += pageSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenZeroEntryBitsWhenPageWalkIsCalledThenPageTableEntryHasPresentBitSet) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
|
||||
Reference in New Issue
Block a user