-
Notifications
You must be signed in to change notification settings - Fork 277
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
[MapArith] Introduce --map-arith-to-comb
pass
#5297
Conversation
47da39d
to
299e5a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some drive-by suggestions.
LogicalResult | ||
matchAndRewrite(arith::ExtSIOp op, OpAdaptor adaptor, | ||
ConversionPatternRewriter &rewriter) const override { | ||
size_t outWidth = op.getType().getIntOrFloatBitWidth(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arith
also supports vectors and tensors in which case this would just crash. Maybe add a TypeConverter
which only marks IntegerType
legal or check it otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - we definitely want to make it clear what things can and can't be trivially converted with this pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this pass makes sense to me, we could use it in several places in lieu of a proper low-level operator library.
Adds a pass which does a simple `arith` to `comb` mapping. The intention of this pass is mainly to get code out of Handshake (and wherever else we do some ad-hoc, simple arith-to-comb mapping/HLS), thus allowing integration testing of DC flows (refresher: handshake-to-dc lowers handshake ops to a combination of `dc` and `arith`). This **does not** intend to be the definitive lowering/HLS pass of `arith` operations (hence the name "map" instead of e.g. "lower"). See it more as a temporary pass to provide this kind of functionality until we have an operator library + library mapping pass. Currently, this pass strictly does operation mapping. If needed, `index`-type conversion could also be moved to this pass (e.g. setting `index` type width as a parameter of the pass).
5858ceb
to
4069c3e
Compare
This commit adds a lowering of DC operation to a combination of `comb,seq` and `hw` operations. The implementations are identical to those of the `handshake` dialect (i.e. `handshake-to-hw` sans the arithmetic operations). - ESI-typed I/O - DC buffers lower to ESI buffers - This is just a temporary solution. I anticipate more complexity here in the future when we want to do more with the FIFOs that connect DC circuits. - In case the IR contains DC operations that need to be clocked (fork, buffer), there must exist a clock and reset signal in the parent `FunctionLike` operation. These arguments are to be marked with a `dc.clock` and `dc.reset` attribute, respectively. - Only a single integration test for now. Will add more once #5297 lands (allows us to do some high-level tests through handshake).
This commit adds a lowering of DC operation to a combination of `comb,seq` and `hw` operations. The implementations are identical to those of the `handshake` dialect (i.e. `handshake-to-hw` sans the arithmetic operations). - ESI-typed I/O - DC buffers lower to ESI buffers - This is just a temporary solution. I anticipate more complexity here in the future when we want to do more with the FIFOs that connect DC circuits. - In case the IR contains DC operations that need to be clocked (fork, buffer), there must exist a clock and reset signal in the parent `FunctionLike` operation. These arguments are to be marked with a `dc.clock` and `dc.reset` attribute, respectively. - Only a single integration test for now. Will add more once #5297 lands (allows us to do some high-level tests through handshake).
This commit adds a lowering of DC operation to a combination of `comb,seq` and `hw` operations. The implementations are identical to those of the `handshake` dialect (i.e. `handshake-to-hw` sans the arithmetic operations). - ESI-typed I/O - DC buffers lower to ESI buffers - This is just a temporary solution. I anticipate more complexity here in the future when we want to do more with the FIFOs that connect DC circuits. - In case the IR contains DC operations that need to be clocked (fork, buffer), there must exist a clock and reset signal in the parent `FunctionLike` operation. These arguments are to be marked with a `dc.clock` and `dc.reset` attribute, respectively. - Only a single integration test for now. Will add more once #5297 lands (allows us to do some high-level tests through handshake).
Adds a pass which does a simple
arith
tocomb
mapping. The intention of this pass is mainly to get code out of Handshake (and wherever else we do some ad-hoc, simple arith-to-comb mapping/HLS), thus allowing integration testing of DC flows (refresher: handshake-to-dc lowers handshake ops to a combination ofdc
andarith
).This does not intend to be the definitive lowering/HLS pass of
arith
operations (hence the name "map" instead of e.g. "lower"). See it more as a temporary pass to provide this kind of functionality until we have an operator library + library mapping pass.Currently, this pass strictly does operation mapping. If needed,
index
-type conversion could also be moved to this pass (e.g. settingindex
type width as a parameter of the pass).