-
Notifications
You must be signed in to change notification settings - Fork 305
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
[Draft] [OpLib] Create a Dialect for Representing Operator Libraries #7771
base: main
Are you sure you want to change the base?
Conversation
This is awesome!! |
return success(); | ||
} | ||
}]; | ||
// let assemblyFormat = [{ |
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.
nit: commented out code.
attr = builder.getArrayAttr(alreadyParsed); | ||
return success(); | ||
} | ||
return {}; |
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.
nit for clarity: failure()
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.
First, please write a rational doc for the dialect. Semi-standard protocol is to first commit a rational doc with the minimal dialect.td file.
Second, and working without a rational here, so guessing from the code, this seems to have significant overlap with both the pattern rewriting infrastructure and PDLL. If the goal is storing mappings and information about them, an alternate path may be to use table gen to generate the mapping directly rather than generating a dialect which then encodes the mapping. Tablegen has a number of backends and was originally designed to build large mapping tables.
Dropping to comment after another pass.
Opening a draft PR to start getting comments while I finish up the verifier implementation and testing.
The goal of this PR is to introduce a new OpLib library that represents a library of operators in CIRCT. The initial intended use for this library is to unify the representation of operators for SCFToCalyx and LoopScheduleToCalyx. Instead of each pass having their own mapping from high-level operations to a calyx primitive, there will first be a pass that inserts the operator library and then both passes will look at the operator library to determine lowerings. We can also use this information in AffineToLoopSchedule to build the scheduling problem without hardcoding latency and delay information.
After this initial use, OpLib could be augmented to support lowerings to dialects other than Calyx as well as allowing users to add their own custom operators. Supporting variable bitwidth operators that have functions from bitwidth to delay is also something I am interested in implementing eventually.
Example:
Singling in on the
@fmult
operator, we see it has a latency of 4 an incoming delay of 0.5 ns and an outgoing delay of 0.5 ns. Theoplib.target
defines a match target. In this example we will match againstarith.mulf
operations. Theoplib.calyx_match
defines what calyx primitive to produce if the target is matched. In this case we produce a custom calyx primitive for an external floating point multiplier.oplib.calyx_match
verifies that the target type bitwidths match the yielded ins and outs type bitwidths.Let me know if there are any questions or comments about how this works. I will also implement the use of operators in SCFToCalyx before finalizing this PR (but won't yet remove the hardcoded operators).