google / google/xls

Support threading tokens through functions called by procs for fail/traces_fmt ops

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

Description

Currently trace and fail within functions called by a proc cannot be run through our flow due to the inline invocation pass not being able to thread the tokens.

This issue is to enhance the pass so that fail and trace_fmt statements need not be removed from functions before being used in a proc.

Example:
```
fn trace_and_add(x: u32) -> u32 {
let _ = trace_fmt!("x = {}", x);
x + u32:1
}

fn assert_trace_and_add(x: u32) -> u32 {
let _ = if x == u32:5 { fail!("x_is_now_5", u32:0) } else { u32:0 };
trace_and_add(x)
}

proc main {
c: chan out;
init {
u32:0
}
config(input_c: chan out) {
(input_c,)
}
next(tok: token, i: u32) {
let tok = send(tok, c, i);
assert_trace_and_add(i)
}
}
```

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.