google / google/xls

Two non-parametric procs in a single file cause errors when running DSLX tests

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

Description

**Describe the bug**

Having two non-parametric procs in one DSLX file triggers errors when running DSLX tests using the `xls_dslx_test` rule.
The test itself is not even necessary, as it seems that the problem occurs before running the actual test. The error is not triggered when the other proc is parametric.

**To Reproduce**

One can use the following DSLX code to trigger the error:
```rust
import std;

proc Passthrough {
data_r: chan in;
data_s: chan out;

init {()}

config(data_r: chan in, data_s: chan out) {
(data_r, data_s)
}

next(tok: token, state: ()) {
let (tok, data) = recv(tok, data_r);
let tok = send(tok, data_s, data);
}
}

// proc MyOtherProc { // adding a fake parameter removes the error
proc MyOtherProc {
data_r: chan in;
data_s: chan out;

init {()}

config(data_r: chan in, data_s: chan out) {
(data_r, data_s)
}

next(tok: token, state: ()) {
let (tok, data) = recv(tok, data_r);
let tok = send(tok, data_s, data);
}
}
```

The problem may be related to IR translation, as adding the `compare = none` flag to `dslx_test_args` removes the error.
Here are the build rules needed to trigger the problem:

``` python
xls_dslx_library(
name = "passthrough_dslx",
srcs = [
"passthrough.x",
],
)

xls_dslx_test(
name = "passthrough_dslx_test",
dslx_test_args = {
#"compare": "none", # uncommenting this line removes errors
},
library = ":passthrough_dslx"
)
```

The error message is as follows:
```
$ bazel run //xls/examples:passthrough_dslx_test
Executing tests from //xls/examples:passthrough_dslx_test
-----------------------------------------------------------------------------
E0517 09:02:38.735197 2067348 command_line_utils.cc:45] Could not extract a textual position from error message: INTERNAL: Proc ID "MyOtherProc:0" was not found in arg mapping.: INVALID_ARGUMENT: Provided status is not in recognized error form: INTERNAL: Proc ID "MyOtherProc:0" was not found in arg mapping.
```

I pushed the code of this example to [here](https://github.com/antmicro/xls/tree/proc-error). To trigger the error, use:
```
bazel run //xls/examples:passthrough_dslx_test
```

**Expected behavior**

The error should not be triggered.
Also, an `INTERNAL` error is triggered when handling the original error, which should not happen.

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.