fix: stop Direct Submission on device teardown

This prevents a race condition, causing page faults, where device related
resources are released, but are still in use by commands (e.g. cache flushes)
submitted by the Direct Submission Controller.

Related-To: NEO-15017

Signed-off-by: Radoslaw Jablonski <radoslaw.jablonski@intel.com>
This commit is contained in:
Radoslaw Jablonski
2025-07-11 12:50:26 +00:00
committed by Compute-Runtime-Automation
parent 6511837348
commit be6fe9294c
2 changed files with 11 additions and 0 deletions

View File

@@ -1717,6 +1717,8 @@ void DeviceImp::releaseResources() {
UNRECOVERABLE_IF(neoDevice == nullptr);
neoDevice->stopDirectSubmissionAndWaitForCompletion();
if (this->globalTimestampAllocation) {
driverHandle->getSvmAllocsManager()->freeSVMAlloc(this->globalTimestampAllocation);
}

View File

@@ -4439,6 +4439,15 @@ TEST_F(DeviceTest, givenValidDeviceWhenCallingReleaseResourcesThenResourcesRelea
EXPECT_TRUE(deviceImp->resourcesReleased);
}
TEST_F(DeviceTest, givenValidDeviceWhenCallingReleaseResourcesThenDirectSubmissionIsStopped) {
auto deviceImp = static_cast<DeviceImp *>(device);
EXPECT_FALSE(neoDevice->stopDirectSubmissionCalled);
neoDevice->incRefInternal();
deviceImp->releaseResources();
EXPECT_TRUE(neoDevice->stopDirectSubmissionCalled);
neoDevice->decRefInternal();
}
HWTEST_F(DeviceTest, givenCooperativeDispatchSupportedWhenQueryingPropertiesFlagsThenCooperativeKernelsAreSupported) {
struct MockGfxCoreHelper : NEO::GfxCoreHelperHw<FamilyType> {
bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const RootDeviceEnvironment &rootDeviceEnvironment) const override {