1
+ /*
2
+ * Copyright (C) 2019 Intel Corporation
3
+ *
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ */
7
+
8
+ #include " common/helpers/bit_helpers.h"
9
+ #include " public/cl_ext_private.h"
10
+ #include " runtime/helpers/memory_properties_flags_helpers.h"
11
+
12
+ #include " CL/cl_ext_intel.h"
13
+
14
+ namespace NEO {
15
+
16
+ MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (MemoryProperties properties) {
17
+ MemoryPropertiesFlags memoryPropertiesFlags;
18
+
19
+ if (isValueSet (properties.flags , CL_MEM_READ_WRITE)) {
20
+ memoryPropertiesFlags.readWrite = true ;
21
+ }
22
+ if (isValueSet (properties.flags , CL_MEM_WRITE_ONLY)) {
23
+ memoryPropertiesFlags.writeOnly = true ;
24
+ }
25
+ if (isValueSet (properties.flags , CL_MEM_READ_ONLY)) {
26
+ memoryPropertiesFlags.readOnly = true ;
27
+ }
28
+ if (isValueSet (properties.flags , CL_MEM_USE_HOST_PTR)) {
29
+ memoryPropertiesFlags.useHostPtr = true ;
30
+ }
31
+ if (isValueSet (properties.flags , CL_MEM_ALLOC_HOST_PTR)) {
32
+ memoryPropertiesFlags.allocHostPtr = true ;
33
+ }
34
+ if (isValueSet (properties.flags , CL_MEM_COPY_HOST_PTR)) {
35
+ memoryPropertiesFlags.copyHostPtr = true ;
36
+ }
37
+ if (isValueSet (properties.flags , CL_MEM_HOST_WRITE_ONLY)) {
38
+ memoryPropertiesFlags.hostWriteOnly = true ;
39
+ }
40
+ if (isValueSet (properties.flags , CL_MEM_HOST_READ_ONLY)) {
41
+ memoryPropertiesFlags.hostReadOnly = true ;
42
+ }
43
+ if (isValueSet (properties.flags , CL_MEM_HOST_NO_ACCESS)) {
44
+ memoryPropertiesFlags.hostNoAccess = true ;
45
+ }
46
+ if (isValueSet (properties.flags , CL_MEM_KERNEL_READ_AND_WRITE)) {
47
+ memoryPropertiesFlags.kernelReadAndWrite = true ;
48
+ }
49
+ if (isValueSet (properties.flags , CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
50
+ isValueSet (properties.flags_intel , CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
51
+ memoryPropertiesFlags.forceLinearStorage = true ;
52
+ }
53
+ if (isValueSet (properties.flags , CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
54
+ memoryPropertiesFlags.accessFlagsUnrestricted = true ;
55
+ }
56
+ if (isValueSet (properties.flags , CL_MEM_NO_ACCESS_INTEL)) {
57
+ memoryPropertiesFlags.noAccess = true ;
58
+ }
59
+ if (isValueSet (properties.flags , CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
60
+ isValueSet (properties.flags_intel , CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
61
+ memoryPropertiesFlags.allowUnrestrictedSize = true ;
62
+ }
63
+ if (isValueSet (properties.flags_intel , CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
64
+ memoryPropertiesFlags.locallyUncachedResource = true ;
65
+ }
66
+
67
+ addExtraMemoryPropertiesFlags (memoryPropertiesFlags, properties);
68
+
69
+ return memoryPropertiesFlags;
70
+ }
71
+
72
+ } // namespace NEO
0 commit comments