tqchen commented on a change in pull request #7714:
URL: https://github.com/apache/tvm/pull/7714#discussion_r598716824
##########
File path: src/runtime/metal/metal_device_api.mm
##########
@@ -147,102 +155,110 @@ int GetWarpSize(id<MTLDevice> dev) {
void* MetalWorkspace::AllocDataSpace(TVMContext ctx, size_t nbytes, size_t
alignment,
DLDataType type_hint) {
- this->Init();
- id<MTLDevice> dev = GetDevice(ctx);
- // GPU memory only
- MTLResourceOptions storage_mode = MTLResourceStorageModePrivate;
- /*
- #if TARGET_OS_IPHONE
- storage_mode = MTLResourceStorageModeShared;
- #else
- storage_mode = MTLResourceStorageModeManaged;
- #endif
- */
- id<MTLBuffer> buf = [dev newBufferWithLength:nbytes options:storage_mode];
- ICHECK(buf != nil);
- return (void*)(CFBridgingRetain(buf));
+ @autoreleasepool {
+ this->Init();
+ id<MTLDevice> dev = GetDevice(ctx);
+ // GPU memory only
+ MTLResourceOptions storage_mode = MTLResourceStorageModePrivate;
+ /*
+ #if TARGET_OS_IPHONE
+ storage_mode = MTLResourceStorageModeShared;
+ #else
+ storage_mode = MTLResourceStorageModeManaged;
+ #endif
+ */
+ id<MTLBuffer> buf = [dev newBufferWithLength:nbytes options:storage_mode];
+ ICHECK(buf != nil);
+ return (void*)(buf);
Review comment:
OK, thanks @echuraev for good explaination
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]