Skip to content

Commit

Permalink
feature: query wmtp capability from xe engine
Browse files Browse the repository at this point in the history
Related-To: NEO-10445
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
  • Loading branch information
JablonskiMateusz committed Jul 16, 2024
1 parent 432ecbc commit 7eb5d56
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 6 deletions.
4 changes: 4 additions & 0 deletions shared/source/os_interface/linux/engine_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ void EngineInfo::mapEngine(const NEO::IoctlHelper *ioctlHelper, const EngineCapa
engineCounters.numComputeEngines++;
}
if (engineType != aub_stream::EngineType::NUM_ENGINES) {
if (engineInfo.capabilities.wmtpSupport) {
auto &wmtpInfoMask = rootDeviceEnvironment.getMutableHardwareInfo()->featureTable.wmtpInfoMask;
wmtpInfoMask.set(static_cast<uint32_t>(engineType));
}
tileToEngineToInstanceMap[tileId][engineType] = engine;
}
}
Expand Down
1 change: 1 addition & 0 deletions shared/source/os_interface/linux/ioctl_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct EngineCapabilities {
struct Flags {
bool copyClassSaturatePCIE;
bool copyClassSaturateLink;
bool wmtpSupport;
};
Flags capabilities;
};
Expand Down
4 changes: 3 additions & 1 deletion shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ std::unique_ptr<EngineInfo> IoctlHelperXe::createEngineInfo(bool isSysmanEnabled
if (enginesPerTile.size() <= tile) {
enginesPerTile.resize(tile + 1);
}
enginesPerTile[tile].push_back({engineClassInstance, {}});
EngineCapabilities::Flags engineFlags{};
engineFlags.wmtpSupport = isValueSet(queryEngines->engines[i].capabilities, DRM_XE_ENGINE_CAPABILITY_WMTP);
enginesPerTile[tile].push_back({engineClassInstance, engineFlags});
if (!defaultEngine && engineClassInstance.engineClass == defaultEngineClass) {
defaultEngine = std::make_unique<drm_xe_engine_class_instance>();
*defaultEngine = engine;
Expand Down
4 changes: 4 additions & 0 deletions shared/source/sku_info/sku_info_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

#pragma once

#include "aubstream/engine_node.h"

#include <array>
#include <bitset>
#include <cstdint>

namespace NEO {
constexpr size_t bcsInfoMaskSize = 9u;
using BcsInfoMask = std::bitset<bcsInfoMaskSize>;
using WmtpInfoMask = std::bitset<aub_stream::EngineType::NUM_ENGINES>;

struct FeatureTableBase {
public:
Expand Down Expand Up @@ -75,6 +78,7 @@ struct FeatureTableBase {
};

BcsInfoMask ftrBcsInfo = 1;
WmtpInfoMask wmtpInfoMask{};

union {
Flags flags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,23 @@ TEST(IoctlHelperXeTest, givenMissingSupportedTopologiesWhenGetTopologyDataAndMap
EXPECT_FALSE(result);
}

TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenWmtpInfoMaskIsProperlySet) {
DebugManagerStateRestore restorer;
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
xeIoctlHelper->initialize();
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
EXPECT_EQ(0u, hwInfo.featureTable.wmtpInfoMask.to_ulong());
auto engineInfo = xeIoctlHelper->createEngineInfo(false);
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS)));
EXPECT_TRUE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS1)));
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS2)));
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS3)));
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_RCS)));
EXPECT_FALSE(hwInfo.featureTable.wmtpInfoMask.test(static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCCS)));
}

TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenProperEnginesAreDiscovered) {
DebugManagerStateRestore restorer;
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ struct DrmMockXe : public DrmMockCustom {
xeQueryEngines->engines[1] = {{DRM_XE_ENGINE_CLASS_COPY, 1, 0}, {}};
xeQueryEngines->engines[2] = {{DRM_XE_ENGINE_CLASS_COPY, 2, 0}, {}};
xeQueryEngines->engines[3] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 3, 0}, {}};
xeQueryEngines->engines[4] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0}, {}};
xeQueryEngines->engines[4] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0}, DRM_XE_ENGINE_CAPABILITY_WMTP};
xeQueryEngines->engines[5] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 5, 1}, {}};
xeQueryEngines->engines[6] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1}, {}};
xeQueryEngines->engines[6] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1}, DRM_XE_ENGINE_CAPABILITY_WMTP};
xeQueryEngines->engines[7] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 7, 1}, {}};
xeQueryEngines->engines[8] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 8, 1}, {}};
xeQueryEngines->engines[9] = {{DRM_XE_ENGINE_CLASS_VIDEO_DECODE, 9, 1}, {}};
Expand Down
1 change: 1 addition & 0 deletions third_party/uapi/xe/.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch: https://patchwork.freedesktop.org/patch/604493/?series=13613
14 changes: 11 additions & 3 deletions third_party/uapi/xe/xe_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,21 @@ struct drm_xe_engine_class_instance {

/**
* struct drm_xe_engine - describe hardware engine
*/
*
* The @capabilities can be:
* - DRM_XE_ENGINE_CAPABILITY_WMTP - represents a engine's mid-thread
* preemption capability.
*/
struct drm_xe_engine {
/** @instance: The @drm_xe_engine_class_instance */
struct drm_xe_engine_class_instance instance;

#define DRM_XE_ENGINE_CAPABILITY_WMTP 1
/** @capabilities: Capabilities of this engine. */
__u32 capabilities;
/** @pad: MBZ */
__u32 pad;
/** @reserved: Reserved */
__u64 reserved[3];
__u64 reserved[2];
};

/**
Expand Down

0 comments on commit 7eb5d56

Please sign in to comment.