You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "srkreddy1238 (via GitHub)" <gi...@apache.org> on 2023/08/22 08:52:46 UTC

[GitHub] [tvm] srkreddy1238 commented on a diff in pull request #15058: [OpenCL][Texture] Improved texture memory planning

srkreddy1238 commented on code in PR #15058:
URL: https://github.com/apache/tvm/pull/15058#discussion_r1301284784


##########
src/runtime/opencl/opencl_common.h:
##########
@@ -311,16 +324,25 @@ class OpenCLWorkspace : public DeviceAPI {
   void* AllocDataSpace(Device dev, size_t size, size_t alignment, DLDataType type_hint) final;
   void* AllocDataSpace(Device dev, int ndim, const int64_t* shape, DLDataType dtype,
                        Optional<String> mem_scope = NullOpt) final;
+  void* AllocDataSpace(Device dev, size_t width, size_t height, DLDataType type_hint,
+                       Optional<String> mem_scope = NullOpt);
+
+  void* AllocDataSpaceView(Device dev, void* data, int ndim, const int64_t* shape, DLDataType dtype,
+                           Optional<String> mem_scope = NullOpt) final;
+
   void* GetNativePtr(const tvm::runtime::NDArray& narr);
   void FreeDataSpace(Device dev, void* ptr) final;
+  void FreeDataSpaceView(Device dev, void* ptr) final;
   void StreamSync(Device dev, TVMStreamHandle stream) final;
   void* AllocWorkspace(Device dev, size_t size, DLDataType type_hint) final;
   void FreeWorkspace(Device dev, void* data) final;
+  size_t GetDataSize(const DLTensor& arr, Optional<String> mem_scope = NullOpt) final;
 
-  // Texture (image2d_t) alloca APIs
-  cl_mem AllocTexture(Device dev, size_t width, size_t height, DLDataType type_hint);
-  void* AllocTextureWorkspace(Device dev, size_t width, size_t height, DLDataType type_hint);
-  void FreeTextureWorkspace(Device dev, void* data);
+  // cl_mem alloc utils
+  void* AllocCLBuffer(Device dev, size_t size, size_t alignment, DLDataType type_hint);
+  void* AllocCLImage(Device dev, void* back_buffer, size_t width, size_t height, size_t row_pitch,
+                     DLDataType type_hint, Optional<String> mem_scope);
+  void FreeCLBuffer(Device dev, void* ptr);

Review Comment:
   We don't need this API. All releases are handled in FreeDataSpace with memory_manager. Removing now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org