Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: query wmtp capability from xe engine #746

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 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 Expand Up @@ -160,6 +164,9 @@ void EngineInfo::setSupportedEnginesInfo(const RootDeviceEnvironment &rootDevice
ccsInfo.NumberOfCCSEnabled = 0;
ccsInfo.Instances.CCSEnableMask = 0;
}
if (hwInfo->featureTable.wmtpInfoMask.any()) {
hwInfo->featureTable.flags.ftrWalkerMTP = true;
}
}

uint32_t EngineInfo::getEngineTileIndex(const EngineClassInstance &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,25 @@ TEST(IoctlHelperXeTest, givenMissingSupportedTopologiesWhenGetTopologyDataAndMap
EXPECT_FALSE(result);
}

TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenWmtpFlagAndInfoMaskAreProperlySet) {
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]->getMutableHardwareInfo();
hwInfo.featureTable.flags.ftrWalkerMTP = 0;
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)));
EXPECT_TRUE(hwInfo.featureTable.flags.ftrWalkerMTP);
}

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