25 InputSpecs(Inputs), OutputSpec(Advice),
26 InEC(
sys::
fs::openFileForRead(InboundName, Inbound)),
27 OutputBuffer(OutputSpec.getTotalTensorBufferSize()) {
29 Ctx.emitError(
"Cannot open inbound file: " + InEC.message());
33 auto OutStream = std::make_unique<raw_fd_ostream>(OutboundName, OutEC);
35 Ctx.emitError(
"Cannot open outbound file: " + OutEC.message());
38 Log = std::make_unique<Logger>(std::move(OutStream), InputSpecs, Advice,
43 for (
size_t I = 0;
I < InputSpecs.size(); ++
I)
54 Log->startObservation();
55 for (
size_t I = 0;
I < InputSpecs.size(); ++
I)
57 Log->endObservation();
63 while (InsPoint < Limit) {
67 if (ReadOrErr.takeError()) {
68 Ctx.emitError(
"Failed reading from inbound file");
71 InsPoint += *ReadOrErr;
74 dbgs() << OutputSpec.name() <<
": "
76 return OutputBuffer.data();
~InteractiveModelRunner() override
InteractiveModelRunner(LLVMContext &Ctx, const std::vector< TensorSpec > &Inputs, const TensorSpec &Advice, StringRef OutboundName, StringRef InboundName)
This is an important class for using LLVM in a threaded context.
virtual void * evaluateUntyped()=0
void * getTensorUntyped(size_t Index)
void setUpBufferForTensor(size_t Index, const TensorSpec &Spec, void *Buffer)
MLModelRunner(const MLModelRunner &)=delete
Represent a constant reference to a string, i.e.
LLVM_ABI std::error_code closeFile(file_t &F)
Close the file object.
LLVM_ABI Expected< size_t > readNativeFile(file_t FileHandle, MutableArrayRef< char > Buf)
Reads Buf.size() bytes from FileHandle into Buf.
LLVM_ABI file_t convertFDToNativeFile(int FD)
Converts from a Posix file descriptor number to a native file handle.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
const AnalysisOptions & getAnalysisOptions(const LLVMContext &C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI std::string tensorValueToString(const char *Buffer, const TensorSpec &Spec)
For debugging.
This class wraps the platform specific file handle/descriptor type to provide an unified representati...