|
| 1 | + |
| 2 | += cl_img_unified_svm_external_memory |
| 3 | + |
| 4 | +== Name Strings |
| 5 | + |
| 6 | +`cl_img_unified_svm_external_memory` |
| 7 | + |
| 8 | +== Version History |
| 9 | + |
| 10 | +[cols="1,1,3",options="header",] |
| 11 | +|==== |
| 12 | +| *Date* | *Version* | *Description* |
| 13 | +| 2025-04-25 | 1.0.0 | Initial revision. |
| 14 | +| 2025-07-17 | 1.1.0 | Added virtual address property. |
| 15 | +|==== |
| 16 | + |
| 17 | +== Contacts |
| 18 | + |
| 19 | +Imagination Technologies Developer Forum: + |
| 20 | +https://forums.imgtec.com/ |
| 21 | + |
| 22 | +Paul Fradgley, Imagination Technologies (paul.fradgley 'at' imgtec.com) |
| 23 | + |
| 24 | +== Contributors |
| 25 | + |
| 26 | +Paul Fradgley, Imagination Technologies. |
| 27 | + |
| 28 | +== Notice |
| 29 | + |
| 30 | +Copyright (c) 2025 Imagination Technologies Ltd. All Rights Reserved. |
| 31 | + |
| 32 | +== Status |
| 33 | + |
| 34 | +Draft. |
| 35 | + |
| 36 | +== Version |
| 37 | + |
| 38 | +Built On: {docdate} + |
| 39 | +Version: 1.1.0 |
| 40 | + |
| 41 | +== Dependencies |
| 42 | + |
| 43 | +Requires OpenCL version 3.0 or later. |
| 44 | +Requires the cl_khr_unified_svm extension to be supported. |
| 45 | + |
| 46 | +This extension is written against the wording of the cl_khr_unified_svm v0.2.0 extension specification draft. |
| 47 | + |
| 48 | +== Overview |
| 49 | + |
| 50 | +This extension adds the functionality to import an external FD handle as an SVM allocation. |
| 51 | +The SVM allocation will be mapped to the virtual address provided. |
| 52 | + |
| 53 | +== New API Functions |
| 54 | + |
| 55 | +None |
| 56 | + |
| 57 | +== New API Enums |
| 58 | + |
| 59 | +[source,opencl] |
| 60 | +---- |
| 61 | +CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG 0x4220 |
| 62 | +CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG 0x4221 |
| 63 | +---- |
| 64 | + |
| 65 | +== Modifications to the OpenCL API Specification |
| 66 | + |
| 67 | +In Section 5.6, add the following text as a new row in the SVM Allocation Properties table: |
| 68 | + |
| 69 | + CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG |
| 70 | + |
| 71 | + Provides an external dma_buf handle to import into the new SVM allocation. |
| 72 | + |
| 73 | + CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG |
| 74 | + |
| 75 | + Provides the virtual address that the new SVM allocation must map to. |
| 76 | ++ |
| 77 | + |
| 78 | +Add the following text to the list of error values returned by clSVMAllocWithProperties |
| 79 | + |
| 80 | + CL_INVALID_PROPERTY if CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG is specificed as part of properties, |
| 81 | + and properties does not include a valid CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG. |
| 82 | + |
| 83 | + CL_INVALID_PROPERTY if CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG is specificed as part of properties, |
| 84 | + and properties does not include a valid CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG. |
| 85 | + |
| 86 | +== Example Usage == |
| 87 | + |
| 88 | +[source,opencl] |
| 89 | +---- |
| 90 | +const cl_svm_alloc_properties_khr* properties = { |
| 91 | + (cl_svm_alloc_properties_khr) CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_IMG, |
| 92 | + (cl_svm_alloc_properties_khr) external_fd, |
| 93 | + (cl_svm_alloc_properties_khr) CL_SVM_ALLOC_EXTERNAL_MEMORY_DMA_BUF_VIRTUAL_ADDRESS_IMG, |
| 94 | + (cl_svm_alloc_properties_khr) svm_virtual_address, |
| 95 | + 0 |
| 96 | +}; |
| 97 | +
|
| 98 | +clSVMAllocWithPropertiesKHR( |
| 99 | + context, |
| 100 | + properties, |
| 101 | + svm_type_index, |
| 102 | + size, |
| 103 | + &errcode_ret); |
| 104 | +---- |
| 105 | + |
| 106 | +== Issues |
| 107 | + |
| 108 | +. Do we need to add queries for the supported external memory handle types? Or do we add a dependency on the cl_khr_external_memory extension? |
| 109 | ++ |
| 110 | +-- |
| 111 | +`UNRESOLVED`: |
| 112 | +-- |
| 113 | + |
| 114 | + |
| 115 | +. Do the queries need to take into account the SVM capabilities? |
| 116 | +Can the application query whether we can import a particular dma_buf, |
| 117 | +or do we return an error when they try to use an invalid one? |
| 118 | ++ |
| 119 | +-- |
| 120 | +`UNRESOLVED`: |
| 121 | +-- |
0 commit comments