mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add warning when SLM is not enough for kernel
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
02cf62902b
commit
f7b3b20f81
@ -41,6 +41,80 @@ TEST(localWorkSizeTest, givenDisableEUFusionWhenCreatingWorkSizeInfoThenCorrectM
|
||||
EXPECT_EQ(expectedMinWGS, wsInfo.minWorkGroupSize);
|
||||
}
|
||||
|
||||
TEST(localWorkSizeTest, GivenSlmLargerThanLocalThenWarningIsReturned) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.PrintDebugMessages.set(true);
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
EXPECT_THROW(WorkSizeInfo wsInfo(256, // maxWorkGroupSize
|
||||
1u, // hasBariers
|
||||
8, // simdSize
|
||||
128u, // slmTotalSize
|
||||
defaultHwInfo.get(), // hardwareInfo
|
||||
32u, // numThreadsPerSubSlice
|
||||
64u, // localMemorySize
|
||||
false, // imgUsed
|
||||
false, // yTiledSurface
|
||||
false // disableEUFusion
|
||||
),
|
||||
std::exception);
|
||||
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
EXPECT_EQ(std::string("Size of SLM (128) larger than available (64)\n"), output);
|
||||
}
|
||||
|
||||
TEST(localWorkSizeTest, GivenSlmSmallerThanLocalThenWarningIsNotReturned) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.PrintDebugMessages.set(true);
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
WorkSizeInfo wsInfo(256, // maxWorkGroupSize
|
||||
1u, // hasBariers
|
||||
8, // simdSize
|
||||
64u, // slmTotalSize
|
||||
defaultHwInfo.get(), // hardwareInfo
|
||||
32u, // numThreadsPerSubSlice
|
||||
128u, // localMemorySize
|
||||
false, // imgUsed
|
||||
false, // yTiledSurface
|
||||
false // disableEUFusion
|
||||
);
|
||||
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
EXPECT_EQ(std::string(""), output);
|
||||
}
|
||||
|
||||
TEST(localWorkSizeTest, whenSettingHasBarriersWithNoFusedDispatchThenMinWorkGroupSizeIsSetCorrectly) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.CFEFusedEUDispatch.set(0);
|
||||
|
||||
WorkSizeInfo wsInfo0(256, // maxWorkGroupSize
|
||||
0u, // hasBariers
|
||||
8, // simdSize
|
||||
0u, // slmTotalSize
|
||||
defaultHwInfo.get(), // hardwareInfo
|
||||
32u, // numThreadsPerSubSlice
|
||||
128u, // localMemorySize
|
||||
false, // imgUsed
|
||||
false, // yTiledSurface
|
||||
false // disableEUFusion
|
||||
);
|
||||
EXPECT_EQ(0u, wsInfo0.minWorkGroupSize);
|
||||
|
||||
WorkSizeInfo wsInfo1(256, // maxWorkGroupSize
|
||||
1u, // hasBariers
|
||||
8, // simdSize
|
||||
0u, // slmTotalSize
|
||||
defaultHwInfo.get(), // hardwareInfo
|
||||
32u, // numThreadsPerSubSlice
|
||||
128u, // localMemorySize
|
||||
false, // imgUsed
|
||||
false, // yTiledSurface
|
||||
false // disableEUFusion
|
||||
);
|
||||
EXPECT_NE(0u, wsInfo1.minWorkGroupSize);
|
||||
}
|
||||
|
||||
TEST(localWorkSizeTest, given3DimWorkGroupAndSimdEqual8AndBarriersWhenComputeCalledThenLocalGroupComputedCorrectly) {
|
||||
WorkSizeInfo wsInfo(256, // maxWorkGroupSize
|
||||
1u, // hasBariers
|
||||
|
@ -61,6 +61,9 @@ void WorkSizeInfo::setMinWorkGroupSize(const HardwareInfo *hwInfo, bool disableE
|
||||
minWorkGroupSize = numThreadsPerSubSlice * simdSize / maxBarriersPerHSlice;
|
||||
}
|
||||
if (slmTotalSize > 0) {
|
||||
if (localMemSize < slmTotalSize) {
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Size of SLM (%d) larger than available (%d)\n", slmTotalSize, localMemSize);
|
||||
}
|
||||
UNRECOVERABLE_IF(localMemSize < slmTotalSize);
|
||||
minWorkGroupSize = std::max(maxWorkGroupSize / ((localMemSize / slmTotalSize)), minWorkGroupSize);
|
||||
}
|
||||
|
Reference in New Issue
Block a user