mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 08:07:19 +08:00
Correctly use deviceIndex in CommandContainer initialization
Change-Id: I2377597e16f957428495251d7d788328307d2a9f Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
d99160c9f3
commit
1e6337c61e
@@ -387,6 +387,73 @@ TEST_P(CommandContainerHeaps, givenCommandContainerWhenGetingMoreThanAvailableSi
|
||||
EXPECT_GT(usedSpaceAfter + availableSizeAfter, usedSpaceBefore + availableSizeBefore);
|
||||
}
|
||||
|
||||
TEST_P(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenHeapsAreCreatedWithCorrectRootDeviceIndex) {
|
||||
HeapType heap = GetParam();
|
||||
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
const size_t numDevices = 2;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(numDevices);
|
||||
for (auto i = 0u; i < numDevices; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
|
||||
}
|
||||
auto device0 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
|
||||
auto device1 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
CommandContainer cmdContainer0;
|
||||
cmdContainer0.initialize(device0.get());
|
||||
uint32_t heapRootDeviceIndex0 = cmdContainer0.getIndirectHeap(heap)->getGraphicsAllocation()->getRootDeviceIndex();
|
||||
EXPECT_EQ(device0->getRootDeviceIndex(), heapRootDeviceIndex0);
|
||||
|
||||
CommandContainer cmdContainer1;
|
||||
cmdContainer1.initialize(device1.get());
|
||||
uint32_t heapRootDeviceIndex1 = cmdContainer1.getIndirectHeap(heap)->getGraphicsAllocation()->getRootDeviceIndex();
|
||||
EXPECT_EQ(device1->getRootDeviceIndex(), heapRootDeviceIndex1);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenCmdBufferAllocationIsCreatedWithCorrectRootDeviceIndex) {
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
const size_t numDevices = 2;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(numDevices);
|
||||
for (auto i = 0u; i < numDevices; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
|
||||
}
|
||||
auto device0 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
|
||||
auto device1 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
CommandContainer cmdContainer0;
|
||||
cmdContainer0.initialize(device0.get());
|
||||
EXPECT_EQ(1u, cmdContainer0.getCmdBufferAllocations().size());
|
||||
uint32_t cmdBufferAllocationIndex0 = cmdContainer0.getCmdBufferAllocations().front()->getRootDeviceIndex();
|
||||
EXPECT_EQ(device0->getRootDeviceIndex(), cmdBufferAllocationIndex0);
|
||||
|
||||
CommandContainer cmdContainer1;
|
||||
cmdContainer1.initialize(device1.get());
|
||||
EXPECT_EQ(1u, cmdContainer1.getCmdBufferAllocations().size());
|
||||
uint32_t cmdBufferAllocationIndex1 = cmdContainer1.getCmdBufferAllocations().front()->getRootDeviceIndex();
|
||||
EXPECT_EQ(device1->getRootDeviceIndex(), cmdBufferAllocationIndex1);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenInternalHeapIsCreatedWithCorrectRootDeviceIndex) {
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
const size_t numDevices = 2;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(numDevices);
|
||||
for (auto i = 0u; i < numDevices; i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
|
||||
}
|
||||
auto device0 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
|
||||
auto device1 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
CommandContainer cmdContainer0;
|
||||
cmdContainer0.initialize(device0.get());
|
||||
uint64_t baseAddressHeapDevice0 = device0.get()->getMemoryManager()->getInternalHeapBaseAddress(device0->getRootDeviceIndex());
|
||||
EXPECT_EQ(cmdContainer0.getInstructionHeapBaseAddress(), baseAddressHeapDevice0);
|
||||
|
||||
CommandContainer cmdContainer1;
|
||||
cmdContainer1.initialize(device1.get());
|
||||
uint64_t baseAddressHeapDevice1 = device1.get()->getMemoryManager()->getInternalHeapBaseAddress(device1->getRootDeviceIndex());
|
||||
EXPECT_EQ(cmdContainer1.getInstructionHeapBaseAddress(), baseAddressHeapDevice1);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenDestructionThenNonHeapAllocationAreNotDestroyed) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer());
|
||||
MockGraphicsAllocation alloc;
|
||||
|
||||
Reference in New Issue
Block a user