Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codegen verification should not reject mutually exclusive send ops to the same channel #1899

Open
proppy opened this issue Jan 30, 2025 · 0 comments
Labels
codegen Related to emitting (System)Verilog. ir 🧦 sox

Comments

@proppy
Copy link
Member

proppy commented Jan 30, 2025

Describe the bug
It seems that the codegen verification pass rejects IR packages that contain multiple send to the same channel, even if those are mutually exclusive or serialized.

To Reproduce

The following DSLX code

proc Foo {
  some_chan: chan<bool> out;

  init {
    token()
  }

  config(some_chan: chan<bool> out) {
    (some_chan,)
  }

  next(state: token) {
    let tok = send(state, some_chan, true);
    let tok = send(tok, some_chan, false);
    tok
  }
}

Get converted and optimize to the following IR:

package a

file_number 0 "/tmp/a.x"

chan a__some_chan(bits[1], id=0, kind=streaming, ops=send_only, flow_control=ready_valid, strictness=proven_mutually_exclusive, metadata="""""")

top proc __a__Foo_0_next(__state: token, init={token}) {
  __state: token = state_read(state_element=__state, id=2)
  literal.4: bits[1] = literal(value=1, id=4, pos=[(0,12,37)])
  tok: token = send(__state, literal.4, channel=a__some_chan, id=11)
  literal.6: bits[1] = literal(value=0, id=6, pos=[(0,13,35)])
  tok__1: token = send(tok, literal.6, channel=a__some_chan, id=12)
  next_value.8: () = next_value(param=__state, value=tok__1, id=8)
}

which fails to codegen with the following error:

Error: INTERNAL: Multiple sends associated with the same channel 'a__some_chan':

Send node with no known provenance: tok: token = send(__state, literal.4, channel=a__some_chan, id=11)

Send node with no known provenance: tok__1: token = send(tok, literal.6, channel=a__some_chan, id=12)

Expected behavior
The codegen verification pass should accept an IR package w/ mutually exclusive/serialized sends (or if WAI produce an actionable error message instead of an internal error).

Additional context

Switching the channel strictness to proven_mutually_exclusive or total_order doesn't seems to affect the codegen verification pass behavior.

@proppy proppy added ir codegen Related to emitting (System)Verilog. 🧦 sox labels Jan 30, 2025
@proppy proppy changed the title codegen verification should not reject exclusive send operations to the same channel codegen verification should not reject mutually exclusive send ops to the same channel Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen Related to emitting (System)Verilog. ir 🧦 sox
Projects
Status: No status
Development

No branches or pull requests

1 participant