-
Notifications
You must be signed in to change notification settings - Fork 298
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
[FIRRTL] Introduce element-wise operations #4636
Conversation
852c436
to
c90fa70
Compare
1be80de
to
073ff1a
Compare
e984631
to
9f88c62
Compare
|
c9cb22d
to
893da10
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.
LGTM
/// attribute. If a replaced op has a "name" attribute, this function propagates | ||
/// the name to the new value. | ||
template <typename OpTy, typename... Args> | ||
static OpTy replaceOpWithNewOpAndCopyName(PatternRewriter &rewriter, |
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.
I don't know that we need to promote this. I know you use it below, but it's not clear that you need to (see later comments)
op->getLoc(), vectorCreateOp.getType(), lhs); | ||
auto rhsVec = rewriter.createOrFold<VectorCreateOp>( | ||
op->getLoc(), vectorCreateOp.getType(), rhs); | ||
replaceOpWithNewOpAndCopyName<ResultOpType>(rewriter, op, lhsVec, rhsVec); |
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.
Vector create isn't going to have a name, since it can't come from Chisel/FIRRTL.
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.
Vector create could have names if they are created by canonicalizing vector wires
Status? |
893da10
to
8f27f55
Compare
8f27f55
to
f7755bc
Compare
This PR introduces element-wise operations,
firrrtl.elementwise_or, firrtl.elementwise_and
andfirrtl.elementwise_xor
to represent logical operations over 1d vector types.vector_create (a[0] or b[0], a[1] or b[1], a[2] or b[2], ...)
->elementwise_or a, b
is added.elementwise_or a, b
->bitcast(comb.or (bitcast a), (bitcast b))
Example:
These temporary wires
_GEN
and_GEN_0
are unnecessary so ExportVerilog needs to be improved but probably we want to introduce vector operations to HW instead of relying on bitcast.