mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Encode dispatch kernel with global bindless heaps
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
be90b9ff93
commit
7a5c9d39b5
@@ -14,6 +14,7 @@
|
||||
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
|
||||
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
||||
#include "shared/test/unit_test/fixtures/front_window_fixture.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/mocks/mock_device.h"
|
||||
#include "shared/test/unit_test/mocks/mock_dispatch_kernel_encoder_interface.h"
|
||||
@@ -691,123 +692,60 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, giveNextIddInBlockZeorWhenD
|
||||
|
||||
using EncodeDispatchKernelTest = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
HWTEST_F(EncodeDispatchKernelTest, givenBindlessBufferArgWhenDispatchingKernelThenSurfaceStateOffsetInCrossThreadDataIsProgrammed) {
|
||||
using Platforms = IsAtLeastProduct<IGFX_SKYLAKE>;
|
||||
|
||||
HWTEST2_F(EncodeDispatchKernelTest, givenBindfulKernelWhenDispatchingKernelThenSshFromContainerIsUsed, Platforms) {
|
||||
using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE;
|
||||
using DataPortBindlessSurfaceExtendedMessageDescriptor = typename FamilyType::DataPortBindlessSurfaceExtendedMessageDescriptor;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
using WALKER = typename FamilyType::WALKER_TYPE;
|
||||
uint32_t numBindingTable = 1;
|
||||
BINDING_TABLE_STATE bindingTableState;
|
||||
bindingTableState.sInit();
|
||||
|
||||
auto ssh = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
auto ioh = cmdContainer->getIndirectHeap(HeapType::INDIRECT_OBJECT);
|
||||
|
||||
size_t sizeUsed = 0x20;
|
||||
ssh->getSpace(sizeUsed);
|
||||
sizeUsed = ssh->getUsed();
|
||||
|
||||
uint32_t dims[] = {1, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
std::vector<uint8_t> storage;
|
||||
NEO::PatchTokenBinary::KernelFromPatchtokens kernelTokens = PatchTokensTestData::ValidEmptyKernel::create(storage);
|
||||
kernelTokens.tokens.kernelArgs.resize(1);
|
||||
kernelTokens.tokens.kernelArgs[0].objectType = NEO::PatchTokenBinary::ArgObjectType::Buffer;
|
||||
|
||||
const uint32_t iohOffset = dispatchInterface->getCrossThreadDataSize() + 4;
|
||||
const uint32_t surfaceStateOffset = 128;
|
||||
iOpenCL::SPatchStatelessGlobalMemoryObjectKernelArgument globalMemArg = {};
|
||||
globalMemArg.Token = iOpenCL::PATCH_TOKEN_STATELESS_GLOBAL_MEMORY_OBJECT_KERNEL_ARGUMENT;
|
||||
globalMemArg.ArgumentNumber = 0;
|
||||
globalMemArg.DataParamOffset = iohOffset;
|
||||
globalMemArg.DataParamSize = 4;
|
||||
globalMemArg.SurfaceStateHeapOffset = surfaceStateOffset;
|
||||
|
||||
auto surfaceStateOffsetOnHeap = static_cast<uint32_t>(alignUp(sizeUsed, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE)) + surfaceStateOffset;
|
||||
auto patchLocation = reinterpret_cast<uint32_t *>(ptrOffset(ioh->getCpuBase(), iohOffset));
|
||||
*patchLocation = 0xdead;
|
||||
|
||||
kernelTokens.tokens.kernelArgs[0].objectArg = &globalMemArg;
|
||||
|
||||
NEO::populateKernelDescriptor(dispatchInterface->kernelDescriptor, kernelTokens, sizeof(void *));
|
||||
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.bindingTable.numEntries = numBindingTable;
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.bindingTable.tableOffset = 0U;
|
||||
|
||||
auto &arg = dispatchInterface->kernelDescriptor.payloadMappings.explicitArgs[0].as<NEO::ArgDescPointer>();
|
||||
arg.bindless = iohOffset;
|
||||
arg.bindful = surfaceStateOffset;
|
||||
dispatchInterface->kernelDescriptor.kernelAttributes.bufferAddressingMode = KernelDescriptor::BindfulAndStateless;
|
||||
|
||||
const uint8_t *sshData = reinterpret_cast<uint8_t *>(&bindingTableState);
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSurfaceStateHeapData()).WillRepeatedly(::testing::Return(sshData));
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSurfaceStateHeapDataSize()).WillRepeatedly(::testing::Return(static_cast<uint32_t>(sizeof(BINDING_TABLE_STATE))));
|
||||
|
||||
auto usedBefore = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE)->getUsed();
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs);
|
||||
auto usedAfter = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE)->getUsed();
|
||||
|
||||
DataPortBindlessSurfaceExtendedMessageDescriptor extMessageDesc;
|
||||
extMessageDesc.setBindlessSurfaceOffset(surfaceStateOffsetOnHeap);
|
||||
|
||||
auto expectedOffset = extMessageDesc.getBindlessSurfaceOffsetToPatch();
|
||||
EXPECT_EQ(expectedOffset, *patchLocation);
|
||||
EXPECT_NE(usedAfter, usedBefore);
|
||||
}
|
||||
|
||||
HWTEST_F(EncodeDispatchKernelTest, givenBindlessImageArgWhenDispatchingKernelThenSurfaceStateOffsetInCrossThreadDataIsProgrammed) {
|
||||
HWTEST2_F(EncodeDispatchKernelTest, givenBindlessKernelWhenDispatchingKernelThenThenSshFromContainerIsNotUsed, Platforms) {
|
||||
using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE;
|
||||
using DataPortBindlessSurfaceExtendedMessageDescriptor = typename FamilyType::DataPortBindlessSurfaceExtendedMessageDescriptor;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
using WALKER = typename FamilyType::WALKER_TYPE;
|
||||
uint32_t numBindingTable = 1;
|
||||
BINDING_TABLE_STATE bindingTableState;
|
||||
bindingTableState.sInit();
|
||||
|
||||
auto ssh = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
auto ioh = cmdContainer->getIndirectHeap(HeapType::INDIRECT_OBJECT);
|
||||
|
||||
size_t sizeUsed = 0x20;
|
||||
ssh->getSpace(sizeUsed);
|
||||
sizeUsed = ssh->getUsed();
|
||||
|
||||
uint32_t dims[] = {1, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
std::vector<uint8_t> storage;
|
||||
NEO::PatchTokenBinary::KernelFromPatchtokens kernelTokens = PatchTokensTestData::ValidEmptyKernel::create(storage);
|
||||
kernelTokens.tokens.kernelArgs.resize(1);
|
||||
kernelTokens.tokens.kernelArgs[0].objectType = NEO::PatchTokenBinary::ArgObjectType::Image;
|
||||
|
||||
const uint32_t iohOffset = dispatchInterface->getCrossThreadDataSize() + 4;
|
||||
const uint32_t surfaceStateOffset = 128;
|
||||
|
||||
iOpenCL::SPatchImageMemoryObjectKernelArgument imageArg = {};
|
||||
imageArg.Token = iOpenCL::PATCH_TOKEN_IMAGE_MEMORY_OBJECT_KERNEL_ARGUMENT;
|
||||
imageArg.ArgumentNumber = 0;
|
||||
imageArg.Offset = surfaceStateOffset;
|
||||
|
||||
auto surfaceStateOffsetOnHeap = static_cast<uint32_t>(alignUp(sizeUsed, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE)) + surfaceStateOffset;
|
||||
auto patchLocation = reinterpret_cast<uint32_t *>(ptrOffset(ioh->getCpuBase(), iohOffset));
|
||||
*patchLocation = 0xdead;
|
||||
|
||||
kernelTokens.tokens.kernelArgs[0].objectArg = &imageArg;
|
||||
|
||||
NEO::populateKernelDescriptor(dispatchInterface->kernelDescriptor, kernelTokens, sizeof(void *));
|
||||
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.bindingTable.numEntries = numBindingTable;
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.bindingTable.tableOffset = 0U;
|
||||
|
||||
auto &arg = dispatchInterface->kernelDescriptor.payloadMappings.explicitArgs[0].as<NEO::ArgDescImage>();
|
||||
arg.bindless = iohOffset;
|
||||
arg.bindful = surfaceStateOffset;
|
||||
dispatchInterface->kernelDescriptor.kernelAttributes.bufferAddressingMode = KernelDescriptor::BindlessAndStateless;
|
||||
|
||||
const uint8_t *sshData = reinterpret_cast<uint8_t *>(&bindingTableState);
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSurfaceStateHeapData()).WillRepeatedly(::testing::Return(sshData));
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSurfaceStateHeapDataSize()).WillRepeatedly(::testing::Return(static_cast<uint32_t>(sizeof(BINDING_TABLE_STATE))));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
auto usedBefore = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE)->getUsed();
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs);
|
||||
auto usedAfter = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE)->getUsed();
|
||||
|
||||
DataPortBindlessSurfaceExtendedMessageDescriptor extMessageDesc;
|
||||
extMessageDesc.setBindlessSurfaceOffset(surfaceStateOffsetOnHeap);
|
||||
|
||||
auto expectedOffset = extMessageDesc.getBindlessSurfaceOffsetToPatch();
|
||||
EXPECT_EQ(expectedOffset, *patchLocation);
|
||||
EXPECT_EQ(usedAfter, usedBefore);
|
||||
}
|
||||
|
||||
HWTEST_F(EncodeDispatchKernelTest, givenNonBindlessOrStatelessArgWhenDispatchingKernelThenSurfaceStateOffsetInCrossThreadDataIsNotPatched) {
|
||||
@@ -1082,3 +1020,57 @@ HWCMDTEST_F(IGFX_GEN8_CORE, InterfaceDescriptorDataTests, givenVariousValuesWhen
|
||||
EncodeDispatchKernel<FamilyType>::programBarrierEnable(idd, 2, hwInfo);
|
||||
EXPECT_TRUE(idd.getBarrierEnable());
|
||||
}
|
||||
|
||||
using BindlessCommandEncodeStatesTest = Test<MemManagerFixture>;
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchingKernelWithSamplerThenGlobalDshInResidnecyContainer) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice);
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
uint32_t numSamplers = 1;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.numSamplers = numSamplers;
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.tableOffset = 0U;
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.borderColor = 0U;
|
||||
const uint8_t *dshData = reinterpret_cast<uint8_t *>(&samplerState);
|
||||
EXPECT_CALL(*dispatchInterface.get(), getDynamicStateHeapData()).WillRepeatedly(::testing::Return(dshData));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs);
|
||||
EXPECT_NE(std::find(cmdContainer->getResidencyContainer().begin(), cmdContainer->getResidencyContainer().end(), pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::GLOBAL_DSH)->getGraphicsAllocation()), cmdContainer->getResidencyContainer().end());
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, givenBindlessModeDisabledelWithSamplerThenGlobalDshIsNotResidnecyContainer) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(0);
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
uint32_t numSamplers = 1;
|
||||
SAMPLER_STATE samplerState;
|
||||
memset(&samplerState, 2, sizeof(SAMPLER_STATE));
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.numSamplers = numSamplers;
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.tableOffset = 0U;
|
||||
dispatchInterface->kernelDescriptor.payloadMappings.samplerTable.borderColor = 0U;
|
||||
const uint8_t *dshData = reinterpret_cast<uint8_t *>(&samplerState);
|
||||
EXPECT_CALL(*dispatchInterface.get(), getDynamicStateHeapData()).WillRepeatedly(::testing::Return(dshData));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs);
|
||||
EXPECT_EQ(std::find(cmdContainer->getResidencyContainer().begin(), cmdContainer->getResidencyContainer().end(), pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::GLOBAL_DSH)->getGraphicsAllocation()), cmdContainer->getResidencyContainer().end());
|
||||
}
|
||||
@@ -7,25 +7,132 @@
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
||||
#include "shared/test/unit_test/fixtures/front_window_fixture.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncodeStatesTest = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
HWTEST_F(CommandEncodeStatesTest, encodeCopySamplerState) {
|
||||
HWTEST_F(CommandEncodeStatesTest, GivenCommandStreamWhenEncodeCopySamplerStateThenIndirectStatePointerIsCorrect) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
SAMPLER_STATE samplerState;
|
||||
|
||||
auto dsh = cmdContainer->getIndirectHeap(HeapType::DYNAMIC_STATE);
|
||||
auto usedBefore = dsh->getUsed();
|
||||
auto samplerStateOffset = EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState);
|
||||
auto samplerStateOffset = EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr);
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(ptrOffset(dsh->getCpuBase(), samplerStateOffset));
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), usedBefore);
|
||||
}
|
||||
using BindlessCommandEncodeStatesTest = Test<MemManagerFixture>;
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithoutAlphaThenBorderColorPtrReturned) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getDefaultBorderColorOffset();
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), expectedValue);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWithAlphaThenBorderColorPtrOffseted) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(1.0);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getAlphaBorderColorOffset();
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), expectedValue);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRedChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorRed(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGreenChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorGreen(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBlueChanelIsNotZeroThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorBlue(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAlphaChanelIsNotZeroOrOneThenExceptionThrown) {
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
uint32_t numSamplers = 1;
|
||||
pDevice->bindlessHeapHelper.reset(new NEO::BindlessHeapsHelper(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex()));
|
||||
|
||||
uint32_t borderColorSize = 0x40;
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenUseAllocationAsInput) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
@@ -140,8 +140,9 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHepaHelperWhenGetDefaultBorderColo
|
||||
}
|
||||
|
||||
TEST_F(BindlessHeapsHelperTests, givenBindlessHepaHelperWhenGetAlphaBorderColorOffsetCalledThenCorrectOffsetReturned) {
|
||||
auto borderColorSize = 0x40;
|
||||
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumAvailableDevices() > 1, pDevice->getRootDeviceIndex());
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + 4 * sizeof(float);
|
||||
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + borderColorSize;
|
||||
EXPECT_EQ(bindlessHeapHelper->getAlphaBorderColorOffset(), expectedOffset);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user