34
34
#include " shared/test/common/mocks/mock_l0_debugger.h"
35
35
#include " shared/test/common/mocks/mock_memory_operations_handler.h"
36
36
#include " shared/test/common/mocks/mock_modules_zebin.h"
37
- #include " shared/test/common/mocks/mock_product_helper.h"
38
37
#include " shared/test/common/test_macros/hw_test.h"
39
38
40
39
#include " level_zero/core/source/kernel/kernel_imp.h"
@@ -175,6 +174,7 @@ HWTEST_F(ModuleTest, givenUserModuleWhenCreatedThenCorrectAllocationTypeIsUsedFo
175
174
176
175
template <bool localMemEnabled>
177
176
struct ModuleKernelIsaAllocationsFixture : public ModuleFixture {
177
+ static constexpr size_t isaAllocationPageSize = (localMemEnabled ? MemoryConstants::pageSize64k : MemoryConstants::pageSize);
178
178
using Module = WhiteBox<::L0::Module>;
179
179
180
180
void setUp () {
@@ -209,7 +209,7 @@ struct ModuleKernelIsaAllocationsFixture : public ModuleFixture {
209
209
void givenSeparateIsaMemoryRegionPerKernelWhenGraphicsAllocationFailsThenProperErrorReturned () {
210
210
mockModule->allocateKernelsIsaMemoryCallBase = false ;
211
211
mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingCallBase = false ;
212
- mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingResult = this -> mockModule -> getIsaAllocationPageSize () ;
212
+ mockModule->computeKernelIsaAllocationAlignedSizeWithPaddingResult = isaAllocationPageSize ;
213
213
214
214
auto result = module ->initialize (&this ->moduleDesc , device->getNEODevice ());
215
215
EXPECT_EQ (result, ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY);
@@ -793,35 +793,6 @@ HWTEST_F(ModuleTest, whenMultipleModulesCreatedThenModulesShareIsaAllocation) {
793
793
}
794
794
};
795
795
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
-
825
796
template <typename T1, typename T2>
826
797
struct ModuleSpecConstantsFixture : public DeviceFixture {
827
798
void setUp () {
@@ -4077,6 +4048,7 @@ TEST_F(ModuleTest, whenContainsStatefulAccessIsCalledThenResultIsCorrect) {
4077
4048
4078
4049
template <bool localMemEnabled>
4079
4050
struct ModuleIsaAllocationsFixture : public DeviceFixture {
4051
+ static constexpr size_t isaAllocationPageSize = (localMemEnabled ? MemoryConstants::pageSize64k : MemoryConstants::pageSize);
4080
4052
static constexpr NEO::MemoryPool isaAllocationMemoryPool = (localMemEnabled ? NEO::MemoryPool::localMemory : NEO::MemoryPool::system4KBPagesWith32BitGpuAddressing);
4081
4053
4082
4054
void setUp () {
@@ -4092,7 +4064,6 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture {
4092
4064
this ->mockMemoryManager ->localMemorySupported [this ->neoDevice ->getRootDeviceIndex ()] = true ;
4093
4065
this ->mockModule .reset (new MockModule{this ->device , nullptr , ModuleType::user});
4094
4066
this ->mockModule ->translationUnit .reset (new MockModuleTranslationUnit{this ->device });
4095
- this ->isaAllocationPageSize = this ->mockModule ->getIsaAllocationPageSize ();
4096
4067
}
4097
4068
4098
4069
void tearDown () {
@@ -4148,8 +4119,8 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture {
4148
4119
EXPECT_EQ (kernelImmDatas[1 ]->getIsaOffsetInParentAllocation (), 0lu);
4149
4120
EXPECT_EQ (kernelImmDatas[1 ]->getIsaSubAllocationSize (), 0lu);
4150
4121
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 ());
4153
4124
} else {
4154
4125
EXPECT_EQ (this ->computeKernelIsaAllocationSizeWithPadding (maxAllocationSizeInPage), kernelImmDatas[0 ]->getIsaSize ());
4155
4126
EXPECT_EQ (this ->computeKernelIsaAllocationSizeWithPadding (tinyAllocationSize), kernelImmDatas[1 ]->getIsaSize ());
@@ -4196,7 +4167,6 @@ struct ModuleIsaAllocationsFixture : public DeviceFixture {
4196
4167
4197
4168
size_t isaPadding;
4198
4169
size_t kernelStartPointerAlignment;
4199
- size_t isaAllocationPageSize;
4200
4170
NEO::Device *neoDevice = nullptr ;
4201
4171
MockMemoryManager *mockMemoryManager = nullptr ;
4202
4172
std::unique_ptr<MockModule> mockModule = nullptr ;
0 commit comments