506 views
# REP1: Propagating Scalar Types ###### tags: `design` `vma` `rep` **Status**: `⛔ DISCARDED` ## What is this? We need to propagate the flavor of scalar types in the IR. There will be two users of this: 1. DLA: if we get fine grained information about scalar types on IR instructions, the data types we reconstruct will benefit from them. 2. Backend: propagating types can reduce casts. These two users work on different representations, the former on LLVM IR, the latter in MLIR on the Clift dialect. ## Why is it important? We no longer want `generic32_t` on DLA and we need to drop cast from `generic32_t` to `uint32_t` and the like. ## Design The idea is to have a small pipeline with multiple frontends, an "IR" (just a graph) and then a backend where results are produced, i.e., a map from an element of the input IR to a type of the model. ```graphviz digraph { node [shape=box] rankdir = LR; llvm [label="LLVM IR"] clift [label="Clift"] tfg [label="Type Flow Graph"] output [label="map<Use *, QualifiedType>"] llvm -> tfg clift -> tfg tfg -> output } ``` The graph will be *undirected*. ## Roadmap * Implement the graph * I suggest to use `GenericGraph` with a `ForwardNode`. * Implement a `verify` method for the graph. * Make sure the graph can be serialized by implemented.