GithubHelp home page GithubHelp logo

Comments (3)

jfingerh avatar jfingerh commented on June 18, 2024

Partially remembered and new comments regarding going to the P4 language design work group and extending the definitions of P4 tables to enable similar features.

  • One of the motivations for making these externs is that extern calls can be made within expressions, including within the bodies of P4 actions, and we would like to enable the new extern lookup() calls to be performed within action bodies, among other places in the code.

Note that the P4 language spec has for all 1.x versions released since 2017 disallowed performing table_name.apply() calls within P4 action bodies. Or at least, it has said that P4 implementations need not support this, and the open source p4c compiler has always so far given an error message if you attempt to do so. See Appendix F of the P4_16 language specification, the last table, the row labeled "table", and the column labeled "action", where the cell contains the word "no". That is intended to mean "tables cannot be called (i.e. apply()'d) from within a P4 action".

  • Another reason is that the P4 language design work group is, fairly reasonably, a conservative bunch, representing developers of multiple P4 target devices. Extending tables is possible, but is not a quick process. I certainly do not mind if some day P4 tables are extended with similar capabilities, but one way to convince a conservative group of folks that something is a good, solid, workable idea is to show that multiple targets can implement it, and any issues in its specification have been worked out. Defining new externs can be done in any P4 architecture, without changes to the P4 language specification, and is one way towards this.

from pna.

mihaibudiu avatar mihaibudiu commented on June 18, 2024

This seems related to this p4lang/p4c#2739

from pna.

jfingerh avatar jfingerh commented on June 18, 2024

This issue for the P4 language specification is tracking the possible addition of a list type in the P4 language spec, which would be useful in enabling the p4c front end to perform type-checking on the const_entries or entries argument value of these proposed ExactMap / TernaryMap externs. We can define these externs without that language feature, too, but then the P4 compiler back-ends would need to do all error-checking on the value of those constructor parameters.

Not a big deal to me either way, but if the list type is added to the language spec and p4c relatively soon (e.g. before end of 2022 calendar year), I will update this PR to use that list type for those parameters to these extern constructor calls.

from pna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.