[Simulation] TaskFlow-based IPs Simulation in HCL-dialect #198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
===== Tentative Implementation Plan =====
Add a TaskFlow hook to the HCL dialect after lowering to LLVM IR. The hook will be responsible for: