@@ -30,13 +30,6 @@ struct ContextImp;
3030namespace ult {
3131class MockBuiltins ;
3232
33- struct ContextShareableMock : public L0 ::ContextImp {
34- ContextShareableMock (L0::DriverHandleImp *driverHandle) : L0::ContextImp(driverHandle) {}
35- bool isShareableMemory (const void *pNext, bool exportableMemory, NEO::Device *neoDevice) override {
36- return true ;
37- }
38- };
39-
4033struct DeviceFixture {
4134 NEO::MockCompilerEnableGuard compilerMock = NEO::MockCompilerEnableGuard(true );
4235 void SetUp (); // NOLINT(readability-identifier-naming)
@@ -149,8 +142,9 @@ struct MultipleDevicesWithCustomHwInfo {
149142 const uint32_t numSubDevices = 2u ;
150143};
151144
152- template <uint32_t copyEngineCount, uint32_t implicitScaling>
153- struct SingleRootMultiSubDeviceFixtureWithImplicitScaling : public MultiDeviceFixture {
145+ struct SingleRootMultiSubDeviceFixtureWithImplicitScalingImpl : public MultiDeviceFixture {
146+
147+ SingleRootMultiSubDeviceFixtureWithImplicitScalingImpl (uint32_t copyEngineCount, uint32_t implicitScaling) : implicitScaling(implicitScaling), expectedCopyEngineCount(copyEngineCount){};
154148 NEO::MockCompilerEnableGuard compilerMock = NEO::MockCompilerEnableGuard(true );
155149
156150 DebugManagerStateRestore restorer;
@@ -164,77 +158,20 @@ struct SingleRootMultiSubDeviceFixtureWithImplicitScaling : public MultiDeviceFi
164158 NEO::Device *neoDevice = nullptr ;
165159 L0::DeviceImp *deviceImp = nullptr ;
166160
167- NEO::HardwareInfo hwInfo;
168- uint32_t expectedCopyEngineCount = copyEngineCount;
161+ NEO::HardwareInfo hwInfo{};
162+ const uint32_t implicitScaling;
163+ const uint32_t expectedCopyEngineCount;
169164 uint32_t expectedComputeEngineCount = 0 ;
170165
171166 uint32_t numEngineGroups = 0 ;
172167 uint32_t subDeviceNumEngineGroups = 0 ;
173168
174- void SetUp () {
175- DebugManagerStateRestore restorer;
176- DebugManager.flags .EnableImplicitScaling .set (implicitScaling);
177- DebugManager.flags .CreateMultipleRootDevices .set (numRootDevices);
178- DebugManager.flags .CreateMultipleSubDevices .set (numSubDevices);
179-
180- NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get ();
181- hwInfo.featureTable .flags .ftrRcsNode = false ;
182- hwInfo.featureTable .flags .ftrCCSNode = true ;
183- // hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
184- if (expectedCopyEngineCount != 0 ) {
185- hwInfo.capabilityTable .blitterOperationsSupported = true ;
186- hwInfo.featureTable .ftrBcsInfo = maxNBitValue (expectedCopyEngineCount);
187- } else {
188- hwInfo.capabilityTable .blitterOperationsSupported = false ;
189- }
190-
191- if (implicitScaling) {
192- expectedComputeEngineCount = 1u ;
193- } else {
194- expectedComputeEngineCount = hwInfo.gtSystemInfo .CCSInfo .NumberOfCCSEnabled ;
195- }
196-
197- MockDevice *mockDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0 );
198-
199- NEO::DeviceVector devices;
200- devices.push_back (std::unique_ptr<NEO::Device>(mockDevice));
201-
202- driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
203- ze_result_t res = driverHandle->initialize (std::move (devices));
204- EXPECT_EQ (ZE_RESULT_SUCCESS, res);
205-
206- ze_context_handle_t hContext;
207- ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr , 0 };
208- res = driverHandle->createContext (&desc, 0u , nullptr , &hContext);
209- EXPECT_EQ (ZE_RESULT_SUCCESS, res);
210- context = static_cast <ContextImp *>(Context::fromHandle (hContext));
211-
212- device = driverHandle->devices [0 ];
213- neoDevice = device->getNEODevice ();
214- deviceImp = static_cast <L0::DeviceImp *>(device);
215-
216- NEO::Device *activeDevice = deviceImp->getActiveDevice ();
217- auto &engineGroups = activeDevice->getRegularEngineGroups ();
218- numEngineGroups = static_cast <uint32_t >(engineGroups.size ());
219-
220- if (activeDevice->getSubDevices ().size () > 0 ) {
221- NEO::Device *activeSubDevice = activeDevice->getSubDevice (0u );
222- (void )activeSubDevice;
223- auto &subDeviceEngineGroups = activeSubDevice->getRegularEngineGroups ();
224- (void )subDeviceEngineGroups;
225-
226- for (uint32_t i = 0 ; i < subDeviceEngineGroups.size (); i++) {
227- if (subDeviceEngineGroups[i].engineGroupType == NEO::EngineGroupType::Copy ||
228- subDeviceEngineGroups[i].engineGroupType == NEO::EngineGroupType::LinkedCopy) {
229- subDeviceNumEngineGroups += 1 ;
230- }
231- }
232- }
233- }
234-
235- void TearDown () {
236- context->destroy ();
237- }
169+ void SetUp ();
170+ void TearDown ();
171+ };
172+ template <uint32_t copyEngineCount, uint32_t implicitScalingArg>
173+ struct SingleRootMultiSubDeviceFixtureWithImplicitScaling : public SingleRootMultiSubDeviceFixtureWithImplicitScalingImpl {
174+ SingleRootMultiSubDeviceFixtureWithImplicitScaling () : SingleRootMultiSubDeviceFixtureWithImplicitScalingImpl(copyEngineCount, implicitScalingArg){};
238175};
239176
240177} // namespace ult
0 commit comments