[llvm] 795910c - Fix windows bot breakages due to D143110

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 16:28:22 PST 2023


Author: Mircea Trofin
Date: 2023-02-01T16:27:44-08:00
New Revision: 795910c2d9cc73625ef09fdf1238d27ec41ecbc3

URL: https://github.com/llvm/llvm-project/commit/795910c2d9cc73625ef09fdf1238d27ec41ecbc3
DIFF: https://github.com/llvm/llvm-project/commit/795910c2d9cc73625ef09fdf1238d27ec41ecbc3.diff

LOG: Fix windows bot breakages due to D143110

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/InteractiveModelRunner.h
    llvm/lib/Analysis/InteractiveModelRunner.cpp
    llvm/unittests/Analysis/MLModelRunnerTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/InteractiveModelRunner.h b/llvm/include/llvm/Analysis/InteractiveModelRunner.h
index ffcd4a37c5c7..efec9d0f0b14 100644
--- a/llvm/include/llvm/Analysis/InteractiveModelRunner.h
+++ b/llvm/include/llvm/Analysis/InteractiveModelRunner.h
@@ -61,7 +61,7 @@ class InteractiveModelRunner : public MLModelRunner {
   const TensorSpec OutputSpec;
   std::error_code OutEC;
   std::error_code InEC;
-  sys::fs::file_t Inbound;
+  int Inbound = 0;
   std::vector<char> OutputBuffer;
   std::unique_ptr<Logger> Log;
 };

diff  --git a/llvm/lib/Analysis/InteractiveModelRunner.cpp b/llvm/lib/Analysis/InteractiveModelRunner.cpp
index c449ab4dffda..2e9a906964b1 100644
--- a/llvm/lib/Analysis/InteractiveModelRunner.cpp
+++ b/llvm/lib/Analysis/InteractiveModelRunner.cpp
@@ -59,7 +59,8 @@ InteractiveModelRunner::InteractiveModelRunner(
 }
 
 InteractiveModelRunner::~InteractiveModelRunner() {
-  sys::fs::closeFile(Inbound);
+  sys::fs::file_t FDAsOSHandle = sys::fs::convertFDToNativeFile(Inbound);
+  sys::fs::closeFile(FDAsOSHandle);
 }
 
 void *InteractiveModelRunner::evaluateUntyped() {
@@ -74,7 +75,8 @@ 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;

diff  --git a/llvm/unittests/Analysis/MLModelRunnerTest.cpp b/llvm/unittests/Analysis/MLModelRunnerTest.cpp
index f953c45cfc31..007a8cfef043 100644
--- a/llvm/unittests/Analysis/MLModelRunnerTest.cpp
+++ b/llvm/unittests/Analysis/MLModelRunnerTest.cpp
@@ -167,8 +167,11 @@ TEST(InteractiveModelRunner, Evaluation) {
     // host to open the pipes RW.
     raw_fd_ostream ToCompiler(ToCompilerName, EC);
     EXPECT_FALSE(EC);
-    sys::fs::file_t FromCompiler = {};
-    EXPECT_FALSE(sys::fs::openFileForRead(FromCompilerName, FromCompiler));
+    int FromCompilerHandle = 0;
+    EXPECT_FALSE(
+        sys::fs::openFileForRead(FromCompilerName, FromCompilerHandle));
+    sys::fs::file_t FromCompiler =
+        sys::fs::convertFDToNativeFile(FromCompilerHandle);
     EXPECT_EQ(SeenObservations, 0);
     // Helper to read headers and other json lines.
     SmallVector<char, 1024> Buffer;


        


More information about the llvm-commits mailing list