[Formal][Property Annotation] Annotate Reconvergent-paths using flow variables#716
[Formal][Property Annotation] Annotate Reconvergent-paths using flow variables#716Basmet0 merged 50 commits intoEPFL-LAP:mainfrom
Conversation
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
| // channel metadata | ||
| CPVar i1 = CPVar(llvm::formatv("#x1{0}", getUniqueName(&op)).str(), | ||
| VarType::INTEGER); | ||
| CPVar i2 = CPVar(llvm::formatv("#x2{0}", getUniqueName(&op)).str(), | ||
| VarType::INTEGER); |
There was a problem hiding this comment.
Here we should describe the model that we assume:
every unit is a cascade of: merge/join/mux -(internal_channel1)-> [slot]* -(internal_channel2)-> fork
Rename i1 -> lambda_internal_channel1
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Show resolved
Hide resolved
| } | ||
|
|
||
| LogicalResult | ||
| HandshakeAnnotatePropertiesPass::annotateReconvergentPathFlow(ModuleOp modOp) { |
There was a problem hiding this comment.
Split this function into multiple smaller ones:
- createFlowVariables
- addEquations
- solveGaussian
- ...
|
We could do a separate PR for class HandshakeOpInternalState |
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
328830b to
98ee18d
Compare
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
|
@Basmet0 could you please add one CI/CD example to test this PR? we can invent a new kernel without any memory accesses |
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
| auto slots = cmergeOp.getInternalSlotStateNamers(); | ||
| std::shared_ptr<InternalStateNamer> slotNamer = | ||
| std::make_shared<BufferSlotFullNamer>(slots[0]); | ||
| FlowVariable slot(slotNamer); |
There was a problem hiding this comment.
if we do not use shared ptr here, we could just do
FlowVariable slot(cmergeOp.getInternalSlotStateNamers()[0]);
Which is much more readable IMO. I think here we should focus on more the readbility of the APIs
There was a problem hiding this comment.
It needs to be a pointer as InternalStateNamer is a virtual class. I created a wrapper around it that hides the shared pointer creation, and the API now looks similar to your example.
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
experimental/lib/Analysis/FormalPropertyAnnotation/HandshakeAnnotateProperties.cpp
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // Utility functions for handling flow variables with index tokens | ||
| inline bool isIndex() const { return indexTokenConstraint.has_value(); } |
There was a problem hiding this comment.
-> hasIndexConstraint?
Add an example of what we are talking about here
…e invariant in hopes of allowing nuXmv to prove them with 1-induction
separation of function into smaller steps
properly support latency-induced slots while extracting local equations
i.e. most operators are blind to +-
…hers, instead of using default handling where it could lead to incorrect output
…ndividually, rather than grouping most operations into one big case. Moving equation extraction into FlowExpression.cpp
Jiahui17
left a comment
There was a problem hiding this comment.
Awesome, thanks for the nice work!
Each operation has local properties on how tokens are distributed between inputs and outputs. For example, a join operation expects the same number of tokens coming from each input, and sends them to its output. By extracting all of these local equations from a circuit, and then performing Gaussian elimination, one gets equations that describe properties of paths using only the internal states of the operations, rather than having to keep track of how many tokens are sent across each channel.