mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 10:26:29 +08:00
feature: Before resuming the thread unlock them
Related-To: NEO-7988 Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3fa5504a5d
commit
ac52a2ff5b
@@ -87,6 +87,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper {
|
|||||||
|
|
||||||
virtual void getAttentionBitmaskForSingleThreads(const std::vector<EuThread::ThreadId> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const = 0;
|
virtual void getAttentionBitmaskForSingleThreads(const std::vector<EuThread::ThreadId> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const = 0;
|
||||||
virtual std::vector<EuThread::ThreadId> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const = 0;
|
virtual std::vector<EuThread::ThreadId> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const = 0;
|
||||||
|
virtual bool threadResumeRequiresUnlock() const = 0;
|
||||||
virtual bool alwaysAllocateEventInLocalMem() const = 0;
|
virtual bool alwaysAllocateEventInLocalMem() const = 0;
|
||||||
virtual bool platformSupportsCmdListHeapSharing() const = 0;
|
virtual bool platformSupportsCmdListHeapSharing() const = 0;
|
||||||
virtual bool platformSupportsStateComputeModeTracking() const = 0;
|
virtual bool platformSupportsStateComputeModeTracking() const = 0;
|
||||||
@@ -137,6 +138,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper {
|
|||||||
bool forceDefaultUsmCompressionSupport() const override;
|
bool forceDefaultUsmCompressionSupport() const override;
|
||||||
void getAttentionBitmaskForSingleThreads(const std::vector<EuThread::ThreadId> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const override;
|
void getAttentionBitmaskForSingleThreads(const std::vector<EuThread::ThreadId> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const override;
|
||||||
std::vector<EuThread::ThreadId> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const override;
|
std::vector<EuThread::ThreadId> getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const override;
|
||||||
|
bool threadResumeRequiresUnlock() const override;
|
||||||
bool alwaysAllocateEventInLocalMem() const override;
|
bool alwaysAllocateEventInLocalMem() const override;
|
||||||
bool platformSupportsCmdListHeapSharing() const override;
|
bool platformSupportsCmdListHeapSharing() const override;
|
||||||
bool platformSupportsStateComputeModeTracking() const override;
|
bool platformSupportsStateComputeModeTracking() const override;
|
||||||
|
|||||||
@@ -79,4 +79,9 @@ std::unique_ptr<NEO::TagAllocatorBase> L0GfxCoreHelperHw<Family>::getInOrderTime
|
|||||||
return std::make_unique<NEO::TagAllocator<TimestampPacketsT>>(rootDeviceIndices, memoryManager, initialTagCount, tagAlignment, size, false, false, deviceBitfield);
|
return std::make_unique<NEO::TagAllocator<TimestampPacketsT>>(rootDeviceIndices, memoryManager, initialTagCount, tagAlignment, size, false, false, deviceBitfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Family>
|
||||||
|
bool L0GfxCoreHelperHw<Family>::threadResumeRequiresUnlock() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
|
|||||||
@@ -122,6 +122,11 @@ XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenGettingCmdlistUpdat
|
|||||||
EXPECT_EQ(63u, l0GfxCoreHelper.getPlatformCmdListUpdateCapabilities());
|
EXPECT_EQ(63u, l0GfxCoreHelper.getPlatformCmdListUpdateCapabilities());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCallingThreadResumeRequiresUnlockThenReturnFalse) {
|
||||||
|
const auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||||
|
EXPECT_FALSE(l0GfxCoreHelper.threadResumeRequiresUnlock());
|
||||||
|
}
|
||||||
|
|
||||||
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForDeletingIpSamplingEntryWithNullValuesThenMapRemainstheSameSize) {
|
XE2_HPG_CORETEST_F(L0GfxCoreHelperTestXe2Hpg, GivenXe2HpgWhenCheckingL0HelperForDeletingIpSamplingEntryWithNullValuesThenMapRemainstheSameSize) {
|
||||||
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
auto &l0GfxCoreHelper = getHelper<L0GfxCoreHelper>();
|
||||||
std::map<uint64_t, void *> stallSumIpDataMap;
|
std::map<uint64_t, void *> stallSumIpDataMap;
|
||||||
|
|||||||
@@ -718,7 +718,6 @@ int DebugSessionLinuxXe::threadControlResume(const std::vector<EuThread::ThreadI
|
|||||||
euControl.client_handle = clientHandle;
|
euControl.client_handle = clientHandle;
|
||||||
euControl.bitmask_size = 0;
|
euControl.bitmask_size = 0;
|
||||||
euControl.bitmask_ptr = 0;
|
euControl.bitmask_ptr = 0;
|
||||||
euControl.cmd = DRM_XE_EUDEBUG_EU_CONTROL_CMD_RESUME;
|
|
||||||
|
|
||||||
std::unique_ptr<uint8_t[]> bitmask;
|
std::unique_ptr<uint8_t[]> bitmask;
|
||||||
size_t bitmaskSize = 0;
|
size_t bitmaskSize = 0;
|
||||||
@@ -733,15 +732,23 @@ int DebugSessionLinuxXe::threadControlResume(const std::vector<EuThread::ThreadI
|
|||||||
euControl.exec_queue_handle = execQueueHandle;
|
euControl.exec_queue_handle = execQueueHandle;
|
||||||
euControl.lrc_handle = lrcHandle;
|
euControl.lrc_handle = lrcHandle;
|
||||||
|
|
||||||
euControlRetVal = ioctl(DRM_XE_EUDEBUG_IOCTL_EU_CONTROL, &euControl);
|
auto invokeIoctl = [&](int cmd) {
|
||||||
if (euControlRetVal != 0) {
|
euControl.cmd = cmd;
|
||||||
PRINT_DEBUGGER_ERROR_LOG("DRM_XE_EUDEBUG_IOCTL_EU_CONTROL failed: retCode: %d errno = %d command = %d, execQueueHandle = %llu lrcHandle = %llu\n",
|
euControlRetVal = ioctl(DRM_XE_EUDEBUG_IOCTL_EU_CONTROL, &euControl);
|
||||||
euControlRetVal, errno, static_cast<uint32_t>(euControl.cmd), static_cast<uint64_t>(euControl.exec_queue_handle),
|
if (euControlRetVal != 0) {
|
||||||
static_cast<uint64_t>(euControl.lrc_handle));
|
PRINT_DEBUGGER_ERROR_LOG("DRM_XE_EUDEBUG_IOCTL_EU_CONTROL failed: retCode: %d errno = %d command = %d, execQueueHandle = %llu lrcHandle = %llu\n",
|
||||||
} else {
|
euControlRetVal, errno, static_cast<uint32_t>(euControl.cmd), static_cast<uint64_t>(euControl.exec_queue_handle),
|
||||||
PRINT_DEBUGGER_INFO_LOG("DRM_XE_EUDEBUG_IOCTL_EU_CONTROL: seqno = %llu command = %u\n", static_cast<uint64_t>(euControl.seqno), static_cast<uint32_t>(euControl.cmd));
|
static_cast<uint64_t>(euControl.lrc_handle));
|
||||||
|
} else {
|
||||||
|
PRINT_DEBUGGER_INFO_LOG("DRM_XE_EUDEBUG_IOCTL_EU_CONTROL: seqno = %llu command = %u\n", static_cast<uint64_t>(euControl.seqno), static_cast<uint32_t>(euControl.cmd));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (l0GfxCoreHelper.threadResumeRequiresUnlock()) {
|
||||||
|
invokeIoctl(getEuControlCmdUnlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invokeIoctl(DRM_XE_EUDEBUG_EU_CONTROL_CMD_RESUME);
|
||||||
return euControlRetVal;
|
return euControlRetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ struct DebugSessionLinuxXe : DebugSessionLinux {
|
|||||||
bool handleMetadataOpEvent(drm_xe_eudebug_event_vm_bind_op_metadata *vmBindOpMetadata);
|
bool handleMetadataOpEvent(drm_xe_eudebug_event_vm_bind_op_metadata *vmBindOpMetadata);
|
||||||
void updateContextAndLrcHandlesForThreadsWithAttention(EuThread::ThreadId threadId, AttentionEventFields &attention) override;
|
void updateContextAndLrcHandlesForThreadsWithAttention(EuThread::ThreadId threadId, AttentionEventFields &attention) override;
|
||||||
int eventAckIoctl(EventToAck &event) override;
|
int eventAckIoctl(EventToAck &event) override;
|
||||||
|
MOCKABLE_VIRTUAL int getEuControlCmdUnlock() const;
|
||||||
Module &getModule(uint64_t moduleHandle) override {
|
Module &getModule(uint64_t moduleHandle) override {
|
||||||
auto connection = clientHandleToConnection[clientHandle].get();
|
auto connection = clientHandleToConnection[clientHandle].get();
|
||||||
DEBUG_BREAK_IF(connection->metaDataToModule.find(moduleHandle) == connection->metaDataToModule.end());
|
DEBUG_BREAK_IF(connection->metaDataToModule.find(moduleHandle) == connection->metaDataToModule.end());
|
||||||
|
|||||||
@@ -19,4 +19,8 @@ bool DebugSessionLinuxXe::eventTypeIsAttention(uint16_t eventType) {
|
|||||||
return (eventType == DRM_XE_EUDEBUG_EVENT_EU_ATTENTION);
|
return (eventType == DRM_XE_EUDEBUG_EVENT_EU_ATTENTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DebugSessionLinuxXe::getEuControlCmdUnlock() const {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
@@ -166,6 +166,7 @@ struct MockDebugSessionLinuxXe : public L0::DebugSessionLinuxXe {
|
|||||||
using L0::DebugSessionLinuxXe::debugArea;
|
using L0::DebugSessionLinuxXe::debugArea;
|
||||||
using L0::DebugSessionLinuxXe::euControlInterruptSeqno;
|
using L0::DebugSessionLinuxXe::euControlInterruptSeqno;
|
||||||
using L0::DebugSessionLinuxXe::eventTypeIsAttention;
|
using L0::DebugSessionLinuxXe::eventTypeIsAttention;
|
||||||
|
using L0::DebugSessionLinuxXe::getEuControlCmdUnlock;
|
||||||
using L0::DebugSessionLinuxXe::getThreadStateMutexForTileSession;
|
using L0::DebugSessionLinuxXe::getThreadStateMutexForTileSession;
|
||||||
using L0::DebugSessionLinuxXe::getVmHandleFromClientAndlrcHandle;
|
using L0::DebugSessionLinuxXe::getVmHandleFromClientAndlrcHandle;
|
||||||
using L0::DebugSessionLinuxXe::handleEvent;
|
using L0::DebugSessionLinuxXe::handleEvent;
|
||||||
|
|||||||
@@ -1787,13 +1787,23 @@ TEST_F(DebugApiLinuxTestXe, GivenErrorFromIoctlWhenCallingThreadControlThenThrea
|
|||||||
|
|
||||||
EXPECT_EQ(4, handler->ioctlCalled);
|
EXPECT_EQ(4, handler->ioctlCalled);
|
||||||
|
|
||||||
|
auto &l0GfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
|
||||||
|
|
||||||
result = sessionMock->threadControl(threads, 0, MockDebugSessionLinuxXe::ThreadControlCmd::resume, bitmaskOut, bitmaskSizeOut);
|
result = sessionMock->threadControl(threads, 0, MockDebugSessionLinuxXe::ThreadControlCmd::resume, bitmaskOut, bitmaskSizeOut);
|
||||||
EXPECT_NE(0, result);
|
EXPECT_NE(0, result);
|
||||||
EXPECT_EQ(5, handler->ioctlCalled);
|
if (l0GfxCoreHelper.threadResumeRequiresUnlock()) {
|
||||||
|
EXPECT_EQ(6, handler->ioctlCalled);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(5, handler->ioctlCalled);
|
||||||
|
}
|
||||||
|
|
||||||
result = sessionMock->threadControl(threads, 0, MockDebugSessionLinuxXe::ThreadControlCmd::stopped, bitmaskOut, bitmaskSizeOut);
|
result = sessionMock->threadControl(threads, 0, MockDebugSessionLinuxXe::ThreadControlCmd::stopped, bitmaskOut, bitmaskSizeOut);
|
||||||
EXPECT_NE(0, result);
|
EXPECT_NE(0, result);
|
||||||
EXPECT_EQ(9, handler->ioctlCalled);
|
if (l0GfxCoreHelper.threadResumeRequiresUnlock()) {
|
||||||
|
EXPECT_EQ(10, handler->ioctlCalled);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(9, handler->ioctlCalled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DebugApiLinuxTestXe, GivenSuccessFromIoctlWhenCallingThreadControlForInterruptAllThenSequenceNumbersProperlyUpdates) {
|
TEST_F(DebugApiLinuxTestXe, GivenSuccessFromIoctlWhenCallingThreadControlForInterruptAllThenSequenceNumbersProperlyUpdates) {
|
||||||
@@ -1863,8 +1873,15 @@ TEST_F(DebugApiLinuxTestXe, WhenCallingThreadControlForResumeThenProperIoctlsIsC
|
|||||||
auto result = sessionMock->threadControl(threads, 0, MockDebugSessionLinuxXe::ThreadControlCmd::resume, bitmaskOut, bitmaskSizeOut);
|
auto result = sessionMock->threadControl(threads, 0, MockDebugSessionLinuxXe::ThreadControlCmd::resume, bitmaskOut, bitmaskSizeOut);
|
||||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||||
|
|
||||||
EXPECT_EQ(1, handler->ioctlCalled);
|
auto &l0GfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
|
||||||
EXPECT_EQ(uint32_t(DRM_XE_EUDEBUG_EU_CONTROL_CMD_RESUME), handler->euControlArgs[0].euControl.cmd);
|
if (l0GfxCoreHelper.threadResumeRequiresUnlock()) {
|
||||||
|
EXPECT_EQ(2, handler->ioctlCalled);
|
||||||
|
EXPECT_EQ(uint32_t(sessionMock->getEuControlCmdUnlock()), handler->euControlArgs[0].euControl.cmd);
|
||||||
|
EXPECT_EQ(uint32_t(DRM_XE_EUDEBUG_EU_CONTROL_CMD_RESUME), handler->euControlArgs[1].euControl.cmd);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(1, handler->ioctlCalled);
|
||||||
|
EXPECT_EQ(uint32_t(DRM_XE_EUDEBUG_EU_CONTROL_CMD_RESUME), handler->euControlArgs[0].euControl.cmd);
|
||||||
|
}
|
||||||
EXPECT_NE(0u, handler->euControlArgs[0].euControl.bitmask_size);
|
EXPECT_NE(0u, handler->euControlArgs[0].euControl.bitmask_size);
|
||||||
auto bitMaskPtrToCheck = handler->euControlArgs[0].euControl.bitmask_ptr;
|
auto bitMaskPtrToCheck = handler->euControlArgs[0].euControl.bitmask_ptr;
|
||||||
EXPECT_NE(0u, bitMaskPtrToCheck);
|
EXPECT_NE(0u, bitMaskPtrToCheck);
|
||||||
|
|||||||
Reference in New Issue
Block a user