refactor: prework to pass interrupt hint
Related-To: NEO-8179 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
96ec8e3c2e
commit
806da85ec6
|
@ -520,7 +520,7 @@ ze_result_t EventImp<TagSizeT>::waitForUserFence(uint64_t timeout) {
|
|||
|
||||
uint64_t waitAddress = castToUint64(ptrOffset(inOrderExecInfo->getBaseHostAddress(), this->inOrderAllocationOffset));
|
||||
|
||||
if (!csrs[0]->waitUserFence(getInOrderExecSignalValueWithSubmissionCounter(), waitAddress, timeout)) {
|
||||
if (!csrs[0]->waitUserFence(getInOrderExecSignalValueWithSubmissionCounter(), waitAddress, timeout, isKmdWaitModeEnabled(), this->externalInterruptId)) {
|
||||
return ZE_RESULT_NOT_READY;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,6 +387,39 @@ HWTEST2_F(InOrderCmdListTests, givenDebugFlagSetWhenEventHostSyncCalledThenCallW
|
|||
EXPECT_EQ(2u, ultCsr->waitUserFenecParams.callCount);
|
||||
}
|
||||
|
||||
HWTEST2_F(InOrderCmdListTests, givenUserInterruptEventWhenWaitingThenWaitForUserFenceWithParams, IsAtLeastXeHpCore) {
|
||||
auto immCmdList = createImmCmdList<gfxCoreFamily>();
|
||||
|
||||
auto eventPool = createEvents<FamilyType>(2, false);
|
||||
events[0]->enableKmdWaitMode();
|
||||
events[0]->enableInterruptMode();
|
||||
|
||||
events[1]->enableKmdWaitMode();
|
||||
events[1]->enableInterruptMode();
|
||||
events[1]->externalInterruptId = 0x123;
|
||||
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[0]->toHandle(), 0, nullptr, launchParams, false);
|
||||
immCmdList->appendLaunchKernel(kernel->toHandle(), groupCount, events[1]->toHandle(), 0, nullptr, launchParams, false);
|
||||
|
||||
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
|
||||
|
||||
ultCsr->waitUserFenecParams.forceRetStatusEnabled = true;
|
||||
|
||||
EXPECT_EQ(0u, ultCsr->waitUserFenecParams.callCount);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, events[0]->hostSynchronize(2));
|
||||
|
||||
EXPECT_EQ(1u, ultCsr->waitUserFenecParams.callCount);
|
||||
EXPECT_EQ(NEO::InterruptId::notUsed, ultCsr->waitUserFenecParams.externalInterruptId);
|
||||
EXPECT_TRUE(ultCsr->waitUserFenecParams.userInterrupt);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, events[1]->hostSynchronize(2));
|
||||
|
||||
EXPECT_EQ(2u, ultCsr->waitUserFenecParams.callCount);
|
||||
EXPECT_EQ(events[1]->externalInterruptId, ultCsr->waitUserFenecParams.externalInterruptId);
|
||||
EXPECT_TRUE(ultCsr->waitUserFenecParams.userInterrupt);
|
||||
}
|
||||
|
||||
HWTEST2_F(InOrderCmdListTests, givenInOrderModeWhenHostResetOrSignalEventCalledThenReturnError, IsAtLeastSkl) {
|
||||
auto immCmdList = createImmCmdList<gfxCoreFamily>();
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ class CommandStreamReceiver {
|
|||
|
||||
bool isRecyclingTagForHeapStorageRequired() const { return heapStorageRequiresRecyclingTag; }
|
||||
|
||||
virtual bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout) { return false; }
|
||||
virtual bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId) { return false; }
|
||||
|
||||
void requestPreallocation();
|
||||
void releasePreallocationRequest();
|
||||
|
|
|
@ -93,7 +93,7 @@ inline DrmDirectSubmission<GfxFamily, Dispatcher>::~DrmDirectSubmission() {
|
|||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
auto &drm = osContextLinux->getDrm();
|
||||
auto completionFenceCpuAddress = reinterpret_cast<uint64_t>(this->completionFenceAllocation->getUnderlyingBuffer()) + TagAllocationLayout::completionFenceOffset;
|
||||
drm.waitOnUserFences(*osContextLinux, completionFenceCpuAddress, this->completionFenceValue, this->activeTiles, -1, this->immWritePostSyncOffset);
|
||||
drm.waitOnUserFences(*osContextLinux, completionFenceCpuAddress, this->completionFenceValue, this->activeTiles, -1, this->immWritePostSyncOffset, false, NEO::InterruptId::notUsed);
|
||||
}
|
||||
this->deallocateResources();
|
||||
if (this->pciBarrierPtr) {
|
||||
|
|
|
@ -64,7 +64,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
|||
|
||||
SubmissionStatus printBOsForSubmit(ResidencyContainer &allocationsForResidency, GraphicsAllocation &cmdBufferAllocation);
|
||||
|
||||
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout) override;
|
||||
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId) override;
|
||||
|
||||
using CommandStreamReceiver::pageTableManager;
|
||||
|
||||
|
|
|
@ -318,7 +318,7 @@ bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushSta
|
|||
auto waitValue = static_cast<uint32_t>(flushStamp);
|
||||
if (isUserFenceWaitActive()) {
|
||||
uint64_t tagAddress = castToUint64(const_cast<TagAddressType *>(getTagAddress()));
|
||||
return waitUserFence(waitValue, tagAddress, kmdWaitTimeout);
|
||||
return waitUserFence(waitValue, tagAddress, kmdWaitTimeout, false, NEO::InterruptId::notUsed);
|
||||
} else {
|
||||
this->drm->waitHandle(waitValue, kmdWaitTimeout);
|
||||
}
|
||||
|
@ -368,8 +368,8 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchB
|
|||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool DrmCommandStreamReceiver<GfxFamily>::waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout) {
|
||||
int ret = drm->waitOnUserFences(static_cast<const OsContextLinux &>(*this->osContext), hostAddress, waitValue, this->activePartitions, timeout, this->immWritePostSyncWriteOffset);
|
||||
bool DrmCommandStreamReceiver<GfxFamily>::waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId) {
|
||||
int ret = drm->waitOnUserFences(static_cast<const OsContextLinux &>(*this->osContext), hostAddress, waitValue, this->activePartitions, timeout, this->immWritePostSyncWriteOffset, userInterrupt, externalInterruptId);
|
||||
|
||||
return (ret == 0);
|
||||
}
|
||||
|
|
|
@ -2221,7 +2221,8 @@ void DrmMemoryManager::waitOnCompletionFence(GraphicsAllocation *allocation) {
|
|||
|
||||
if (allocation->isUsedByOsContext(osContextId)) {
|
||||
Drm &drm = getDrm(csr->getRootDeviceIndex());
|
||||
drm.waitOnUserFences(static_cast<const OsContextLinux &>(*osContext), completionFenceAddress, allocationTaskCount, csr->getActivePartitions(), -1, csr->getImmWritePostSyncWriteOffset());
|
||||
drm.waitOnUserFences(static_cast<const OsContextLinux &>(*osContext), completionFenceAddress, allocationTaskCount, csr->getActivePartitions(), -1,
|
||||
csr->getImmWritePostSyncWriteOffset(), false, NEO::InterruptId::notUsed);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -960,8 +960,8 @@ void Drm::getPrelimVersion(std::string &prelimVersion) {
|
|||
ifs.close();
|
||||
}
|
||||
|
||||
int Drm::waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags) {
|
||||
return ioctlHelper->waitUserFence(ctxId, address, value, static_cast<uint32_t>(dataWidth), timeout, flags, false, NEO::InterruptId::notUsed);
|
||||
int Drm::waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId) {
|
||||
return ioctlHelper->waitUserFence(ctxId, address, value, static_cast<uint32_t>(dataWidth), timeout, flags, userInterrupt, externalInterruptId);
|
||||
}
|
||||
|
||||
bool Drm::querySystemInfo() {
|
||||
|
@ -1165,7 +1165,7 @@ void Drm::waitForBind(uint32_t vmHandleId) {
|
|||
auto fenceValue = this->fenceVal[vmHandleId];
|
||||
lock.unlock();
|
||||
|
||||
waitUserFence(0u, fenceAddress, fenceValue, ValueWidth::u64, -1, ioctlHelper->getWaitUserFenceSoftFlag());
|
||||
waitUserFence(0u, fenceAddress, fenceValue, ValueWidth::u64, -1, ioctlHelper->getWaitUserFenceSoftFlag(), false, NEO::InterruptId::notUsed);
|
||||
}
|
||||
|
||||
bool Drm::isSetPairAvailable() {
|
||||
|
@ -1557,7 +1557,7 @@ PhysicalDevicePciSpeedInfo Drm::getPciSpeedInfo() const {
|
|||
return pciSpeedInfo;
|
||||
}
|
||||
|
||||
int Drm::waitOnUserFences(const OsContextLinux &osContext, uint64_t address, uint64_t value, uint32_t numActiveTiles, int64_t timeout, uint32_t postSyncOffset) {
|
||||
int Drm::waitOnUserFences(const OsContextLinux &osContext, uint64_t address, uint64_t value, uint32_t numActiveTiles, int64_t timeout, uint32_t postSyncOffset, bool userInterrupt, uint32_t externalInterruptId) {
|
||||
auto &drmContextIds = osContext.getDrmContextIds();
|
||||
UNRECOVERABLE_IF(numActiveTiles > drmContextIds.size());
|
||||
auto completionFenceCpuAddress = address;
|
||||
|
@ -1566,7 +1566,7 @@ int Drm::waitOnUserFences(const OsContextLinux &osContext, uint64_t address, uin
|
|||
for (auto drmIterator = 0u; drmIterator < numActiveTiles; drmIterator++) {
|
||||
if (*reinterpret_cast<uint32_t *>(completionFenceCpuAddress) < value) {
|
||||
static constexpr uint16_t flags = 0;
|
||||
int retVal = waitUserFence(drmContextIds[drmIterator], completionFenceCpuAddress, value, Drm::ValueWidth::u64, selectedTimeout, flags);
|
||||
int retVal = waitUserFence(drmContextIds[drmIterator], completionFenceCpuAddress, value, Drm::ValueWidth::u64, selectedTimeout, flags, userInterrupt, externalInterruptId);
|
||||
if (debugManager.flags.PrintCompletionFenceUsage.get()) {
|
||||
std::cout << "Completion fence waited."
|
||||
<< " Status: " << retVal
|
||||
|
@ -1583,6 +1583,11 @@ int Drm::waitOnUserFences(const OsContextLinux &osContext, uint64_t address, uin
|
|||
<< ", current value: " << *reinterpret_cast<uint32_t *>(completionFenceCpuAddress)
|
||||
<< ", wait value: " << value << std::endl;
|
||||
}
|
||||
|
||||
if (externalInterruptId != NEO::InterruptId::notUsed) {
|
||||
break;
|
||||
}
|
||||
|
||||
completionFenceCpuAddress = ptrOffset(completionFenceCpuAddress, postSyncOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -220,9 +220,9 @@ class Drm : public DriverModel {
|
|||
u32,
|
||||
u64
|
||||
};
|
||||
MOCKABLE_VIRTUAL int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags);
|
||||
MOCKABLE_VIRTUAL int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId);
|
||||
|
||||
int waitOnUserFences(const OsContextLinux &osContext, uint64_t address, uint64_t value, uint32_t numActiveTiles, int64_t timeout, uint32_t postSyncOffset);
|
||||
int waitOnUserFences(const OsContextLinux &osContext, uint64_t address, uint64_t value, uint32_t numActiveTiles, int64_t timeout, uint32_t postSyncOffset, bool userInterrupt, uint32_t externalInterruptId);
|
||||
|
||||
void setNewResourceBoundToVM(BufferObject *bo, uint32_t vmHandleId);
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ uint32_t MemoryInfo::getLocalMemoryRegionIndex(DeviceBitfield deviceBitfield) co
|
|||
auto &productHelper = this->drm.getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||
bool bankOverrideRequired{gfxCoreHelper.isBankOverrideRequired(hwInfo, productHelper)};
|
||||
|
||||
uint32_t tileIndex{bankOverrideRequired ? 0u : Math::log2(deviceBitfield.to_ulong())};
|
||||
uint32_t tileIndex{bankOverrideRequired ? 0u : Math::log2(static_cast<uint64_t>(deviceBitfield.to_ulong()))};
|
||||
if (debugManager.flags.OverrideDrmRegion.get() != -1) {
|
||||
tileIndex = debugManager.flags.OverrideDrmRegion.get();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -108,7 +108,7 @@ void OsContextLinux::waitForBind(uint32_t drmIterator) {
|
|||
auto fenceValue = this->fenceVal[drmIterator];
|
||||
lock.unlock();
|
||||
|
||||
drm.waitUserFence(0u, fenceAddress, fenceValue, Drm::ValueWidth::u64, -1, drm.getIoctlHelper()->getWaitUserFenceSoftFlag());
|
||||
drm.waitUserFence(0u, fenceAddress, fenceValue, Drm::ValueWidth::u64, -1, drm.getIoctlHelper()->getWaitUserFenceSoftFlag(), false, NEO::InterruptId::notUsed);
|
||||
|
||||
} else {
|
||||
drm.waitForBind(drmIterator);
|
||||
|
|
|
@ -324,9 +324,9 @@ int DrmMock::ioctl(DrmIoctl request, void *arg) {
|
|||
|
||||
return handleRemainingRequests(request, arg);
|
||||
}
|
||||
int DrmMock::waitUserFence(uint32_t ctxIdx, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags) {
|
||||
int DrmMock::waitUserFence(uint32_t ctxIdx, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId) {
|
||||
waitUserFenceParams.push_back({ctxIdx, address, value, dataWidth, timeout, flags});
|
||||
return Drm::waitUserFence(ctxIdx, address, value, dataWidth, timeout, flags);
|
||||
return Drm::waitUserFence(ctxIdx, address, value, dataWidth, timeout, flags, userInterrupt, externalInterruptId);
|
||||
}
|
||||
int DrmMockEngine::handleRemainingRequests(DrmIoctl request, void *arg) {
|
||||
if ((request == DrmIoctl::query) && (arg != nullptr)) {
|
||||
|
|
|
@ -68,7 +68,7 @@ class DrmMock : public Drm {
|
|||
return errnoRetVal;
|
||||
}
|
||||
|
||||
int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags) override;
|
||||
int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId) override;
|
||||
|
||||
void writeConfigFile(const char *name, int deviceID) {
|
||||
std::ofstream tempfile(name, std::ios::binary);
|
||||
|
|
|
@ -29,6 +29,8 @@ struct WaitUserFenceParams {
|
|||
uint64_t latestWaitedValue = 0;
|
||||
int64_t latestWaitedTimeout = 0;
|
||||
uint32_t callCount = 0;
|
||||
uint32_t externalInterruptId = NEO::InterruptId::notUsed;
|
||||
bool userInterrupt = false;
|
||||
bool forceRetStatusEnabled = false;
|
||||
bool forceRetStatusValue = true;
|
||||
};
|
||||
|
@ -461,17 +463,19 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||
BaseClass::stopDirectSubmission(blocking);
|
||||
}
|
||||
|
||||
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout) override {
|
||||
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId) override {
|
||||
waitUserFenecParams.callCount++;
|
||||
waitUserFenecParams.latestWaitedAddress = hostAddress;
|
||||
waitUserFenecParams.latestWaitedValue = waitValue;
|
||||
waitUserFenecParams.latestWaitedTimeout = timeout;
|
||||
waitUserFenecParams.userInterrupt = timeout;
|
||||
waitUserFenecParams.externalInterruptId = externalInterruptId;
|
||||
|
||||
if (waitUserFenecParams.forceRetStatusEnabled) {
|
||||
return waitUserFenecParams.forceRetStatusValue;
|
||||
}
|
||||
|
||||
return BaseClass::waitUserFence(waitValue, hostAddress, timeout);
|
||||
return BaseClass::waitUserFence(waitValue, hostAddress, timeout, userInterrupt, externalInterruptId);
|
||||
}
|
||||
|
||||
std::vector<std::string> aubCommentMessages;
|
||||
|
|
|
@ -106,12 +106,12 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
|||
|
||||
WaitUserFenceResult waitUserFenceResult;
|
||||
|
||||
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout) override {
|
||||
bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId) override {
|
||||
waitUserFenceResult.called++;
|
||||
waitUserFenceResult.waitValue = waitValue;
|
||||
|
||||
if (waitUserFenceResult.callParent) {
|
||||
return BaseClass::waitUserFence(waitValue, hostAddress, timeout);
|
||||
return BaseClass::waitUserFence(waitValue, hostAddress, timeout, userInterrupt, externalInterruptId);
|
||||
} else {
|
||||
return (waitUserFenceResult.returnValue == 0);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -233,7 +233,7 @@ DrmMockCustom::DrmMockCustom(RootDeviceEnvironment &rootDeviceEnvironment)
|
|||
reset();
|
||||
}
|
||||
|
||||
int DrmMockCustom::waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags) {
|
||||
int DrmMockCustom::waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId) {
|
||||
waitUserFenceCall.called++;
|
||||
waitUserFenceCall.ctxId = ctxId;
|
||||
waitUserFenceCall.address = address;
|
||||
|
@ -245,7 +245,7 @@ int DrmMockCustom::waitUserFence(uint32_t ctxId, uint64_t address, uint64_t valu
|
|||
if (waitUserFenceCall.called == waitUserFenceCall.failSpecificCall) {
|
||||
return 123;
|
||||
}
|
||||
return Drm::waitUserFence(ctxId, address, value, dataWidth, timeout, flags);
|
||||
return Drm::waitUserFence(ctxId, address, value, dataWidth, timeout, flags, userInterrupt, externalInterruptId);
|
||||
}
|
||||
|
||||
bool DrmMockCustom::isVmBindAvailable() {
|
||||
|
|
|
@ -145,7 +145,7 @@ class DrmMockCustom : public Drm {
|
|||
|
||||
DrmMockCustom(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
|
||||
int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags) override;
|
||||
int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId) override;
|
||||
|
||||
bool getSetPairAvailable() override;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "shared/source/gmm_helper/page_table_mngr.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/common_types.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/source/memory_manager/internal_allocation_storage.h"
|
||||
|
@ -106,7 +107,7 @@ TEST_F(CommandStreamReceiverTest, givenCsrWhenGettingCompletionAddressThenUnderl
|
|||
}
|
||||
|
||||
TEST_F(CommandStreamReceiverTest, givenBaseCsrWhenCallingWaitUserFenceThenReturnFalse) {
|
||||
EXPECT_FALSE(commandStreamReceiver->waitUserFence(1, commandStreamReceiver->getCompletionAddress(), -1));
|
||||
EXPECT_FALSE(commandStreamReceiver->waitUserFence(1, commandStreamReceiver->getCompletionAddress(), -1, false, InterruptId::notUsed));
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTest, WhenCreatingCsrThenDefaultValuesAreSet) {
|
||||
|
|
|
@ -217,6 +217,57 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
|
|||
EXPECT_EQ(-1, mock->context.receivedGemWaitUserFence.timeout);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenExternalInterruptIdWhenWaitingTheExecuteFenceWaitOnce) {
|
||||
if (!FamilyType::supportsCmdSet(IGFX_XE_HP_CORE)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto osContextLinux = static_cast<const OsContextLinux *>(device->getDefaultEngine().osContext);
|
||||
std::vector<uint32_t> &drmCtxIds = const_cast<std::vector<uint32_t> &>(osContextLinux->getDrmContextIds());
|
||||
size_t drmCtxSize = drmCtxIds.size();
|
||||
for (uint32_t i = 0; i < drmCtxSize; i++) {
|
||||
drmCtxIds[i] = 5u + i;
|
||||
}
|
||||
|
||||
auto testDrmCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
|
||||
testDrmCsr->useUserFenceWait = true;
|
||||
testDrmCsr->activePartitions = 2u;
|
||||
EXPECT_NE(0u, testDrmCsr->immWritePostSyncWriteOffset);
|
||||
|
||||
auto rootExecEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
auto &gfxCoreHelper = rootExecEnvironment->getHelper<GfxCoreHelper>();
|
||||
auto hwInfo = rootExecEnvironment->getHardwareInfo();
|
||||
|
||||
auto osContext = std::make_unique<OsContextLinux>(*mock, rootDeviceIndex, 0,
|
||||
EngineDescriptorHelper::getDefaultDescriptor(gfxCoreHelper.getGpgpuEngineInstances(*rootExecEnvironment)[0],
|
||||
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), DeviceBitfield(3)));
|
||||
|
||||
osContext->ensureContextInitialized();
|
||||
osContext->incRefInternal();
|
||||
|
||||
device->getMemoryManager()->unregisterEngineForCsr(testDrmCsr);
|
||||
|
||||
device->allEngines[0].osContext = osContext.get();
|
||||
|
||||
testDrmCsr->setupContext(*osContext);
|
||||
|
||||
auto tagPtr = testDrmCsr->getTagAddress();
|
||||
*tagPtr = 0;
|
||||
|
||||
tagPtr = ptrOffset(tagPtr, testDrmCsr->immWritePostSyncWriteOffset);
|
||||
*tagPtr = 0;
|
||||
|
||||
uint64_t tagAddress = castToUint64(const_cast<TagAddressType *>(testDrmCsr->getTagAddress()));
|
||||
|
||||
EXPECT_EQ(0u, mock->context.gemWaitUserFenceCalled);
|
||||
|
||||
testDrmCsr->waitUserFence(123, tagAddress, 1, true, NEO::InterruptId::notUsed);
|
||||
EXPECT_EQ(2u, mock->context.gemWaitUserFenceCalled);
|
||||
|
||||
testDrmCsr->waitUserFence(123, tagAddress, 1, true, 0x678);
|
||||
EXPECT_EQ(3u, mock->context.gemWaitUserFenceCalled);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenFailingIoctlWhenWaitingThenDoEarlyReturn) {
|
||||
if (!FamilyType::supportsCmdSet(IGFX_XE_HP_CORE)) {
|
||||
GTEST_SKIP();
|
||||
|
|
|
@ -502,7 +502,7 @@ TEST(DrmBufferObjectTestPrelim, givenProvidedCtxIdWhenCallingWaitUserFenceThenEx
|
|||
|
||||
uint64_t gpuAddress = 0x1020304000ull;
|
||||
uint64_t value = 0x98765ull;
|
||||
drm.waitUserFence(10u, gpuAddress, value, Drm::ValueWidth::u8, -1, 0u);
|
||||
drm.waitUserFence(10u, gpuAddress, value, Drm::ValueWidth::u8, -1, 0u, false, NEO::InterruptId::notUsed);
|
||||
|
||||
EXPECT_EQ(1u, drm.context.waitUserFenceCalled);
|
||||
const auto &waitUserFence = drm.context.receivedWaitUserFence;
|
||||
|
@ -523,7 +523,7 @@ TEST(DrmBufferObjectTestPrelim, givenProvidedNoCtxIdWhenCallingWaitUserFenceThen
|
|||
|
||||
uint64_t gpuAddress = 0x1020304000ull;
|
||||
uint64_t value = 0x98765ull;
|
||||
drm.waitUserFence(0u, gpuAddress, value, Drm::ValueWidth::u16, 2, 3u);
|
||||
drm.waitUserFence(0u, gpuAddress, value, Drm::ValueWidth::u16, 2, 3u, false, NEO::InterruptId::notUsed);
|
||||
|
||||
EXPECT_EQ(1u, drm.context.waitUserFenceCalled);
|
||||
const auto &waitUserFence = drm.context.receivedWaitUserFence;
|
||||
|
@ -545,7 +545,7 @@ TEST(DrmTestPrelim, givenHungContextWhenCallingWaitUserFenceThenSmallTimeoutIsPa
|
|||
|
||||
uint64_t memory = 0;
|
||||
uint64_t value = 20;
|
||||
drm.waitOnUserFences(osContext, reinterpret_cast<uint64_t>(&memory), value, 1, -1, 0);
|
||||
drm.waitOnUserFences(osContext, reinterpret_cast<uint64_t>(&memory), value, 1, -1, 0, false, NEO::InterruptId::notUsed);
|
||||
|
||||
EXPECT_EQ(osContext.getDrmContextIds().size(), drm.context.waitUserFenceCalled);
|
||||
const auto &waitUserFence = drm.context.receivedWaitUserFence;
|
||||
|
|
|
@ -127,7 +127,7 @@ TEST(DrmVmBindTest, givenBoNotRequiringExplicitResidencyWhenCallingWaitForBindTh
|
|||
struct DrmQueryMockToTestWaitForBind : public DrmQueryMock {
|
||||
using DrmQueryMock::DrmQueryMock;
|
||||
|
||||
int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags) override {
|
||||
int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags, bool userInterrupt, uint32_t externalInterruptId) override {
|
||||
waitUserFenceCalled = true;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue