Skip to content

Commit

Permalink
External memory import: Add assume linear query (#861) (#940)
Browse files Browse the repository at this point in the history
* External memory import: Add assume linear query (#861)

Add query to clGetDeviceInfo for external memory handle types
that are assumed to be linear.

* Assign macro numeric value and improve formatting

* Address review comments

* Fixed token name to what was agreed on in the review

* Updated minor version

---------

Co-authored-by: Joshua Kelly <[email protected]>
  • Loading branch information
lakshmih and joshqti authored Sep 5, 2023
1 parent 3840543 commit d006bf9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ext/cl_khr_external_memory.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Other related extensions define specific external memory types that may be impor
[cols="1,1,3",options="header",]
|====
| *Date* | *Version* | *Description*
| 2023-08-29 | 0.9.3 | Added query for {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_HANDLE_TYPES_KHR} (provisional).
| 2023-08-01 | 0.9.2 | Changed device handle list enum to the memory-specific {CL_MEM_DEVICE_HANDLE_LIST_KHR} (provisional).
| 2023-05-04 | 0.9.1 | Clarified device handle list enum cannot be specified without an external memory handle (provisional).
| 2021-09-10 | 0.9.0 | Initial version (provisional).
Expand Down Expand Up @@ -107,7 +108,8 @@ Accepted value for the _param_name_ parameter to {clGetDeviceInfo} to query exte

[source]
----
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x204F
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x204F
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR 0x2052
----

New properties accepted as _properties_ to {clCreateBufferWithProperties} and {clCreateImageWithProperties}:
Expand Down Expand Up @@ -182,10 +184,17 @@ Following new enums are added to the list of supported _param_names_ by {clGetDe
| {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR}
| {cl_external_memory_handle_type_khr_TYPE}[]
| Returns the list of importable external memory handle types supported by _device_.
| {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR}
| {cl_external_memory_handle_type_khr_TYPE}[]
| Returns the list of importable external memory handle types supported by _device_, that are assumed to apply linear layout to imported images when no other tiling information is provided.
|====

{clGetDeviceInfo} when called with param_name {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR} must return a non-empty list of external memory handle types for at least one of the devices in the platform.

{clGetDeviceInfo} when called with param_name {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR} returns a list of external memory handle types that are assumed to have a linear memory layout when no other tiling information is provided. This list contains a subset of {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR}. The returned list may be empty.

External memory handle types not in {CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR} may have any memory layout. The layout interpretation of images imported with these handle types is implementation defined.

Following new properties are added to the list of supported properties by {clCreateBufferWithProperties} and {clCreateImageWithProperties}.

[[external-memory-properties-table]]
Expand Down
3 changes: 2 additions & 1 deletion xml/cl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ server's OpenCL/api-docs repository.
<enum value="0x204E" name="CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR"/>
<enum value="0x204F" name="CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR"/>
<enum value="0x2051" name="CL_MEM_DEVICE_HANDLE_LIST_KHR"/>
<unused start="0x2052" end="0x2052"/>
<enum value="0x2052" name="CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR"/>
<enum value="0x2053" name="CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR"/>
<unused start="0x2054" end="0x2054"/>
<enum value="0x2055" name="CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR"/>
Expand Down Expand Up @@ -7010,6 +7010,7 @@ server's OpenCL/api-docs repository.
</require>
<require comment="cl_device_info">
<enum name="CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR"/>
<enum name="CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR"/>
</require>
<require comment="cl_mem_properties">
<enum name="CL_MEM_DEVICE_HANDLE_LIST_KHR"/>
Expand Down

0 comments on commit d006bf9

Please sign in to comment.