fix: Unify logic calculating threads per work group part 2

- use calculateNumThreadsPerThreadGroup instead of getThreadsPerWG to
have same flow and proper values of threads per work groups

Related-To: NEO-8087
Signed-off-by: Cencelewska, Katarzyna <katarzyna.cencelewska@intel.com>
This commit is contained in:
Cencelewska, Katarzyna
2023-06-29 15:51:43 +00:00
committed by Compute-Runtime-Automation
parent c294ef48ce
commit 1e8a53bd53
19 changed files with 90 additions and 55 deletions

View File

@@ -6,11 +6,13 @@
*/
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_walk_order.h"
#include "shared/source/helpers/per_thread_data.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/kernel/implicit_args.h"
#include "shared/source/kernel/kernel_descriptor.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
@@ -117,8 +119,8 @@ TEST(ImplicitArgsHelperTest, givenImplicitArgsWithoutImplicitArgsBufferOffsetInP
uint8_t pattern = 0xcd;
memset(memoryToPatch.get(), pattern, totalSizeForPatching);
auto retVal = ImplicitArgsHelper::patchImplicitArgs(memoryToPatch.get(), implicitArgs, kernelDescriptor, {});
auto gfxCoreHelper = GfxCoreHelper::create(defaultHwInfo->platform.eRenderCoreFamily);
auto retVal = ImplicitArgsHelper::patchImplicitArgs(memoryToPatch.get(), implicitArgs, kernelDescriptor, {}, *gfxCoreHelper.get());
EXPECT_EQ(retVal, ptrOffset(memoryToPatch.get(), totalSizeForPatching));
@@ -158,8 +160,8 @@ TEST(ImplicitArgsHelperTest, givenImplicitArgsWithImplicitArgsBufferOffsetInPayl
uint8_t pattern = 0xcd;
memset(memoryToPatch.get(), pattern, totalSizeForPatching);
auto retVal = ImplicitArgsHelper::patchImplicitArgs(memoryToPatch.get(), implicitArgs, kernelDescriptor, {});
auto gfxCoreHelper = GfxCoreHelper::create(defaultHwInfo->platform.eRenderCoreFamily);
auto retVal = ImplicitArgsHelper::patchImplicitArgs(memoryToPatch.get(), implicitArgs, kernelDescriptor, {}, *gfxCoreHelper.get());
EXPECT_EQ(retVal, ptrOffset(memoryToPatch.get(), totalSizeForPatching));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,8 +7,11 @@
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/per_thread_data.h"
#include "shared/source/kernel/local_ids_cache.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/test.h"
@@ -35,7 +38,8 @@ using LocalIdsCacheTest = Test<LocalIdsCacheFixture>;
TEST_F(LocalIdsCacheTest, GivenCacheMissWhenGetLocalIdsForGroupThenNewEntryIsCommitedIntoLeastUsedEntry) {
localIdsCache->cache.resize(2);
localIdsCache->cache[0].accessCounter = 2U;
localIdsCache->setLocalIdsForGroup(groupSize, perThreadData.data());
auto gfxCoreHelper = NEO::GfxCoreHelper::create(NEO::defaultHwInfo->platform.eRenderCoreFamily);
localIdsCache->setLocalIdsForGroup(groupSize, perThreadData.data(), *gfxCoreHelper.get());
EXPECT_EQ(groupSize, localIdsCache->cache[1].groupSize);
EXPECT_NE(nullptr, localIdsCache->cache[1].localIdsData);
@@ -50,7 +54,8 @@ TEST_F(LocalIdsCacheTest, GivenEntryInCacheWhenGetLocalIdsForGroupThenEntryFromC
localIdsCache->cache[0].localIdsSize = 512U;
localIdsCache->cache[0].localIdsSizeAllocated = 512U;
localIdsCache->cache[0].accessCounter = 1U;
localIdsCache->setLocalIdsForGroup(groupSize, perThreadData.data());
auto gfxCoreHelper = NEO::GfxCoreHelper::create(NEO::defaultHwInfo->platform.eRenderCoreFamily);
localIdsCache->setLocalIdsForGroup(groupSize, perThreadData.data(), *gfxCoreHelper.get());
EXPECT_EQ(2U, localIdsCache->cache[0].accessCounter);
}
@@ -63,7 +68,8 @@ TEST_F(LocalIdsCacheTest, GivenEntryWithBiggerBufferAllocatedWhenGetLocalIdsForG
const auto localIdsData = localIdsCache->cache[0].localIdsData;
groupSize = {2, 1, 1};
localIdsCache->setLocalIdsForGroup(groupSize, perThreadData.data());
auto gfxCoreHelper = NEO::GfxCoreHelper::create(NEO::defaultHwInfo->platform.eRenderCoreFamily);
localIdsCache->setLocalIdsForGroup(groupSize, perThreadData.data(), *gfxCoreHelper.get());
EXPECT_EQ(1U, localIdsCache->cache[0].accessCounter);
EXPECT_EQ(192U, localIdsCache->cache[0].localIdsSize);
EXPECT_EQ(512U, localIdsCache->cache[0].localIdsSizeAllocated);