mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
Add cmdContainer ULTs - idOffset & numIdd reset, Gfx alloc failure
ULT required to cover IDOffset and numIdd values during reset. ULT required to cover OUT_OF_MEM retrun during init. Fix to check for valid gfx allocation inside heap helper & destructor Change-Id: Ied9049b33dc0605d5f5f51c96114d5e96b26a4f7 Signed-off-by: Vinod Tipparaju <vinod.tipparaju@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b7d5427f01
commit
8e6be83fcc
@@ -9,10 +9,13 @@
|
||||
#include "shared/test/unit_test/fixtures/device_fixture.h"
|
||||
#include "shared/test/unit_test/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
constexpr uint32_t defaultNumIddsPerBlock = 64;
|
||||
|
||||
class CommandContainerTest : public DeviceFixture,
|
||||
public ::testing::Test {
|
||||
|
||||
@@ -128,6 +131,9 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeThenEverythingIs
|
||||
EXPECT_EQ(indirectHeap->getGraphicsAllocation(), heapAllocation);
|
||||
}
|
||||
|
||||
EXPECT_EQ(cmdContainer.getIddBlock(), nullptr);
|
||||
EXPECT_EQ(cmdContainer.getNumIddPerBlock(), defaultNumIddsPerBlock);
|
||||
|
||||
auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
|
||||
EXPECT_EQ(cmdContainer.getInstructionHeapBaseAddress(),
|
||||
@@ -140,6 +146,22 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeWithoutDeviceThe
|
||||
EXPECT_EQ(ErrorCode::INVALID_DEVICE, status);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerDuringInitWhenAllocateGfxMemoryFailsThenErrorIsReturned) {
|
||||
CommandContainer cmdContainer;
|
||||
pDevice->executionEnvironment->memoryManager.reset(new FailMemoryManager(0, *pDevice->executionEnvironment));
|
||||
auto status = cmdContainer.initialize(pDevice);
|
||||
EXPECT_EQ(ErrorCode::OUT_OF_DEVICE_MEMORY, status);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerDuringInitWhenAllocateHeapMemoryFailsThenErrorIsReturned) {
|
||||
CommandContainer cmdContainer;
|
||||
auto temp_memoryManager = pDevice->executionEnvironment->memoryManager.release();
|
||||
pDevice->executionEnvironment->memoryManager.reset(new FailMemoryManager(1, *pDevice->executionEnvironment));
|
||||
auto status = cmdContainer.initialize(pDevice);
|
||||
EXPECT_EQ(ErrorCode::OUT_OF_DEVICE_MEMORY, status);
|
||||
delete temp_memoryManager;
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenSettingIndirectHeapAllocationThenAllocationIsSet) {
|
||||
CommandContainer cmdContainer;
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
@@ -173,6 +195,8 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenResetThenStateIsReset) {
|
||||
EXPECT_NE(usedSize, cmdContainer.getCommandStream()->getUsed());
|
||||
EXPECT_EQ(0u, cmdContainer.getCommandStream()->getUsed());
|
||||
EXPECT_EQ(0u, cmdContainer.lastSentNumGrfRequired);
|
||||
EXPECT_EQ(cmdContainer.getIddBlock(), nullptr);
|
||||
EXPECT_EQ(cmdContainer.getNumIddPerBlock(), defaultNumIddsPerBlock);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenWantToAddNullPtrToResidencyContainerThenNothingIsAdded) {
|
||||
|
||||
Reference in New Issue
Block a user