google / google/xls

ir_convert fails to convert parametric proc that use cross-activation token

Open
#2,039 0 comments 0 reactions 0 assignees View on GitHub
bug ir 🧦 sox
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

**Describe the bug**

It seems that ir_convert doesn't manage to convert a network of proc containing parametric proc w/ token fields in their state.

**To Reproduce**
```
proc Foo {
init {
token()
}
config() {
}
next(state: token) {
state
}
}

proc Foo32 {
init {

}
config() {
spawn Foo();
}

next(state: ()) {

}
}
```
fails w/ the following error:
```
__main__.XlsRuntimeError('Error: INTERNAL: Token nodes should only be encountered during Proc conversion; we seem to be in function conversion.
=== Source Location Trace: ===
xls/dslx/ir_convert/function_converter.cc:2738
xls/dslx/ir_convert/function_converter.cc:3454
xls/dslx/ir_convert/function_converter.cc:3433
xls/dslx/ir_convert/function_converter.cc:2863
xls/dslx/ir_convert/ir_converter.cc:334
xls/dslx/ir_convert/ir_converter.cc:418
xls/dslx/ir_convert/ir_converter.cc:552
xls/dslx/ir_convert/ir_converter.cc:601
xls/dslx/ir_convert/ir_converter_main.cc:137
')
```

**Expected behavior**

`Foo32` convert into something like:
```
top proc __user_module__Foo32_0_next(__state: token, init={token}) {
__state: token = state_read(state_element=__state, id=2)
__token: token = literal(value=token, id=1)
literal.3: bits[1] = literal(value=1, id=3)
next_value.4: () = next_value(param=__state, value=__state, id=4)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.