Skip to content

Commit 7eb5d56

Browse files
feature: query wmtp capability from xe engine
Related-To: NEO-10445 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 432ecbc commit 7eb5d56

File tree

8 files changed

+43
-6
lines changed

8 files changed

+43
-6
lines changed

shared/source/os_interface/linux/engine_info.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ void EngineInfo::mapEngine(const NEO::IoctlHelper *ioctlHelper, const EngineCapa
8484
engineCounters.numComputeEngines++;
8585
}
8686
if (engineType != aub_stream::EngineType::NUM_ENGINES) {
87+
if (engineInfo.capabilities.wmtpSupport) {
88+
auto &wmtpInfoMask = rootDeviceEnvironment.getMutableHardwareInfo()->featureTable.wmtpInfoMask;
89+
wmtpInfoMask.set(static_cast<uint32_t>(engineType));
90+
}
8791
tileToEngineToInstanceMap[tileId][engineType] = engine;
8892
}
8993
}

shared/source/os_interface/linux/ioctl_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct EngineCapabilities {
5151
struct Flags {
5252
bool copyClassSaturatePCIE;
5353
bool copyClassSaturateLink;
54+
bool wmtpSupport;
5455
};
5556
Flags capabilities;
5657
};

shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ std::unique_ptr<EngineInfo> IoctlHelperXe::createEngineInfo(bool isSysmanEnabled
254254
if (enginesPerTile.size() <= tile) {
255255
enginesPerTile.resize(tile + 1);
256256
}
257-
enginesPerTile[tile].push_back({engineClassInstance, {}});
257+
EngineCapabilities::Flags engineFlags{};
258+
engineFlags.wmtpSupport = isValueSet(queryEngines->engines[i].capabilities, DRM_XE_ENGINE_CAPABILITY_WMTP);
259+
enginesPerTile[tile].push_back({engineClassInstance, engineFlags});
258260
if (!defaultEngine && engineClassInstance.engineClass == defaultEngineClass) {
259261
defaultEngine = std::make_unique<drm_xe_engine_class_instance>();
260262
*defaultEngine = engine;

shared/source/sku_info/sku_info_base.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77

88
#pragma once
99

10+
#include "aubstream/engine_node.h"
11+
1012
#include <array>
1113
#include <bitset>
1214
#include <cstdint>
1315

1416
namespace NEO {
1517
constexpr size_t bcsInfoMaskSize = 9u;
1618
using BcsInfoMask = std::bitset<bcsInfoMaskSize>;
19+
using WmtpInfoMask = std::bitset<aub_stream::EngineType::NUM_ENGINES>;
1720

1821
struct FeatureTableBase {
1922
public:
@@ -75,6 +78,7 @@ struct FeatureTableBase {
7578
};
7679

7780
BcsInfoMask ftrBcsInfo = 1;
81+
WmtpInfoMask wmtpInfoMask{};
7882

7983
union {
8084
Flags flags;

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,23 @@ TEST(IoctlHelperXeTest, givenMissingSupportedTopologiesWhenGetTopologyDataAndMap
11771177
EXPECT_FALSE(result);
11781178
}
11791179

1180+
TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenWmtpInfoMaskIsProperlySet) {
1181+
DebugManagerStateRestore restorer;
1182+
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
1183+
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
1184+
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
1185+
xeIoctlHelper->initialize();
1186+
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
1187+
EXPECT_EQ(0u, hwInfo.featureTable.wmtpInfoMask.to_ulong());
1188+
auto engineInfo = xeIoctlHelper->createEngineInfo(false);
1189+
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS)));
1190+
EXPECT_TRUE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS1)));
1191+
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS2)));
1192+
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS3)));
1193+
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_RCS)));
1194+
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCCS)));
1195+
}
1196+
11801197
TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenProperEnginesAreDiscovered) {
11811198
DebugManagerStateRestore restorer;
11821199
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ struct DrmMockXe : public DrmMockCustom {
342342
xeQueryEngines->engines[1] = {{DRM_XE_ENGINE_CLASS_COPY, 1, 0}, {}};
343343
xeQueryEngines->engines[2] = {{DRM_XE_ENGINE_CLASS_COPY, 2, 0}, {}};
344344
xeQueryEngines->engines[3] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 3, 0}, {}};
345-
xeQueryEngines->engines[4] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0}, {}};
345+
xeQueryEngines->engines[4] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0}, DRM_XE_ENGINE_CAPABILITY_WMTP};
346346
xeQueryEngines->engines[5] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 5, 1}, {}};
347-
xeQueryEngines->engines[6] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1}, {}};
347+
xeQueryEngines->engines[6] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1}, DRM_XE_ENGINE_CAPABILITY_WMTP};
348348
xeQueryEngines->engines[7] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 7, 1}, {}};
349349
xeQueryEngines->engines[8] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 8, 1}, {}};
350350
xeQueryEngines->engines[9] = {{DRM_XE_ENGINE_CLASS_VIDEO_DECODE, 9, 1}, {}};

third_party/uapi/xe/.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch: https://patchwork.freedesktop.org/patch/604493/?series=13613

third_party/uapi/xe/xe_drm.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,21 @@ struct drm_xe_engine_class_instance {
243243

244244
/**
245245
* struct drm_xe_engine - describe hardware engine
246-
*/
246+
*
247+
* The @capabilities can be:
248+
* - DRM_XE_ENGINE_CAPABILITY_WMTP - represents a engine's mid-thread
249+
* preemption capability.
250+
*/
247251
struct drm_xe_engine {
248252
/** @instance: The @drm_xe_engine_class_instance */
249253
struct drm_xe_engine_class_instance instance;
250-
254+
#define DRM_XE_ENGINE_CAPABILITY_WMTP 1
255+
/** @capabilities: Capabilities of this engine. */
256+
__u32 capabilities;
257+
/** @pad: MBZ */
258+
__u32 pad;
251259
/** @reserved: Reserved */
252-
__u64 reserved[3];
260+
__u64 reserved[2];
253261
};
254262

255263
/**

0 commit comments

Comments
 (0)