Skip to content

Need input about a CompilerBug in Tofino compiler #5243

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

Open
maheswari-s opened this issue Apr 25, 2025 · 2 comments
Open

Need input about a CompilerBug in Tofino compiler #5243

maheswari-s opened this issue Apr 25, 2025 · 2 comments
Labels
question This is a topic requesting clarification. tofino Topics related to the Tofino switch and back end.

Comments

@maheswari-s
Copy link
Contributor

For a P4 program, when it is compiled with alt-phv-alloc flag, compiler bug at line number 754 is hitting in the below file:

https://github.com/p4lang/p4c/blob/main/backends/tofino/bf-p4c/mau/action_analysis.cpp

More insight about this internal compiler error would be useful to address the issue. Thanks.

@ChrisDodd
Copy link
Contributor

ChrisDodd commented Apr 26, 2025

This particular bug check

        BUG_CHECK(!write_slice,
                  "ActionAnalysis did not split up container by container. "
                  "Field: %1%, alloc1: %2%, alloc2: %3%, table: %4%.",
                  field->name, *write_slice, alloc, cont_action.table_context->externalName());

is complaining that a field being written by an action in a table has been sliced/allocated such that two different parts of the same PHV container are being written. The message should contain the field name and the table name (but not the action name oddly), as well as the two slices.

Basically, complaining that PHV allocation has allocated things in a way such that code cannot be generated for an action (it would require two writes to the same PHV container at the same time).

If you attach the P4 code that hits this, I might be able to give you more detail about what is going wrong.

@fruffy fruffy added question This is a topic requesting clarification. tofino Topics related to the Tofino switch and back end. labels Apr 26, 2025
@maheswari-s
Copy link
Contributor Author

@ChrisDodd Thank you for your response.
The P4 program is very huge and i am finding it very challenging in simplifying it.
Here is the actual error message (names slightly modified).

..........
In file: p4c/backends/tofino/bf-p4c/mau/action_analysis.cpp:754
Compiler Bug: ActionAnalysis did not split up container by container.
Field: ControlEgress.process_sub_control_1.temp_value_reg$index,
alloc1: H5 bit[12..0] <-- ControlEgress.process_sub_control_1.temp_value_reg$index<13> meta [0:12] live at P[9w, 9w] } 0 units {},
alloc2: H5 bit[12..0] <-- ControlEgress.process_sub_control_1.temp_value_reg$index<13> meta [0:12] live at P[10r, 10r] } 0 units {},
table: ControlEgress.process_sub_control_1.table_1_getvaluelist.

Internal compiler error. Please submit a bug report with your code.
..........

Please check if you can give some more insight about this compiler bug. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a topic requesting clarification. tofino Topics related to the Tofino switch and back end.
Projects
None yet
Development

No branches or pull requests

3 participants