Skip to content

Commit 1c2e071

Browse files
cl_img_mem_properties: Memory hint flags update (#1025)
* Update cl.xml cl_img_mem_properties: Added hint mem alloc flags for CPU and GPU. * Update cl.xml * Update cl.xml * Update cl.xml Removing unused bitfield definition. * Renaming enum CL_DEVICE_MEMORY_CAPABILITIES_IMG * Update cl_img_mem_properties.asciidoc. Memory flag extensions and deviceInfo query extensions Added extension to memory allocation flags and deviceInfo property to query device memory capabilities.
1 parent 83ead90 commit 1c2e071

2 files changed

Lines changed: 64 additions & 10 deletions

File tree

extensions/cl_img_mem_properties.asciidoc

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ include::../config/attribs.txt[]
1414
Imagination Technologies Developer Forum: +
1515
https://forums.imgtec.com/
1616

17-
Jeremy Kemp, Imagination Technologies (Jeremy.Kemp 'at' imgtec.com)
17+
Jeba Samuel, Imagination Technologies (Jeba.Samuels 'at' imgtec.com)
1818

1919
== Contributors
2020

2121
Jeremy Kemp, Imagination Technologies. +
22-
Anitha Raj, Imagination Technologies.
22+
Anitha Raj, Imagination Technologies. +
23+
Jeba Samuel, Imagination Technologies.
2324

2425
== Notice
2526

@@ -32,15 +33,16 @@ Shipping
3233
== Version
3334

3435
Built On: {docdate} +
35-
Version: 1.0.0
36+
Version: 1.1.1
3637

3738
== Dependencies
3839

3940
This extension requires OpenCL 3.0 or later.
4041

4142
== Overview
4243

43-
This extension provides additional _properties_ that can be passed to *clCreateBufferWithProperties*.
44+
This extension provides additional _properties_ that can be passed to *clCreateBufferWithProperties* and *clGetDeviceInfo*
45+
This extension can be used to query additional information about Imagination OpenCL device memory. The additional information may be useful to allocate memory objects in different types of memory regions supported by the device.
4446

4547
== New API Types
4648

@@ -62,6 +64,12 @@ Accepted values for `cl_mem_alloc_flags_img`:
6264
[source,c]
6365
----
6466
#define CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG (1 << 0)
67+
#define CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG (1 << 1)
68+
#define CL_MEM_ALLOC_GPU_CACHED_IMG (1 << 2)
69+
#define CL_MEM_ALLOC_CPU_LOCAL_IMG (1 << 3)
70+
#define CL_MEM_ALLOC_GPU_LOCAL_IMG (1 << 4)
71+
#define CL_MEM_ALLOC_GPU_PRIVATE_IMG (1 << 5)
72+
6573
----
6674

6775
== Modifications to the OpenCL API Specification
@@ -81,6 +89,14 @@ Add Table: List of supported _properties_ when passed to *clCreateBufferWithProp
8189
| `cl_mem_alloc_flags_img`
8290
| `CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG` - On platforms with limited amounts of global memory available it may be desirable to request an allocation larger than the maximum amount reported by the implementation via `CL_DEVICE_MAX_MEM_ALLOC_SIZE` if there is sufficient knowledge about the entire system.
8391
This property allows an application to request buffer objects that are larger than `CL_DEVICE_MAX_MEM_ALLOC_SIZE`.
92+
`CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG` - The GPU device memory backing this allocation will be allocated with the GPU Write Combine flag.
93+
`CL_MEM_ALLOC_GPU_CACHED_IMG` - The GPU device memory backing this allocation will be allocated with the GPU Cached flag.
94+
`CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG` and `CL_MEM_ALLOC_GPU_CACHED_IMG` are mutually exclusive.
95+
`CL_MEM_ALLOC_CPU_LOCAL_IMG` - The GPU device memory backing this allocation will come from physical memory accessible to both the CPU and GPU.
96+
`CL_MEM_ALLOC_GPU_LOCAL_IMG` - The GPU device memory backing this allocation will come from physical memory accessible to both the CPU and GPU.
97+
`CL_MEM_ALLOC_GPU_PRIVATE_IMG` - The GPU device memory backing this allocation will come from physical memory accessible to the GPU only.
98+
`CL_MEM_ALLOC_CPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_PRIVATE_IMG` are mutually exclusive.
99+
84100
|====
85101
(Replace the following error value) ::
86102
+
@@ -89,6 +105,29 @@ This property allows an application to request buffer objects that are larger th
89105
with
90106
+
91107
* `CL_INVALID_BUFFER_SIZE` if _size_ is 0.
108+
(Add the following error value) ::
109+
* `CL_INVALID_VALUE` if both `CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG` and `CL_MEM_ALLOC_GPU_CACHED_IMG` are set.
110+
* `CL_INVALID_VALUE` if both `CL_MEM_ALLOC_CPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_PRIVATE_IMG` are set.
111+
* `CL_INVALID_VALUE` if both `CL_MEM_ALLOC_CPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_LOCAL_IMG` are set.
112+
* `CL_INVALID_VALUE` if both `CL_MEM_ALLOC_GPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_PRIVATE_IMG` are set.
113+
* `CL_INVALID_VALUE` if `CL_MEM_ALLOC_CPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_LOCAL_IMG` and `CL_MEM_ALLOC_GPU_PRIVATE_IMG` are set.
114+
115+
--
116+
117+
(Modify Section 4.2, *Querying Devices*) ::
118+
+
119+
--
120+
Add Table: List of supported param name by *clGetDeviceInfo* ::
121+
+
122+
[cols="1,1,4",options="header",width = "90%"]
123+
|====
124+
| clDeviceInfo
125+
| Return Type
126+
| Description
127+
128+
| `CL_DEVICE_MEMORY_CAPABILITIES_IMG`
129+
| `cl_mem_alloc_flags_img`
130+
| Allocation flags describing the memory region capabilities by the device.
92131
--
93132

94133
== Revision History
@@ -99,4 +138,6 @@ with
99138
|====
100139
| Version | Date | Author | Changes
101140
| 1.0.0 | 2020-08-18 | Jeremy Kemp | Initial revision.
102-
|====
141+
| 1.1.0 | 2022-01-04 | Jeremy Kemp | Added internal values for cl_mem_alloc_flags_img (1 << 1 and 1 << 2). Corrected a typo.
142+
| 1.1.1 | 2023-11-16 | Jeba Samuel | Added internal values for cl_mem_alloc_flags_img (1 << 3 and 1 << 4). The flag provides heap hint for local memory regions of the CPU, GPU and scratchpad memory region of the GPU. The extension allows to query the supported memory regions.
143+
|====

xml/cl.xml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,12 @@ server's OpenCL/api-docs repository.
12381238

12391239
<enums name="cl_mem_alloc_flags_img" vendor="IMG" type="bitmask">
12401240
<enum bitpos="0" name="CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG"/>
1241+
<enum bitpos="1" name="CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG"/>
1242+
<enum bitpos="2" name="CL_MEM_ALLOC_GPU_CACHED_IMG"/>
1243+
<enum bitpos="3" name="CL_MEM_ALLOC_CPU_LOCAL_IMG"/>
1244+
<enum bitpos="4" name="CL_MEM_ALLOC_GPU_LOCAL_IMG"/>
1245+
<enum bitpos="5" name="CL_MEM_ALLOC_GPU_PRIVATE_IMG"/>
12411246
</enums>
1242-
12431247
<enums name="cl_device_scheduling_controls_capabilities_arm" vendor="Arm" type="bitmask">
12441248
<enum bitpos="0" name="CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM"/>
12451249
<enum bitpos="1" name="CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM"/>
@@ -2087,10 +2091,11 @@ server's OpenCL/api-docs repository.
20872091
<enum value="0x40D5" name="CL_INVALID_GRALLOC_OBJECT_IMG"/>
20882092
<enum value="0x40D6" name="CL_COMMAND_GENERATE_MIPMAP_IMG"/>
20892093
<enum value="0x40D7" name="CL_MEM_ALLOC_FLAGS_IMG"/>
2090-
<enum value="0x40D8" name="CL_RESERVED0_IMG"/>
2091-
<enum value="0x40D9" name="CL_RESERVED1_IMG"/>
2092-
<enum value="0x40DA" name="CL_RESERVED2_IMG"/>
2093-
<unused start="0x40DB" end="0x40DF"/>
2094+
<enum value="0x40D8" name="CL_DEVICE_MEMORY_CAPABILITIES_IMG"/>
2095+
<enum value="0x40D9" name="CL_RESERVED0_IMG"/>
2096+
<enum value="0x40DA" name="CL_RESERVED1_IMG"/>
2097+
<enum value="0x40DB" name="CL_RESERVED2_IMG"/>
2098+
<unused start="0x40DC" end="0x40DF"/>
20942099
</enums>
20952100

20962101
<enums start="0x40E0" end="0x40EF" name="enums.40E0" vendor="Khronos SPIR WG" comment="Per Bugs 11309,11310">
@@ -6800,6 +6805,14 @@ server's OpenCL/api-docs repository.
68006805
</require>
68016806
<require comment="cl_mem_alloc_flags_img">
68026807
<enum name="CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG"/>
6808+
<enum name="CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG"/>
6809+
<enum name="CL_MEM_ALLOC_GPU_CACHED_IMG"/>
6810+
<enum name="CL_MEM_ALLOC_CPU_LOCAL_IMG"/>
6811+
<enum name="CL_MEM_ALLOC_GPU_LOCAL_IMG"/>
6812+
<enum name="CL_MEM_ALLOC_GPU_PRIVATE_IMG"/>
6813+
</require>
6814+
<require comment="cl_device_info">
6815+
<enum name="CL_DEVICE_MEMORY_CAPABILITIES_IMG"/>
68036816
</require>
68046817
</extension>
68056818
<extension name="cl_arm_controlled_kernel_termination" supported="opencl">

0 commit comments

Comments
 (0)