8000 BUG in Tofino BE: action spanning multiple stages. · Issue #5280 · p4lang/p4c · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
BUG in Tofino BE: action spanning multiple stages. #5280
Open
@Hoooao

Description

@Hoooao

There seems to be a bug when checking if an action can be run in parallel during VerifyInstructionParams pass in instruction_selection.cpp.

Here is an example:

    action error_trigger_1(mac_addr_t srcMac, PortId_t dst_port_4, bit<16> tmp) {
        hdr.ethernet.ether_type = 1 + (tmp - 1);
    }
    @name("SwitchIngress.forward") table forward_0 {
        key = {
        }
        actions = {
            error_trigger_1();
        }
    }

Error message:

[--Werror=unsupported] error: add: action spanning multiple stages. Operations on operand 3 ($tmp7[0..15]) in action error_trigger_1 require multiple stages for a single action. We currently support only single stage actions. Please rewrite the action to be a single stage action.
        hdr.ethernet.ether_type = 1 + (tmp - 1);

This does not just happen to add, but other instructions like shl, sub, xor, saddu, and so on.

A possible cause is, Tofino BE cannot correctly assign $tmp to expressions, and constructs scenarios where a tmp is used in a way that causes a statement cannot run in parallel.

However, if we change the line to hdr.ethernet.ether_type = (tmp - 1) + 1;, then there is no error reported.

I also tried non-action-data, which obey the similar behavior, like hdr.ethernet.ether_type = -hdr.ipv4.hdr_checksum + 1; cause the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tofinoTopics related to the Tofino switch and back end.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0