[24/n] Internal 4GB allocator.

- Refactor tests for better maintenance
- Remove duplicated code.

Change-Id: I154cad43610497d2e1cabf99217820735d3868cd
This commit is contained in:
Mrozek, Michal
2018-03-29 15:01:59 +02:00
committed by sys_ocldev
parent 0432d117ca
commit de315db953
17 changed files with 154 additions and 563 deletions

View File

@@ -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"),
@@ -21,10 +21,11 @@
*/
#include "runtime/built_ins/built_ins.h"
#include "unit_tests/command_queue/enqueue_copy_buffer_rect_fixture.h"
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/gen_common/reg_configs.h"
#include "runtime/helpers/dispatch_info.h"
#include "runtime/memory_manager/memory_constants.h"
#include "unit_tests/command_queue/enqueue_copy_buffer_rect_fixture.h"
#include "unit_tests/gen_common/gen_commands_common_validation.h"
#include "test.h"
using namespace OCLRT;
@@ -217,43 +218,10 @@ HWTEST_F(EnqueueCopyBufferRectTest, 2D_LoadRegisterImmediateL3CNTLREG) {
EXPECT_NE(0u, L3ClientPool);
}
HWTEST_F(EnqueueCopyBufferRectTest, 2D_StateBaseAddress) {
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
HWTEST_F(EnqueueCopyBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyBufferRect2D<FamilyType>();
auto internalHeapBase = this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress();
auto *cmd = (STATE_BASE_ADDRESS *)cmdStateBaseAddress;
ASSERT_NE(nullptr, cmd);
// Verify all addresses are getting programmed
EXPECT_TRUE(cmd->getDynamicStateBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getGeneralStateBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getSurfaceStateBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getIndirectObjectBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getInstructionBaseAddressModifyEnable());
EXPECT_EQ((uintptr_t)pDSH->getCpuBase(), cmd->getDynamicStateBaseAddress());
// Stateless accesses require GSH.base to be 0.
EXPECT_EQ(0u, cmd->getGeneralStateBaseAddress());
EXPECT_EQ((uintptr_t)pSSH->getCpuBase(), cmd->getSurfaceStateBaseAddress());
EXPECT_EQ((uintptr_t)pIOH->getCpuBase(), cmd->getIndirectObjectBaseAddress());
EXPECT_EQ(internalHeapBase, cmd->getInstructionBaseAddress());
// Verify all sizes are getting programmed
EXPECT_TRUE(cmd->getDynamicStateBufferSizeModifyEnable());
EXPECT_TRUE(cmd->getGeneralStateBufferSizeModifyEnable());
EXPECT_TRUE(cmd->getIndirectObjectBufferSizeModifyEnable());
EXPECT_TRUE(cmd->getInstructionBufferSizeModifyEnable());
EXPECT_EQ(pDSH->getMaxAvailableSpace(), cmd->getDynamicStateBufferSize() * MemoryConstants::pageSize);
EXPECT_NE(0u, cmd->getGeneralStateBufferSize());
EXPECT_EQ(pIOH->getMaxAvailableSpace(), cmd->getIndirectObjectBufferSize() * MemoryConstants::pageSize);
EXPECT_EQ(MemoryConstants::sizeOf4GBinPageEntities, cmd->getInstructionBufferSize());
// Generically validate this command
FamilyType::PARSE::template validateCommand<STATE_BASE_ADDRESS *>(cmdList.begin(), itorStateBaseAddress);
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
}
HWTEST_F(EnqueueCopyBufferRectTest, 2D_MediaInterfaceDescriptorLoad) {
@@ -399,42 +367,10 @@ HWTEST_F(EnqueueCopyBufferRectTest, 3D_LoadRegisterImmediateL3CNTLREG) {
EXPECT_NE(0u, L3ClientPool);
}
HWTEST_F(EnqueueCopyBufferRectTest, 3D_StateBaseAddress) {
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
HWTEST_F(EnqueueCopyBufferRectTest, When3DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyBufferRect3D<FamilyType>();
auto internalHeapBase = this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress();
auto *cmd = (STATE_BASE_ADDRESS *)cmdStateBaseAddress;
ASSERT_NE(nullptr, cmd);
// Verify all addresses are getting programmed
EXPECT_TRUE(cmd->getDynamicStateBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getGeneralStateBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getSurfaceStateBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getIndirectObjectBaseAddressModifyEnable());
EXPECT_TRUE(cmd->getInstructionBaseAddressModifyEnable());
EXPECT_EQ((uintptr_t)pDSH->getCpuBase(), cmd->getDynamicStateBaseAddress());
// Stateless accesses require GSH.base to be 0.
EXPECT_EQ(0u, cmd->getGeneralStateBaseAddress());
EXPECT_EQ((uintptr_t)pSSH->getCpuBase(), cmd->getSurfaceStateBaseAddress());
EXPECT_EQ((uintptr_t)pIOH->getCpuBase(), cmd->getIndirectObjectBaseAddress());
EXPECT_EQ(internalHeapBase, cmd->getInstructionBaseAddress());
// Verify all sizes are getting programmed
EXPECT_TRUE(cmd->getDynamicStateBufferSizeModifyEnable());
EXPECT_TRUE(cmd->getGeneralStateBufferSizeModifyEnable());
EXPECT_TRUE(cmd->getIndirectObjectBufferSizeModifyEnable());
EXPECT_TRUE(cmd->getInstructionBufferSizeModifyEnable());
EXPECT_EQ(pDSH->getMaxAvailableSpace(), cmd->getDynamicStateBufferSize() * MemoryConstants::pageSize);
EXPECT_NE(0u, cmd->getGeneralStateBufferSize());
EXPECT_EQ(pIOH->getMaxAvailableSpace(), cmd->getIndirectObjectBufferSize() * MemoryConstants::pageSize);
EXPECT_EQ(MemoryConstants::sizeOf4GBinPageEntities, cmd->getInstructionBufferSize());
// Generically validate this command
FamilyType::PARSE::template validateCommand<STATE_BASE_ADDRESS *>(cmdList.begin(), itorStateBaseAddress);
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
}
HWTEST_F(EnqueueCopyBufferRectTest, 3D_MediaInterfaceDescriptorLoad) {