Skip to content

Commit

Permalink
Fix windows bot breakages due to D143110
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrofin committed Feb 2, 2023
1 parent 4461ffd commit 795910c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/InteractiveModelRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
6 changes: 4 additions & 2 deletions llvm/lib/Analysis/InteractiveModelRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions llvm/unittests/Analysis/MLModelRunnerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

2 comments on commit 795910c

@llvm-beanz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is causing the InteractiveModelRunner.Evaluation test to hang on my local machine.

@mtrofin
Copy link
Member Author

@mtrofin mtrofin commented on 795910c Feb 2, 2023 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.