Add assert and assume extern functions to PNA include file?
jfingerh opened this issue · 4 comments
They have recently been added to the PSA include file with this commit: https://github.com/p4lang/p4-spec/blob/main/p4-16/psa/psa.p4#L340-L403
Do we want these added to pna.p4 include file as well? They can be very useful in testing of P4 code on software-based devices, e.g. BMv2 and DPDK. Typically they would be compiled as no-ops on hardware targets.
TODO Andy: Discussing this with Cristian Dumitrescu on precisely how these would be implemented on DPDK.
Note that they are already implemented on BMv2 for the v1model architecture. The PSA implementation for BMv2 is only partial as of 2022-Oct, with no one that I know of currently actively working to finish it. Similarly, I do not know of anyone working on BMv2 implementation of PNA architecture at this time.
+1 from me.
Is the architecture include file the right place for defining these methods? It seems to me like they would be better placed in an orthogonal header (e.g. core.p4
), as there is really nothing architecture-specific about these 2 methods.
@thomascalvert-xlnx in general, we are conservative about adding types and primitives to core.p4
as they must be implemented by every architecture (and therefore every compiler backend). So for assert
and assume
we first added them to V1Model. The idea was always that if they were useful, and there was a push to use them in more architectures, then we would consider them as candidates for addition to core.p4
instead. Maybe now is the time to have that discussion.