|
18 | 18 |
|
19 | 19 | using namespace llvm;
|
20 | 20 |
|
21 |
| -#define _IMR_CL_VALS(T, N) clEnumValN(TensorType::N, #T, #T), |
22 |
| - |
23 |
| -static cl::opt<TensorType> DebugReply( |
24 |
| - "interactive-model-runner-echo-type", cl::init(TensorType::Invalid), |
25 |
| - cl::Hidden, |
| 21 | +static cl::opt<bool> DebugReply( |
| 22 | + "interactive-model-runner-echo-reply", cl::init(false), cl::Hidden, |
26 | 23 | cl::desc("The InteractiveModelRunner will echo back to stderr "
|
27 |
| - "the data received " |
28 |
| - "from the host as the specified type (for debugging purposes)."), |
29 |
| - cl::values(SUPPORTED_TENSOR_TYPES(_IMR_CL_VALS) |
30 |
| - clEnumValN(TensorType::Invalid, "disable", "Don't echo"))); |
31 |
| - |
32 |
| -#undef _IMR_CL_VALS |
| 24 | + "the data received from the host (for debugging purposes).")); |
33 | 25 |
|
34 | 26 | InteractiveModelRunner::InteractiveModelRunner(
|
35 | 27 | LLVMContext &Ctx, const std::vector<TensorSpec> &Inputs,
|
@@ -75,15 +67,15 @@ void *InteractiveModelRunner::evaluateUntyped() {
|
75 | 67 | const size_t Limit = OutputBuffer.size();
|
76 | 68 | while (InsPoint < Limit) {
|
77 | 69 | auto ReadOrErr = ::sys::fs::readNativeFile(
|
78 |
| - sys::fs::convertFDToNativeFile(Inbound), |
79 |
| - {Buff + InsPoint, OutputBuffer.size() - InsPoint}); |
| 70 | + Inbound, {Buff + InsPoint, OutputBuffer.size() - InsPoint}); |
80 | 71 | if (ReadOrErr.takeError()) {
|
81 | 72 | Ctx.emitError("Failed reading from inbound file");
|
82 | 73 | break;
|
83 | 74 | }
|
84 | 75 | InsPoint += *ReadOrErr;
|
85 | 76 | }
|
86 |
| - if (DebugReply != TensorType::Invalid) |
87 |
| - dbgs() << tensorValueToString(OutputBuffer.data(), OutputSpec); |
| 77 | + if (DebugReply) |
| 78 | + dbgs() << OutputSpec.name() << ": " |
| 79 | + << tensorValueToString(OutputBuffer.data(), OutputSpec) << "\n"; |
88 | 80 | return OutputBuffer.data();
|
89 | 81 | }
|
0 commit comments