oxidecomputer / oxidecomputer/p4

codegen: rust: when a table size is specified constrain generated tables to that size.

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen rust want
Dominant language
Rust
Stars
137
Forks
12
Avg merge
4d 22h
Merged PRs (30d)
3

Description

The primary purpose of the Rust code generation is to emulate real ASICs. To that end, when a table size property is provided, the underlying table that gets generated in Rust code should behave like the target ASIC does when size number of entries is reached.

The P4 spec is vague on what the semantics of table sizes are. From the P4 spec section 14.2.1.5 we have

If a table has a size value specified for it with value N, it is recommended that a compiler should choose a data plane implementation that is capable of storing N table entries. This does not guarantee that an arbitrary set of N entries can always be inserted in such a table, only that there is some set of N entries that can be inserted.

So there is no prescribed behavior here. We should probably have code generation options that can capture what the target ASIC being emulated does.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Start by reading P4 spec section 14.2.1.5 and locating the Rust code-generation path for table size properties; the required target-ASIC semantics and code-generation options must be decided before implementation. Done should mean generated tables honor the configured size behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.