Skip to content

Commit

Permalink
Added doxygen comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Umesh-k26 committed Jan 14, 2024
1 parent b3f7359 commit fe12955
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 6 deletions.
6 changes: 6 additions & 0 deletions include/MLModelRunner/MLModelRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// Base MLModelRunner class which exposes APIs to set the features
// to be send to the ML model and get the result back from the model.
//
// How to support a new ModelRunner:
// 1. Create a new class which inherits from MLModelRunner.
// 2. Implement the evaluateUntyped() method.
//===----------------------------------------------------------------------===//
//

Expand Down
9 changes: 9 additions & 0 deletions include/MLModelRunner/ONNXModelRunner/ONNXModelRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
// See the LICENSE.txt file under ml-llvm-tools directory for license
// information.
//
// ONNXModelRunner class supporting communication via ONNX Runtime
//
// How to use?
// 1. Create agent objects with the path to the ONNX model
// 2. Create an environment object inheriting from MLBridge::Environment
// 3. Create an ONNXModelRunner object with the environment and the agents
// 4. Populate the features to be sent to the model
// 5. Call evaluate() to get the result back from the model
//
//===----------------------------------------------------------------------===//

#ifndef ONNX_MODELRUNNER_H
Expand Down
6 changes: 6 additions & 0 deletions include/MLModelRunner/ONNXModelRunner/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
// See the LICENSE.txt file under ml-llvm-tools directory for license
// information.
//
// Agent class to support ML model inference
//
// How to use?
// 1. Construct an agent object with the path to the ONNX model
// 2. Call computeAction() to get the action from the model
//
//===----------------------------------------------------------------------===//

#ifndef ONNX_MODELRUNNER_AGENT_H
Expand Down
6 changes: 6 additions & 0 deletions include/MLModelRunner/ONNXModelRunner/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
// See the LICENSE.txt file under ml-llvm-tools directory for license
// information.
//
// Base Environment class to support ML model inference
//
// How to use?
// 1. Create an environment class inheriting from MLBridge::Environment
// 2. Implement the step() and reset() methods
// 3. Create an ONNXModelRunner object with the environment and the agents
//===----------------------------------------------------------------------===//

#ifndef ONNX_MODELRUNNER_ENVIRONMENT_H
Expand Down
15 changes: 10 additions & 5 deletions include/MLModelRunner/PipeModelRunner.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
//===- PipeModelRunner.h ---- "gym" ML model runner -----*- C++ -*-===//
//===- PipeModelRunner.h ---- PipeModelRunner -----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// PipeModelRunner class supporting communication via OS pipes
//
// How to use?
// 1. Create a PipeModelRunner object with the names of the pipes, and the
// serialization technique
// 2. Populate the features to be sent to the model
// 3. Call evaluate() to get the result back from the model
//
//===----------------------------------------------------------------------===//

#ifndef PipeModelRunner_H
#define PipeModelRunner_H
Expand All @@ -23,9 +30,7 @@ namespace MLBridge {
/// A MLModelRunner that asks for advice from an external agent, or host. 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
/// The compiler will 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.
Expand Down
11 changes: 10 additions & 1 deletion include/MLModelRunner/gRPCModelRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
// See the LICENSE.txt file under ml-llvm-tools directory for license
// information.
//
//===----------------------------------------------------------------------===//
// gRPCModelRunner class supporting communication via gRPC
//
// How to use?
// 1. Create a .proto file with the service and message definitions
// 2. Generate the stubs using protoc
// 3. Create a gRPCModelRunner object with the server address, stub, request and
// response
// 4. Populate the features to be sent to the model
// 5. Call evaluate() to get the result back from the model
// ===----------------------------------------------------------------------===//

#ifndef GRPC_MODELRUNNER_H
#define GRPC_MODELRUNNER_H
Expand Down
7 changes: 7 additions & 0 deletions include/SerDes/baseSerDes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
//
// Part of the MLCompilerBridge Project
//
// Base class for serialization and deserialization
//
// How to support a new serializtion technique:
// 1. Create a new class which inherits from BaseSerDes.
// 2. Implement the setFeature(), getSerializedData()
// cleanDataStructures() and deserializeUntyped()
// methods.
//===------------------===//

#ifndef BASE_SERDES_H
Expand Down
3 changes: 3 additions & 0 deletions include/SerDes/bitstreamSerDes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
//
// Part of the MLCompilerBridge Project
//
// Bitstream Serialization/Deserialization which sends header information
// followed by the raw data.
//
//===------------------===//

#ifndef BITSTREAM_SERIALIZER_H
Expand Down
1 change: 1 addition & 0 deletions include/SerDes/jsonSerDes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//
// Part of the MLCompilerBridge Project
//
// Json Serialization/Deserialization using LLVM's json library
//===------------------===//

#ifndef JSON_SERIALIZER_H
Expand Down
1 change: 1 addition & 0 deletions include/SerDes/protobufSerDes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//
// Part of the MLCompilerBridge Project
//
// Protobuf Serialization/Deserialization to support gRPC communication
//===------------------===//

#ifndef PROTOBUF_SERIALIZER_H
Expand Down

0 comments on commit fe12955

Please sign in to comment.