Repository navigation
Collect symbolic struct variables during tearing - #153
Conversation
| end | ||
| # The fields of a record share a clock: a struct may not be differentially clocked. | ||
| # Separate elements of an array of records are separate instances and may differ. | ||
| record_group = Dict{SymbolicT, Int}() |
There was a problem hiding this comment.
An array of records should all have the same clock, right? The same way an array of variables does. @baggepinnen could you please weigh in too?
There was a problem hiding this comment.
Array elements share the same clock. So an array of structs should do the same.
There was a problem hiding this comment.
This appears to already be the existing behavior, inherited from arrays, so we should be all set here
| SymbolicIndexingInterface = "0.3" | ||
| SymbolicUtils = "4.25" | ||
| Symbolics = "7.20" | ||
| Symbolics = "7.23" |
There was a problem hiding this comment.
Is this compat bound still correct? Does it include the fixes made to struct support after the initial PR?
There was a problem hiding this comment.
yeah, this bound is what's necessary for this to work
Co-authored-by: Aayush Sabharwal <[email protected]>
| _ => nothing | ||
| end | ||
| end | ||
| # Fields of one record share a clock. Indices are not peeled, so elements of an array |
There was a problem hiding this comment.
I'm still confused. Could you explain a bit why this snippet is still necessary? Is there an easy example that hits this case and can be added to a test?
There was a problem hiding this comment.
Sorry, I think I've been doing a poor job here. Currently, the enforcement clocking for arrays as we described is done in SynchToolkit, and I was folding that in here as opposed to in SynchToolkit.
The basic thing we need to enforce is the same thing we've been discussing right, so if I impose a clock on an array, all of the components of the array inherit this single clock. The inheritance happens here, but as I said above, the enforcement of this single clocking happens in SynchToolkit. If this understanding is correct, then I'll just keep the inheritance part.
The split becomes we inherit here (as is done for the elements of a given record) and enforce in SynchToolkit, which appears to be how its done for arrays.
| isprojection || continue | ||
| j = get!(record_group, root, i) | ||
| j == i && continue | ||
| add_edge!(inference_graph, (ClockVertex.Variable(i), ClockVertex.Variable(j))) |
There was a problem hiding this comment.
Okay I think I've managed to wrap my head around this. What this is doing is if we have:
Operator(foo.bar).baz[3].spam
Operator(foo.bar).baz[2].otherIt's going to put them on the same clock, which seems fair. What about:
Operator(foo.bar.baz)[3].spam
Operator(foo.bar).baz[2].otherAs far as I can tell, these two will also be on the same clock. Is this a sane edge case? Is the behavior what we want it to be? CC @kpamnany
There was a problem hiding this comment.
Could you please expand a bit, for my understanding? What Operator is this, for example?
If a component has two different instances, then those should not be put on the same clock.
There was a problem hiding this comment.
Just any general clock operator. Here the variable is foo, in a flat model for simplicity (no hierarchical components)
@variables foo(t)::SomeRecordTypeI'm not sure if there are cases where ST would put clock operators on non-leaf fields of structs, and what the semantics of those would be. If some operator Op has different output and input clocks, are the following two cases equivalent, or even valid?
Op(foo.bar.baz)[3].spam
Op(foo.bar).baz[3].spamIf they're valid, are they on the same clock?
There was a problem hiding this comment.
I'm not convinced that this example is valid? Why is it guaranteed or expected that the output of Op(foo.bar) will have a field baz?
More generally, this is an extension of single clocking of a record, to single clock all records in a given array (by adding the edges as shown above).
There was a problem hiding this comment.
All the contents of foo should be on the same clock. I cannot, at the moment, think of a clock domain crossing operator that could confuse this.
There was a problem hiding this comment.
Okay sure, then I guess this PR looks okay.
Supports future work in MTK to extend symbolic struct features