google / google/xls

Array of channels causes internal error

Open
#1,726 2 comments 0 reactions 0 assignees View on GitHub
🐜 ant dslx
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

**Describe the bug**
Creating an array of channels and then using it in loop causes internal error.

**To Reproduce**
Steps to reproduce the behavior:
1. Write following code:
```rust
proc Foo {
in_0_r: chan in;
in_1_r: chan in;
out_s: chan out;

config(in_0_r: chan in, in_1_r: chan in, out_s: chan out) {
(in_0_r, in_1_r, out_s)
}

init { u1:0 }

next (state: u1) {
let in_r = [
in_0_r,
in_1_r,
];
let (tok, val) = recv(join(), in_r[state]);
send(tok, out_s, val);

state + u1:1
}
}
```
2. Build Verilog target
```bazel
xls_dslx_library(
name = "foo_dslx",
srcs = ["foo.x"],
deps = [],
)

xls_dslx_verilog(
name = "foo_verilog",
codegen_args = {
"module_name": "Foo",
"delay_model": "asap7",
"pipeline_stages": "8",
"reset": "rst",
"use_system_verilog": "false",
},
dslx_top = "Foo",
library = ":foo_dslx",
verilog_file = "foo.v",
)
```
```bash
bazel build //:foo_verilog
```
3. Observe error
```none
ERROR: /mnt/hdd_0/Workspace/google-xls/BUILD:82:17: Converting DSLX file to XLS IR: foo.x failed: (Exit 1): ir_converter_main failed: error
executing ConvertDSLX command (from target //:foo_verilog) bazel-out/k8-opt-exec-ST-13d3ddad9198/bin/xls/dslx/ir_convert/ir_converter_main '--dslx_path=:${PWD}:bazel-out/k8-fastbuild/bin:bazel-out/k8-fastbuild/bin::bazel-out/k8-fastbuild/bin/' '--top=Foo' ... (remaining 5 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
E1118 12:28:39.701892 2 function_converter.cc:556] INTERNAL: XLS_RET_CHECK failure (xls/dslx/ir_convert/function_converter.cc:556) std::holds_alternative(ir_value)
0x5a9fdd9691fa: xabsl::StatusBuilder::CreateStatusAndConditionallyLog()
0x5a9fdd60e619: absl::lts_20240722::StatusOr<>::StatusOr<>()
0x5a9fdd60f0ea: xls::dslx::FunctionConverter::Use()
0x5a9fdd622dcc: xls::dslx::FunctionConverter::HandleArray()
0x5a9fdd640752: xls::dslx::FunctionConverterVisitor::HandleArray()
0x5a9fdd88489b: xls::dslx::Array::Accept()
0x5a9fdd60c765: xls::dslx::FunctionConverterVisitor::Visit()
0x5a9fdd613f12: xls::dslx::FunctionConverter::HandleLet()
0x5a9fdd6409a2: xls::dslx::FunctionConverterVisitor::HandleLet()
0x5a9fdd886cbb: xls::dslx::Let::Accept()
0x5a9fdd60c765: xls::dslx::FunctionConverterVisitor::Visit()
0x5a9fdd649555: std::__1::__variant_detail::__visitation::__base::__dispatcher<>::__dispatch[abi:ue170006]<>()
0x5a9fdd63e83d: xls::dslx::FunctionConverter::HandleStatement()
0x5a9fdd6404f2: xls::dslx::FunctionConverterVisitor::HandleStatement()
0x5a9fdd886b1b: xls::dslx::Statement::Accept()
0x5a9fdd60c765: xls::dslx::FunctionConverterVisitor::Visit()
0x5a9fdd63e4a3: xls::dslx::FunctionConverter::HandleStatementBlock()
0x5a9fdd640832: xls::dslx::FunctionConverterVisitor::HandleStatementBlock()
0x5a9fdd8863bb: xls::dslx::StatementBlock::Accept()
0x5a9fdd60c765: xls::dslx::FunctionConverterVisitor::Visit()
0x5a9fdd6399df: xls::dslx::FunctionConverter::HandleProcNextFunction()
0x5a9fdd5f1965: xls::dslx::(anonymous namespace)::ConvertCallGraph()
0x5a9fdd5f395c: xls::dslx::ConvertOneFunctionIntoPackageInternal<>()
0x5a9fdd5f34a5: xls::dslx::ConvertOneFunctionIntoPackage()
0x5a9fdd5f4a62: xls::dslx::ConvertFilesToPackage()
0x5a9fdd5a82c0: main
0x7245c9763e08: [unknown]
0x7245c9763ecc: __libc_start_main
0x5a9fdd5a7c15: _start

Error: INTERNAL: XLS_RET_CHECK failure (xls/dslx/ir_convert/function_converter.cc:556) std::holds_alternative(ir_value) Target //:f
oo_verilog failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.527s, Critical Path: 0.31s
INFO: 3 processes: 2 internal, 1 linux-sandbox.
ERROR: Build did NOT complete successfully
```

**Expected behavior**
The target is built with no errors.

**Environment (this can be helpful for troubleshooting):**
- OS: Arch Linux x86_64
- Kernel version: 6.11.6-arch1-1
- XLS hash: 11e5e7dd6453c23c01a86f591f6bf10043ca1f0c

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.