Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Simulation] TaskFlow-based IPs Simulation in HCL-dialect #198

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

hecmay
Copy link
Collaborator

@hecmay hecmay commented Aug 29, 2023

  • We use TaskFlow to simulate multiple IPs running in parallel. Each IP is wrapped inside a TaskFlow worker. We rely on TaskFlow to schedule the execution of each IP. An IP is executed when all its dependent IPs have finished their execution. Inside the TaskFlow worker, we use MLIR’s JIT engine to execute the IP and dump the results as protobuf binary files.

  • We define a protobuf specification used to serialize/deserialize the data exchanged between two dependent IPs in the simulation. The data exchange format should track the number of arguments in an IP, and the exact type of each argument. For fixed point data types, the number of bits used to represent the data is also tracked.

  • The serialized data is stored in a protobuf binary file, and the file is passed to the dependent IP as an argument. The dependent IP will deserialize the data and use it as its input.

===== IP Simulator Design =====

  • Assumption: in this proposal, we only consider IP in HCL. Specifically, a HCL IP is a module customized with decoupled schedules in hcl-dialect. An HCL IP is reusable and can be instantiated multiple times in a design, and it is internally represented as an MLIR module.

  • TaskFlow-based IPs simulation: we use TaskFlow to simulate multiple IPs running in parallel. In the simulation process, each IP is wrapped inside a TaskFlow worker. We rely on TaskFlow to schedule the execution of each IP. An IP is executed when all its dependent IPs have finished their execution. Inside the TaskFlow worker, we use MLIR’s JIT engine to execute the IP and dump the results.

  • Inter-IP data exchange format. The simulator should be aware of the data precision schemes used in the IPs when running the actual simulation. The data exchange format should track the number of arguments in an IP, and the exact type of each argument. For fixed point data types, the number of bits used to represent the data is also tracked.

syntax = "proto3";

message Param {
  string name = 1;
  string data_type = 2;
  int32 bit_width = 3;
  int32 int_width = 4;
  int32 frac_width = 5;
  float value = 6;
}

message ObjectList {
  repeated Param objects = 1;
}

===== Tentative Implementation Plan =====

Add a TaskFlow hook to the HCL dialect after lowering to LLVM IR. The hook will be responsible for:

  • Creating a TaskFlow worker for the IP
  • Submitting the worker to the TaskFlow scheduler
  • Serializing the output results from the IP into a protobuf binary file when the IP finishes its execution (to be used by its dependent IPs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant