mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Correct nullptr SVM arg handling
Related-To: NEO-5001 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
147dc0fbc8
commit
6f2a8e8a1c
@ -18,8 +18,10 @@ GraphicsAllocation *SvmObjectArg::getGraphicsAllocation(uint32_t rootDeviceIndex
|
||||
DEBUG_BREAK_IF(singleDeviceSvmAlloc && rootDeviceIndex != singleDeviceSvmAlloc->getRootDeviceIndex());
|
||||
return singleDeviceSvmAlloc;
|
||||
}
|
||||
UNRECOVERABLE_IF(!multiDeviceSvmAlloc);
|
||||
return multiDeviceSvmAlloc->getGraphicsAllocation(rootDeviceIndex);
|
||||
if (multiDeviceSvmAlloc) {
|
||||
return multiDeviceSvmAlloc->getGraphicsAllocation(rootDeviceIndex);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SvmObjectArg::isCoherent() const {
|
||||
|
@ -39,3 +39,18 @@ TEST(SvmObjectArgTest, givenMultiGraphicsAllocationWhenCreatingSvmObjectArgThenP
|
||||
EXPECT_EQ(multiGraphicsAllocation.getAllocationType(), svmObjectArg.getAllocationType());
|
||||
EXPECT_EQ(&multiGraphicsAllocation, svmObjectArg.getMultiDeviceSvmAlloc());
|
||||
}
|
||||
|
||||
TEST(SvmObjectArgTest, givenNullPtrAllocationWhenGettingGraphicsAllocationFromSvmObjectArgThenNullptrIsReturned) {
|
||||
{
|
||||
GraphicsAllocation *nullGraphicsAllocation = nullptr;
|
||||
SvmObjectArg svmObjectArg(nullGraphicsAllocation);
|
||||
|
||||
EXPECT_EQ(nullptr, svmObjectArg.getGraphicsAllocation(0u));
|
||||
}
|
||||
{
|
||||
MultiGraphicsAllocation *nullMultiGraphicsAllocation = nullptr;
|
||||
SvmObjectArg svmObjectArg(nullMultiGraphicsAllocation);
|
||||
|
||||
EXPECT_EQ(nullptr, svmObjectArg.getGraphicsAllocation(0u));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user