3434#include " shared/test/common/mocks/mock_l0_debugger.h"
3535#include " shared/test/common/mocks/mock_memory_operations_handler.h"
3636#include " shared/test/common/mocks/mock_modules_zebin.h"
37- #include " shared/test/common/mocks/mock_product_helper.h"
3837#include " shared/test/common/test_macros/hw_test.h"
3938
4039#include " level_zero/core/source/kernel/kernel_imp.h"
@@ -175,6 +174,7 @@ HWTEST_F(ModuleTest, givenUserModuleWhenCreatedThenCorrectAllocationTypeIsUsedFo
175174
176175template <bool localMemEnabled>
177176struct ModuleKernelIsaAllocationsFixture : public ModuleFixture {
177+ static constexpr size_t isaAllocationPageSize = (localMemEnabled ? MemoryConstants::pageSize64k : MemoryConstants::pageSize);
178178 using Module = WhiteBox<::L0::Module>;
179179
180180 void setUp () {
@@ -209,7 +209,7 @@ struct ModuleKernelIsaAllocationsFixture : public ModuleFixture {
209209 void givenSeparateIsaMemoryRegionPerKernelWhenGraphicsAllocationFailsThenProperErrorReturned () {
210210 mockModule->allocateKernelsIsaMemoryCallBase = false ;
211211 mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingCallBase = false ;
212- mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingResult = this -> mockModule -> getIsaAllocationPageSize () ;
212+ mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingResult = isaAllocationPageSize ;
213213
214214 auto result = module ->initialize (&this ->moduleDesc , device->getNEODevice ());
215215 EXPECT_EQ (result, ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY);
@@ -793,35 +793,6 @@ HWTEST_F(ModuleTest, whenMultipleModulesCreatedThenModulesShareIsaAllocation) {
793793 }
794794};
795795
796- TEST_F (ModuleTest, GivenLocalMemoryEnabledOrDisabledAnd2MBAlignmentEnabledOrDisabledWhenGettingIsaAllocationPageSizeThenCorrectValueIsReturned) {
797- DebugManagerStateRestore restorer;
798- auto mockProductHelper = new MockProductHelper;
799-
800- device->getNEODevice ()->getRootDeviceEnvironmentRef ().productHelper .reset (mockProductHelper);
801-
802- MockModule mockModule{device, nullptr , ModuleType::user};
803- EXPECT_EQ (mockModule.getIsaAllocationPageSize (), mockModule.isaAllocationPageSize );
804-
805- {
806- debugManager.flags .EnableLocalMemory .set (0 );
807- mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true ;
808-
809- EXPECT_EQ (MemoryConstants::pageSize, mockModule.getIsaAllocationPageSize ());
810- }
811- {
812- debugManager.flags .EnableLocalMemory .set (1 );
813- mockProductHelper->is2MBLocalMemAlignmentEnabledResult = true ;
814-
815- EXPECT_EQ (MemoryConstants::pageSize2M, mockModule.getIsaAllocationPageSize ());
816- }
817- {
818- debugManager.flags .EnableLocalMemory .set (1 );
819- mockProductHelper->is2MBLocalMemAlignmentEnabledResult = false ;
820-
821- EXPECT_EQ (MemoryConstants::pageSize64k, mockModule.getIsaAllocationPageSize ());
822- }
823- }
824-
825796template <typename T1, typename T2>
826797struct ModuleSpecConstantsFixture : public DeviceFixture {
827798 void setUp () {
@@ -4077,6 +4048,7 @@ TEST_F(ModuleTest, whenContainsStatefulAccessIsCalledThenResultIsCorrect) {
40774048
40784049template <bool localMemEnabled>
40794050struct ModuleIsaAllocationsFixture : public DeviceFixture {
4051+ static constexpr size_t isaAllocationPageSize = (localMemEnabled ? MemoryConstants::pageSize64k : MemoryConstants::pageSize);
40804052 static constexpr NEO::MemoryPool isaAllocationMemoryPool = (localMemEnabled ? NEO::MemoryPool::localMemory : NEO::MemoryPool::system4KBPagesWith32BitGpuAddressing);
40814053
40824054 void setUp () {
@@ -4092,7 +4064,6 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture {
40924064 this ->mockMemoryManager ->localMemorySupported [this ->neoDevice ->getRootDeviceIndex ()] = true ;
40934065 this ->mockModule .reset (new MockModule{this ->device , nullptr , ModuleType::user});
40944066 this ->mockModule ->translationUnit .reset (new MockModuleTranslationUnit{this ->device });
4095- this ->isaAllocationPageSize = this ->mockModule ->getIsaAllocationPageSize ();
40964067 }
40974068
40984069 void tearDown () {
@@ -4148,8 +4119,8 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture {
41484119 EXPECT_EQ (kernelImmDatas[1 ]->getIsaOffsetInParentAllocation (), 0lu);
41494120 EXPECT_EQ (kernelImmDatas[1 ]->getIsaSubAllocationSize (), 0lu);
41504121 if constexpr (localMemEnabled) {
4151- EXPECT_EQ (alignUp< size_t >(maxAllocationSizeInPage, MemoryConstants::pageSize64k) , kernelImmDatas[0 ]->getIsaSize ());
4152- EXPECT_EQ (alignUp< size_t >(tinyAllocationSize, MemoryConstants::pageSize64k) , kernelImmDatas[1 ]->getIsaSize ());
4122+ EXPECT_EQ (isaAllocationPageSize , kernelImmDatas[0 ]->getIsaSize ());
4123+ EXPECT_EQ (isaAllocationPageSize , kernelImmDatas[1 ]->getIsaSize ());
41534124 } else {
41544125 EXPECT_EQ (this ->computeKernelIsaAllocationSizeWithPadding (maxAllocationSizeInPage), kernelImmDatas[0 ]->getIsaSize ());
41554126 EXPECT_EQ (this ->computeKernelIsaAllocationSizeWithPadding (tinyAllocationSize), kernelImmDatas[1 ]->getIsaSize ());
@@ -4196,7 +4167,6 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture {
41964167
41974168 size_t isaPadding;
41984169 size_t kernelStartPointerAlignment;
4199- size_t isaAllocationPageSize;
42004170 NEO::Device *neoDevice = nullptr ;
42014171 MockMemoryManager *mockMemoryManager = nullptr ;
42024172 std::unique_ptr<MockModule> mockModule = nullptr ;
0 commit comments