Skip to content

Commit b11f367

Browse files
Add missing getter methods
Signed-off-by: Maciej Dziuban <[email protected]>
1 parent 722a800 commit b11f367

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,19 +1147,28 @@ HWTEST_F(CommandStreamReceiverTest, whenCreatingCommandStreamReceiverThenLastAdd
11471147

11481148
HWTEST_F(CommandStreamReceiverTest, givenDebugFlagWhenCreatingCsrThenSetEnableStaticPartitioningAccordingly) {
11491149
DebugManagerStateRestore restore{};
1150+
11501151
{
1151-
MockDevice device{};
1152-
EXPECT_FALSE(device.getUltCommandStreamReceiver<FamilyType>().staticWorkPartitioningEnabled);
1152+
UltDeviceFactory deviceFactory{1, 2};
1153+
MockDevice &device = *deviceFactory.rootDevices[0];
1154+
EXPECT_FALSE(device.getGpgpuCommandStreamReceiver().isStaticWorkPartitioningEnabled());
1155+
EXPECT_EQ(0u, device.getGpgpuCommandStreamReceiver().getWorkPartitionAllocationGpuAddress());
11531156
}
11541157
{
11551158
DebugManager.flags.EnableStaticPartitioning.set(0);
1156-
MockDevice device{};
1157-
EXPECT_FALSE(device.getUltCommandStreamReceiver<FamilyType>().staticWorkPartitioningEnabled);
1159+
UltDeviceFactory deviceFactory{1, 2};
1160+
MockDevice &device = *deviceFactory.rootDevices[0];
1161+
EXPECT_FALSE(device.getGpgpuCommandStreamReceiver().isStaticWorkPartitioningEnabled());
1162+
EXPECT_EQ(0u, device.getGpgpuCommandStreamReceiver().getWorkPartitionAllocationGpuAddress());
11581163
}
11591164
{
11601165
DebugManager.flags.EnableStaticPartitioning.set(1);
1161-
MockDevice device{};
1162-
EXPECT_TRUE(device.getUltCommandStreamReceiver<FamilyType>().staticWorkPartitioningEnabled);
1166+
UltDeviceFactory deviceFactory{1, 2};
1167+
MockDevice &device = *deviceFactory.rootDevices[0];
1168+
EXPECT_TRUE(device.getGpgpuCommandStreamReceiver().isStaticWorkPartitioningEnabled());
1169+
EXPECT_NE(0u, device.getGpgpuCommandStreamReceiver().getWorkPartitionAllocationGpuAddress());
1170+
const auto gpuVa = device.getGpgpuCommandStreamReceiver().getWorkPartitionAllocation()->getGpuAddress();
1171+
EXPECT_EQ(gpuVa, device.getGpgpuCommandStreamReceiver().getWorkPartitionAllocationGpuAddress());
11631172
}
11641173
}
11651174

shared/source/command_stream/command_stream_receiver.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ OSInterface *CommandStreamReceiver::getOSInterface() const {
187187
return executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface.get();
188188
}
189189

190+
uint64_t CommandStreamReceiver::getWorkPartitionAllocationGpuAddress() const {
191+
if (isStaticWorkPartitioningEnabled()) {
192+
return getWorkPartitionAllocation()->getGpuAddress();
193+
}
194+
return 0;
195+
}
196+
190197
bool CommandStreamReceiver::isRcs() const {
191198
return this->osContext->getEngineType() == aub_stream::ENGINE_RCS;
192199
}

shared/source/command_stream/command_stream_receiver.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ class CommandStreamReceiver {
228228
return false;
229229
}
230230

231+
bool isStaticWorkPartitioningEnabled() const {
232+
return staticWorkPartitioningEnabled;
233+
}
234+
235+
uint64_t getWorkPartitionAllocationGpuAddress() const;
236+
231237
bool isRcs() const;
232238

233239
virtual void initializeDefaultsForInternalEngine(){};

0 commit comments

Comments
 (0)