Skip to content

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

Open
@proppy

Description

@proppy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegenRelated to emitting (System)Verilog.ir🧦 sox

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions