google / google/xls

[enhancement] Enable IR timing analysis without logic used by non-synthesizable Verilog code

Open
#1,437 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 12h
Merged PRs (30d)
130

Description

### What's hard to do? (limit 100 words)

To obtain accurate timing information for a code that produces non-synthesizable Verilog constructs like `trace_fmt!`. Some of the logic may be used exclusively for non-synthesizable code and will be removed during the synthesis step in external tools. IR Visualization tool and the IR benchmarking reports could have an option to remove the logic used solely by non-synthesizable Verilog constructs.

An example of a process whose critical path is will be translated to non-synthesizable Verilog code:
```rust
proc Passthrough {
data_r: chan in;
data_s: chan out;

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

init { () }

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

// this logic could be removed from the IR timing report
let pow2 = data * data;
trace_fmt!("Data raised to the power of two: {}", pow2);

let tok = send(tok, data_s, data);
}
}
```
![Selection_002](https://github.com/google/xls/assets/52699314/57ed5937-e92d-4a06-8939-9b3c0cdbf93a)

### Current best alternative workaround (limit 100 words)

Possibly the `Synthesizer` mechanism living in the [synthesizer.cc](/google/xls/blob/main/xls/fdo/synthesizer.cc) may be used to obtain more accurate results, as the gRPC synthesizer can be used by the `benchmark_main` using the `--compare_delay_to_synthesis` flag. However, the mechanism is not described in the documentation. If the functionality is already there it would be great to extend the documentation with a description on how to use it.

### Your view of the "best case XLS enhancement" (limit 100 words)

It would be great if more accurate timing reports could be viewed using the IR visualization tool or benchmarking rules

Contributor guide

Open the contributing guide

Research direction

Start with xls/fdo/synthesizer.cc and the benchmark_main entry point, then inspect the --compare_delay_to_synthesis path. Compare that mechanism with the IR visualization tool and benchmarking rules described in the issue. Done means timing reports can exclude logic used only by non-synthesizable Verilog constructs, or the existing synthesis-based workaround is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.