mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
refactor: create helper for maxPtssIndex
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d3f28b92c9
commit
e9f7df6ae6
@@ -467,7 +467,8 @@ HWTEST_F(GfxCoreHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvid
|
||||
EXPECT_EQ(length.surfaceState.depth + 1u, state->getDepth());
|
||||
EXPECT_EQ(length.surfaceState.width + 1u, state->getWidth());
|
||||
EXPECT_EQ(length.surfaceState.height + 1u, state->getHeight());
|
||||
EXPECT_EQ(pitch, EncodeSurfaceState<FamilyType>::getPitchForScratchInBytes(state));
|
||||
const auto &productHelper = getHelper<ProductHelper>();
|
||||
EXPECT_EQ(pitch, EncodeSurfaceState<FamilyType>::getPitchForScratchInBytes(state, productHelper));
|
||||
addr += offset;
|
||||
EXPECT_EQ(addr, state->getSurfaceBaseAddress());
|
||||
EXPECT_EQ(type, state->getSurfaceType());
|
||||
@@ -1293,9 +1294,10 @@ HWTEST_F(GfxCoreHelperTest, givenGetRenderSurfaceStatePitchCalledThenCorrectValu
|
||||
|
||||
RENDER_SURFACE_STATE renderSurfaceState;
|
||||
uint32_t expectedPitch = 0x400;
|
||||
EncodeSurfaceState<FamilyType>::setPitchForScratch(&renderSurfaceState, expectedPitch);
|
||||
const auto &productHelper = getHelper<ProductHelper>();
|
||||
EncodeSurfaceState<FamilyType>::setPitchForScratch(&renderSurfaceState, expectedPitch, productHelper);
|
||||
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
EXPECT_EQ(expectedPitch, gfxCoreHelper.getRenderSurfaceStatePitch(&renderSurfaceState));
|
||||
EXPECT_EQ(expectedPitch, gfxCoreHelper.getRenderSurfaceStatePitch(&renderSurfaceState, productHelper));
|
||||
}
|
||||
|
||||
HWTEST_F(GfxCoreHelperTest, whenBlitterSupportIsDisabledThenDontExposeAnyBcsEngine) {
|
||||
@@ -1765,3 +1767,9 @@ HWTEST_F(GfxCoreHelperTest, givenEncodeDispatchKernelWhenUsingGfxHelperThenSameD
|
||||
EXPECT_EQ(encoderReturn, helperReturn);
|
||||
EXPECT_EQ(requiredWalkOrder, helperRequiredWalkOrder);
|
||||
}
|
||||
|
||||
HWTEST_F(GfxCoreHelperTest, whenCallGetMaxPtssIndexThenCorrectValue) {
|
||||
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
||||
const auto &productHelper = getHelper<ProductHelper>();
|
||||
EXPECT_EQ(15u, gfxCoreHelper.getMaxPtssIndex(productHelper));
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ TEST_F(KernelHelperTest, GivenScratchSizeGreaterThanGlobalSizeWhenCheckingIfTher
|
||||
KernelDescriptor::KernelAttributes attributes = {};
|
||||
attributes.perThreadScratchSize[0] = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
if (attributes.perThreadScratchSize[0] > gfxCoreHelper.getMaxScratchSize()) {
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
if (attributes.perThreadScratchSize[0] > gfxCoreHelper.getMaxScratchSize(productHelper)) {
|
||||
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::invalidKernel);
|
||||
} else {
|
||||
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::outOfDeviceMemory);
|
||||
@@ -160,7 +161,8 @@ TEST_F(KernelHelperTest, GivenScratchPrivateSizeGreaterThanGlobalSizeWhenCheckin
|
||||
KernelDescriptor::KernelAttributes attributes = {};
|
||||
attributes.perThreadScratchSize[1] = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) + 100;
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
if (attributes.perThreadScratchSize[1] > gfxCoreHelper.getMaxScratchSize()) {
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
if (attributes.perThreadScratchSize[1] > gfxCoreHelper.getMaxScratchSize(productHelper)) {
|
||||
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::invalidKernel);
|
||||
} else {
|
||||
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::outOfDeviceMemory);
|
||||
@@ -173,7 +175,8 @@ TEST_F(KernelHelperTest, GivenScratchAndPrivateSizeLessThanGlobalSizeWhenCheckin
|
||||
auto size = (static_cast<uint32_t>((globalSize + pDevice->getDeviceInfo().computeUnitsUsedForScratch) / pDevice->getDeviceInfo().computeUnitsUsedForScratch)) - 100;
|
||||
attributes.perHwThreadPrivateMemorySize = size;
|
||||
auto &gfxCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||
uint32_t maxScratchSize = gfxCoreHelper.getMaxScratchSize();
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
uint32_t maxScratchSize = gfxCoreHelper.getMaxScratchSize(productHelper);
|
||||
attributes.perThreadScratchSize[0] = (size > maxScratchSize) ? maxScratchSize : size;
|
||||
attributes.perThreadScratchSize[1] = (size > maxScratchSize) ? maxScratchSize : size;
|
||||
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::success);
|
||||
@@ -182,7 +185,8 @@ TEST_F(KernelHelperTest, GivenScratchAndPrivateSizeLessThanGlobalSizeWhenCheckin
|
||||
TEST_F(KernelHelperTest, GivenScratchSizeGreaterThanMaxScratchSizeWhenCheckingIfThereIsEnaughSpaceThenInvalidKernelIsReturned) {
|
||||
KernelDescriptor::KernelAttributes attributes = {};
|
||||
auto &gfxCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||
uint32_t maxScratchSize = gfxCoreHelper.getMaxScratchSize();
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
uint32_t maxScratchSize = gfxCoreHelper.getMaxScratchSize(productHelper);
|
||||
attributes.perHwThreadPrivateMemorySize = 0x10;
|
||||
attributes.perThreadScratchSize[0] = maxScratchSize + 1;
|
||||
attributes.perThreadScratchSize[1] = 0x10;
|
||||
@@ -192,7 +196,8 @@ TEST_F(KernelHelperTest, GivenScratchSizeGreaterThanMaxScratchSizeWhenCheckingIf
|
||||
TEST_F(KernelHelperTest, GivenScratchPrivateSizeGreaterThanMaxScratchSizeWhenCheckingIfThereIsEnaughSpaceThenInvalidKernelIsReturned) {
|
||||
KernelDescriptor::KernelAttributes attributes = {};
|
||||
auto &gfxCoreHelper = pDevice->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||
uint32_t maxScratchSize = gfxCoreHelper.getMaxScratchSize();
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
uint32_t maxScratchSize = gfxCoreHelper.getMaxScratchSize(productHelper);
|
||||
attributes.perHwThreadPrivateMemorySize = 0x10;
|
||||
attributes.perThreadScratchSize[0] = 0x10;
|
||||
attributes.perThreadScratchSize[1] = maxScratchSize + 1;
|
||||
|
||||
Reference in New Issue
Block a user