-
Notifications
You must be signed in to change notification settings - Fork 0
Emit p4info , bfrt and context for MatchValueLookupTable #16
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
base: main
Are you sure you want to change the base?
Conversation
|
correponding changes in kamleshbhalui/p4runtime#1 |
usha1830
left a comment
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 have reviewed at high level and given some comments. Please check
Also please attach a P4 program and generated p4info and bfrt json files
control-plane/bfruntime.cpp
Outdated
| BUG("Invalid oneof case for the match type of table '%1%'", pre.name()); | ||
| break; | ||
| } | ||
| addKeyField(keys_json, mf.id(), mf.name(), false /* mandatory */, |
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.
indentation
| } | ||
| }; | ||
|
|
||
| template<> struct MatchValueLookupTableTraits<Arch::V1MODEL2020> { |
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.
This may be just PNA specific. Why do we add it for V1Model
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.
it's easiest to fix compilation rather separating again entire p4info generation mechanism for pna from rest.
anyway it will be compilation error for rest of all arches
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.
ok
| MatchValueLookupTable(cstring n, uint32_t kbw, std::vector<param_t> params_list, | ||
| uint32_t sz, const IR::IAnnotated* annos = nullptr) : | ||
| name(n), key_bitwidth(kbw), params(params_list), size(sz), annotations(annos) {} | ||
| static void add_mvlut_param(uint32_t ¶m_count, std::vector<param_t>* params_list, |
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 think we should add a new lines between the variable declarations, constructor call and the last static func
|
Tests are failing |
|
Test will fail here because p4info is coming from another repo called p4runtime |
usha1830
left a comment
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.
Looks fine.
psivanup
left a comment
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.
Looks ok to me.
Is it possible to add a testcase to emit/validate p4info, bfrt Json?
71da7a9 to
1d20474
Compare
9bb4f12 to
acede95
Compare
psivanup
left a comment
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.
Looks fine to me.
I'm not sure if open source repo maintainers allow adding MatchValueLookupTable to all archs or only to PNA.
backends/dpdk/dpdkArch.h
Outdated
| "%1%: expected size and optionally init_val as arguments", d); | ||
| } | ||
| } else if (externTypeName == "MatchValueLookupTable") { | ||
| if (d->arguments->size() != 1 && |
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.
Hope you check can for boundaries ( > 0 && <= 3) instead of three individual comparisons.
usha1830
left a comment
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 have few minor comments. Please check and update
| } | ||
| } | ||
| } | ||
| // for match value lookup tables decls |
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.
Can we not combine these two for loops?
| }; | ||
|
|
||
| struct LookupMatchAttributes { | ||
| std::vector<LookupHwBlocks*> hardware_blocks; |
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.
We should change this name to maybe "target_blocks" or "pipeline_blocks". DPDK is a software pipeline, so we should not use hardware. This applies to all the places where "Hardware" is used.
| (uint32_t)type->width_bits()}); | ||
| } | ||
| } | ||
| /// @return the information required to serialize an @instance of register |
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.
Comment says : instance of "register", should be MatchValueLookupTable instead?
8523529 to
681980d
Compare
Co-authored-by: Sivanupandi, Pitchumani <pitchumani.sivanupandi@intel.com>
* Emit context json for MatchValueLookupTable externs Co-authored-by: Subramanian, Maheswari <maheswari.subramanian@intel.com> Saroha, Yogender Singh <yogender.singh.saroha@intel.com> * Addressed comments * checks for mirror_profiles * updated field name * Remove strict condition for now about structure arg * use bits not bytes * Fix some json key names
681980d to
03c5cbe
Compare
Co-authored-by: Sivanupandi, Pitchumani pitchumani.sivanupandi@intel.com