This is an automated email from the ASF dual-hosted git repository.

lunderberg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new f044eefd0e [Runtime][Disco] Restore checks for hangup of disco pipe 
(#16997)
f044eefd0e is described below

commit f044eefd0e55529db17ee1134c962070de4bc058
Author: Eric Lunderberg <[email protected]>
AuthorDate: Wed May 15 08:16:15 2024 -0500

    [Runtime][Disco] Restore checks for hangup of disco pipe (#16997)
    
    This resolves a conflict between two recent changes.  In
    https://github.com/apache/tvm/pull/16989, reads of size zero are used
    to identify hangups in `ProcessSession`.  In
    https://github.com/apache/tvm/pull/16992, reads of size zero are
    treated as an error to avoid infinite loops while waiting for data to
    be ready.
    
    For a long-term resolution, the `dmlc::Stream` interface will need to
    be updated, so that the `Write` method returns the number of bytes
    written, just as the `Read` method currently does.  This will allow
    the calling scope to verify the number of bytes received.
---
 src/support/pipe.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/support/pipe.h b/src/support/pipe.h
index 50ad2b5786..7251a6f14a 100644
--- a/src/support/pipe.h
+++ b/src/support/pipe.h
@@ -92,7 +92,11 @@ class Pipe : public dmlc::Stream {
           RetryCallOnEINTR([&]() { return read(handle_, ptr, size); }, 
GetLastErrorCode);
       ICHECK_NE(nread_chunk, -1) << "Write Error: " << strerror(errno);
 
-      ICHECK_GT(nread_chunk, 0) << "Was unable to read any data from pipe";
+      if (nread_chunk == 0) {
+        break;
+      }
+
+      ICHECK_GE(nread_chunk, 0);
       ICHECK_LE(nread_chunk, size) << "Read " << nread_chunk << " bytes, "
                                    << "but only expected to read " << size << 
" bytes";
       size -= nread_chunk;

Reply via email to