mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 17:20:26 +08:00
Fix memory flags validation for Images
HostPtr flags are never accepted when parent memory object is provided Change-Id: If1d55e0456d6ab8605dbae5476780c2cb5f811ca Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
7a7bb50328
commit
751740d987
@@ -113,17 +113,25 @@ TEST(MemObjHelper, givenInvalidPropertiesWhenValidatingMemoryPropertiesThenFalse
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, nullptr));
|
||||
}
|
||||
|
||||
struct Image1dWithAccessFlagsUnrestricted : public Image1dDefaults {
|
||||
enum { flags = CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL };
|
||||
};
|
||||
|
||||
TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertiesForImageThenFalseIsReturned) {
|
||||
MemoryProperties properties;
|
||||
MockContext context;
|
||||
auto image = clUniquePtr(Image1dHelper<>::create(&context));
|
||||
auto imageWithAccessFlagsUnrestricted = clUniquePtr(ImageHelper<Image1dWithAccessFlagsUnrestricted>::create(&context));
|
||||
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, image.get()));
|
||||
cl_mem_flags hostPtrFlags[] = {CL_MEM_USE_HOST_PTR, CL_MEM_ALLOC_HOST_PTR, CL_MEM_COPY_HOST_PTR};
|
||||
|
||||
properties.flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, image.get()));
|
||||
for (auto hostPtrFlag : hostPtrFlags) {
|
||||
properties.flags = hostPtrFlag;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, image.get()));
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, imageWithAccessFlagsUnrestricted.get()));
|
||||
|
||||
properties.flags = CL_MEM_COPY_HOST_PTR;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, image.get()));
|
||||
properties.flags |= CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, image.get()));
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, imageWithAccessFlagsUnrestricted.get()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user