mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Add option to disable caching for a resource
Introduce CL_MEM_LOCALLY_UNCACHED_RESOURCE flag that can be used with clCreateBufferWithPropertiesINTEL() Change-Id: I9f208f00952cdca7482371ec21cbc57c08435b52 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
3a11da8ec8
commit
2d321cb557
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,19 +10,6 @@
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
TEST(MemObjHelper, givenValidMemFlagsForBufferWhenFlagsAreCheckedThenTrueIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
|
||||
CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR |
|
||||
CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS;
|
||||
|
||||
EXPECT_TRUE(MemObjHelper::checkMemFlagsForBuffer(flags));
|
||||
}
|
||||
|
||||
TEST(MemObjHelper, givenInvalidMemFlagsForBufferWhenFlagsAreCheckedThenFalseIsReturned) {
|
||||
cl_mem_flags flags = (1 << 13) | (1 << 14) | (1 << 30) | (1 << 31);
|
||||
EXPECT_FALSE(MemObjHelper::checkMemFlagsForBuffer(flags));
|
||||
}
|
||||
|
||||
TEST(MemObjHelper, givenValidMemFlagsForSubBufferWhenFlagsAreCheckedThenTrueIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
|
||||
CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS;
|
||||
@@ -54,7 +41,7 @@ TEST(MemObjHelper, givenValidPropertiesWhenParsingMemoryPropertiesThenTrueIsRetu
|
||||
CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR |
|
||||
CL_MEM_USE_HOST_PTR | CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS,
|
||||
CL_MEM_FLAGS_INTEL,
|
||||
(1 << 30),
|
||||
CL_MEM_LOCALLY_UNCACHED_RESOURCE,
|
||||
0};
|
||||
|
||||
MemoryProperties propertiesStruct;
|
||||
@@ -69,3 +56,35 @@ TEST(MemObjHelper, givenInvalidPropertiesWhenParsingMemoryPropertiesThenFalseIsR
|
||||
MemoryProperties propertiesStruct;
|
||||
EXPECT_FALSE(MemObjHelper::parseMemoryProperties(properties, propertiesStruct));
|
||||
}
|
||||
|
||||
TEST(MemObjHelper, givenValidPropertiesWhenValidatingMemoryPropertiesThenTrueIsReturned) {
|
||||
MemoryProperties properties;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags = CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags_intel = CL_MEM_LOCALLY_UNCACHED_RESOURCE;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags = 0;
|
||||
EXPECT_TRUE(MemObjHelper::validateMemoryProperties(properties));
|
||||
}
|
||||
|
||||
TEST(MemObjHelper, givenInvalidPropertiesWhenValidatingMemoryPropertiesThenFalseIsReturned) {
|
||||
MemoryProperties properties;
|
||||
properties.flags = (1 << 31);
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags_intel = (1 << 31);
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryProperties(properties));
|
||||
|
||||
properties.flags = 0;
|
||||
EXPECT_FALSE(MemObjHelper::validateMemoryProperties(properties));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user