mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
[27/n] Internal 4GB allocator.
- Allow indirect heap to work in 2 modes: first mode is when it will be used as an allocation from 4GB allocator. In such scenario driver will return offset from base of the allocator region. Second mode is the legacy mode which will be used by device enqueue, this will results in heap CPU base address being programmed in State Base Address commands and during programming heap offset base of 0 will be returned. Change-Id: Ica098f3278b6b6ed5036b4c5ab7461dc61d8ee86
This commit is contained in:

committed by
sys_ocldev

parent
e7ab0b2d33
commit
cb06fad983
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 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"),
|
||||
@ -27,8 +27,6 @@
|
||||
using namespace OCLRT;
|
||||
|
||||
struct IndirectHeapTest : public ::testing::Test {
|
||||
IndirectHeapTest() {
|
||||
}
|
||||
uint8_t buffer[256];
|
||||
MockGraphicsAllocation gfxAllocation = {(void *)buffer, sizeof(buffer)};
|
||||
IndirectHeap indirectHeap = {&gfxAllocation};
|
||||
@ -102,3 +100,21 @@ TEST_F(IndirectHeapTest, givenIndirectHeapWhenGetCpuBaseIsCalledThenCpuAddressIs
|
||||
auto base = indirectHeap.getCpuBase();
|
||||
EXPECT_EQ(base, buffer);
|
||||
}
|
||||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhenAskedForHeapGpuStartOffsetThenZeroIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x3000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, false);
|
||||
|
||||
EXPECT_EQ(0u, indirectHeap.getHeapGpuStartOffset());
|
||||
}
|
||||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapSupporting4GbModeWhenAskedForHeapGpuStartOffsetThenZeroIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x3000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, true);
|
||||
|
||||
EXPECT_EQ(8192u, indirectHeap.getHeapGpuStartOffset());
|
||||
}
|
||||
|
Reference in New Issue
Block a user