llvm::InteractiveModelRunner

MLModelRunner that requests advice from an external agent over two files.

Synopsis

Declared in <llvm/Analysis/InteractiveModelRunner.h>

class InteractiveModelRunner
    : public MLModelRunner

Description

It uses 2 files - ideally named pipes - one to send data to that agent, and one to receive advice. The data exchange uses the training logger (Utils/TrainingLogger.h) format. Specifically, the compiler will send the log header, set the context, and send observations; the host is expected to reply with a tensor value after each observation as a binary buffer that's conforming to the shape of the advice. Interleaved, the data closely resembles the training log for a log where we don't capture the reward signal.

Note that the correctness of the received data is the responsibility of the host. In particular, if insufficient data were sent, the compiler will block when waiting for an advice.

Note that the host can either open the pipes RW, or open first the pipe to the compiler - i.e. the "Inbound" - and then the "Outbound", to avoid deadlock. This is because the compiler first tries to open the inbound (which will hang until there's a writer on the other end).

Base Classes

NameDescription
MLModelRunnerInterface for evaluating an ML model given tensors as arguments.

Enums

NameDescription
Kind Kind of concrete MLModelRunner implementation.

Member Functions

NameDescription
InteractiveModelRunner [constructor]Construct an interactive runner that exchanges tensors with a host agent.
~InteractiveModelRunner [destructor] [virtual]Destroy this InteractiveModelRunner.
operator= [deleted]Deleted copy assignment; MLModelRunner is not assignable.
evaluate Evaluate the model and return the result cast to type T.
getKind Return the concrete runner kind of this instance.
getTensor getTensor overloads
getTensorUntyped getTensorUntyped overloads
switchContext [virtual]Switch the logging context to Name and flush pending output.

Static Member Functions

NameDescription
classof Return true if R is an InteractiveModelRunner.

Protected Member Functions

NameDescription
evaluateUntyped [virtual]Run the model and return an untyped pointer to the result buffer.
setUpBufferForTensor Bind input buffer Index to Buffer, or allocate owned storage.

Protected Data Members

NameDescription
Ctx LLVM context used for diagnostics by this runner.
Type Concrete kind of this MLModelRunner instance.