-
Notifications
You must be signed in to change notification settings - Fork 20
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
no match in valset #402
no match in valset #402
Conversation
I think For the second question, because we want to use |
I think this is ready. |
Should we consider using value instead of Inductive action_ref :=
mk_action_ref (action : ident) (args : list (option Expression)). |
Inductive ValueSet:= | ||
| ValSetSingleton (value: (@ValueBase bool)) | ||
| ValSetUniversal | ||
| ValSetMask (value: (@ValueBase bool)) (mask: (@ValueBase bool)) | ||
| ValSetRange (lo: (@ValueBase bool)) (hi: (@ValueBase bool)) | ||
| ValSetProd (_: list ValueSet) | ||
| ValSetLpm (nbits: N) (value: (@ValueBase bool)) | ||
| ValSetValueSet (size: N) (members: list (list (@Syntax.Match tags_t))) (sets: list ValueSet). | ||
| ValSetValueSet (size: N) (members: list (list ValueSet)) (sets: list ValueSet). |
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'm wondering if we should actually remove ValSetValueSet
.
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'm happy to remove ValSetValueSet
. @MollyDream @txyyss what are your thoughts on this?
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.
How do you plan to cover the value set in parsers without ValSetValueSet
?
https://p4.org/p4-spec/docs/P4-16-v-1.2.3.html#sec-select
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.
Is ValSetValueSet
a "value" of a parser select? Sorry if I'm misunderstanding.
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.
Yes, you can scroll the bottom of section 13.6 for reference and examples.
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.
Sounds like what the control plane can store to pvs
is
ValSetValueSet (sets: list ValueSet)
.
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 confess I'm pretty confused. If these are control-plane values, why does P4Light need to represent them as Values? Seems like a different kind of object. Also, since these depend on an arch-specific @match
annotation, isn't it hopeless to try to capture the kinds of elements that can arise in the control plane?
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.
Okay. I don't fully understand it, but let me try to make it more clear. Value-set values are needed at two places: table entries and parser "select" entries. For tables, constant entries are evaluated to value-set values during instantiation, and control plane entries are fed from the control plane as value-set values (so the semantics do not need to evaluate). For parser "select" entries, there are constant entries and control plane entries (using the value_set
keyword), too. I think constant entries are also evaluated to value-set values during instantiation. Each value_set
contains a list of control plane entries, and the semantics needs to fetch them when encountering a value_set
. I assume combining them in one entry is not allowed, e.g.
value_set<vsk_t>(4) pvs;
select (p.tcp.port) {
(1, pvs): runtime_defined_port;
_: other_port;
}
I don't know how to formalize @match
.
I see. In |
Sounds good to me. |
We talked about the action_ref changes in a Cornell meeting today. I don't think that should happen in this pull request because action_refs need to be refactored more invasively to fix #394. Really action_refs should have two lists of parameters and the first list (data plane arguments) should be expressions and the second list (control plane arguments) should be values. I can do that refactor in a separate PR and we can discuss the details then. |
Okay. Yes. There are two parts in the list of arguments, normal arguments and action data from table entries (either from the control plane or the P4 program). I think the former should be removed from |
There's still one pending comment from me. #402 (comment) |
Looks good now. I recommend a squash merge for better history. |
Proposed changes
Match
fromValueSet
.Match
withValueSet
inTarget.v
Questions:
ValSetValueSet
what is is the purpose of the members list? It was a list of list ofMatch
but this has been replaced withValueSet
.Semantics.v
unwrap_table_entry
was used inload_decl
to map aTableEntry
to atable_entry
and put it in agenv
. Now theMatch
s in aTableEntry
need to be converted toValueSet
which requires a relation. Perhaps shouldTableEntry
be used in place oftable_entry
inFTable
, so matches in tables are evaluated upon table invocation? Or maybeload_decl
needs to be a relation too...