p4lang / p4c-bm

Generates the JSON configuration for the behavioral-model (bmv2), as well as the C/C++ PD code
Apache License 2.0
24 stars 29 forks source link

__main__.py (p4c-bmv2) stuck at "add padding" #87

Closed qq995002966 closed 7 years ago

qq995002966 commented 7 years ago

when compile p4 source code which is similar to TLV_parsing , p4c-bm stuck after output

parsing successful
semantic checking successful
Header type standard_metadata_t not byte-aligned , adding padding 

Thanks for the help , John

antoninbas commented 7 years ago

I don't understand this issue. Why did you rename it to "sorry about the mistake"? That's a pretty useless title. If you think the compiler is getting stuck on a particular P4 input, please make sure that you have the latest version of p4-hlir and p4c-bm. If the problem persists, please send your P4 source so we can reproduce the issue.

qq995002966 commented 7 years ago

the title is about my network : After posted this issue I refresh the page , but found two same post on the list ( actually there is only one post , maybe it because my network latency). So I closed one post and changed it's title to "sorry about the mistake" (╯﹏╰)b . Besides English is not my mother language ,if some phrase of the post is aggressive , please dismiss it which is absolutely not my real meaning.

After upgrade p4-hli and p4c-bm the problem is still exist. Here is my p4 source code , and the command I used to compile is sudo p4c-bmv2 --json simple_router.json simple_router_p4src/simple_router.p4 . Thanks guys. John.

antoninbas commented 7 years ago

I was able to run p4c-bmv2 on your code without any issue. Are you really certain that you are using the latest p4c-bm & p4-hlir. Because I remember addressing this kind of issues in the past: https://github.com/p4lang/p4c-bm/pull/80

qq995002966 commented 7 years ago

Yes , I'm sure . I just recompiled and reinstalled p4c-bm & p4-hlir again . Maybe because your p4c-bmv2 test just on a changing branch . I created a new branch which still have the problem and I'll not push it before your p4c-bmv2 test on it .


I wondering why the TLV_paring could work while my code couldn't . So I add tcp options parser from 1 to 8 (the final code looks like) and found that as the tcp options's count increasing the time p4c-bmv2 used to parse increasing rapidly , seems like a exponential relationship . The follow is the result (on a four cpu core server )

tcp options count time
1 ~ 4 very quick
5 1 second
6 10 second
7 5 minute
8 ...
antoninbas commented 7 years ago

I was able to reproduce this by using the branch reference you provided. This was an issue in p4-hlir, which I fixed with https://github.com/p4lang/p4-hlir/pull/30. Thanks for reporting this issue.