Hi,
I would like to confirm whether P4 (P4_16) support a popcount / bit-count operation in the data plane.
If not, then implementing popcount manually in P4 seems like it would consume many pipeline stages — is that really the only option?
Thanks!
Hi,
I would like to confirm whether P4 (P4_16) support a popcount / bit-count operation in the data plane.
If not, then implementing popcount manually in P4 seems like it would consume many pipeline stages — is that really the only option?
Thanks!
Dear @1418915702 ,
P4 specification does not mention such an operation among the standard ones and hence does not mandate it to be supported on any target.
Having said that, many targets should allow you to implement bit-count operation quite efficiently, at least for as long as the width of the argument is reasonable (up to 64 bits for example).
Other targets may provide a dedicated, efficient operation via an extern, but for that you need to look at the specific target’s documentation.
Happy hacking,
Vladimir