[llvm] 735f117 - Revert "[mlgo][nfc] Better pretty printing of interactive mode reply"

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 08:03:12 PST 2023


Author: Mircea Trofin
Date: 2023-02-02T08:02:33-08:00
New Revision: 735f117f4d0deb9644d65c8fe8a80add058e7a2b

URL: https://github.com/llvm/llvm-project/commit/735f117f4d0deb9644d65c8fe8a80add058e7a2b
DIFF: https://github.com/llvm/llvm-project/commit/735f117f4d0deb9644d65c8fe8a80add058e7a2b.diff

LOG: Revert "[mlgo][nfc] Better pretty printing of interactive mode reply"

This reverts commit 9cffabc68ca380be937e192be909feff7b144822.

Broke windows builds

Added: 
    

Modified: 
    llvm/lib/Analysis/InteractiveModelRunner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InteractiveModelRunner.cpp b/llvm/lib/Analysis/InteractiveModelRunner.cpp
index a0f42fb59190..2e9a906964b1 100644
--- a/llvm/lib/Analysis/InteractiveModelRunner.cpp
+++ b/llvm/lib/Analysis/InteractiveModelRunner.cpp
@@ -18,10 +18,18 @@
 
 using namespace llvm;
 
-static cl::opt<bool> DebugReply(
-    "interactive-model-runner-echo-reply", cl::init(false), cl::Hidden,
+#define _IMR_CL_VALS(T, N) clEnumValN(TensorType::N, #T, #T),
+
+static cl::opt<TensorType> DebugReply(
+    "interactive-model-runner-echo-type", cl::init(TensorType::Invalid),
+    cl::Hidden,
     cl::desc("The InteractiveModelRunner will echo back to stderr "
-             "the data received from the host (for debugging purposes)."));
+             "the data received "
+             "from the host as the specified type (for debugging purposes)."),
+    cl::values(SUPPORTED_TENSOR_TYPES(_IMR_CL_VALS)
+                   clEnumValN(TensorType::Invalid, "disable", "Don't echo")));
+
+#undef _IMR_CL_VALS
 
 InteractiveModelRunner::InteractiveModelRunner(
     LLVMContext &Ctx, const std::vector<TensorSpec> &Inputs,
@@ -67,15 +75,15 @@ void *InteractiveModelRunner::evaluateUntyped() {
   const size_t Limit = OutputBuffer.size();
   while (InsPoint < Limit) {
     auto ReadOrErr = ::sys::fs::readNativeFile(
-        Inbound, {Buff + InsPoint, OutputBuffer.size() - InsPoint});
+        sys::fs::convertFDToNativeFile(Inbound),
+        {Buff + InsPoint, OutputBuffer.size() - InsPoint});
     if (ReadOrErr.takeError()) {
       Ctx.emitError("Failed reading from inbound file");
       break;
     }
     InsPoint += *ReadOrErr;
   }
-  if (DebugReply)
-    dbgs() << OutputSpec.name() << ": "
-           << tensorValueToString(OutputBuffer.data(), OutputSpec) << "\n";
+  if (DebugReply != TensorType::Invalid)
+    dbgs() << tensorValueToString(OutputBuffer.data(), OutputSpec);
   return OutputBuffer.data();
 }


        


More information about the llvm-commits mailing list