echuraev commented on a change in pull request #7819:
URL: https://github.com/apache/tvm/pull/7819#discussion_r613968904
##########
File path: src/runtime/metal/metal_common.h
##########
@@ -45,15 +45,39 @@
namespace tvm {
namespace runtime {
namespace metal {
+/*!
+ * \brief Structure for error handling in queues
+ */
+class Stream {
+ public:
+ explicit Stream(id<MTLDevice> device) : error_happened_(false) {
+ queue_ = [device newCommandQueue];
+ }
+ ~Stream() { [queue_ release]; }
+ id<MTLCommandBuffer> GetCommandBuffer() {
+ id<MTLCommandBuffer> cb = [queue_ commandBuffer];
+ [cb addCompletedHandler:^(id<MTLCommandBuffer> buffer) {
+ if (buffer.status == MTLCommandBufferStatusError) SetErrorStatus();
+ }];
+ return cb;
+ }
+ bool IsErrorHappened() { return error_happened_; }
Review comment:
Renamed. Thank you.
--
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]