google / google/xls

[enhancement] Allow selecting the LLVM JIT optimization level in eval_proc_main

Open
#4,906 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

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

`eval_proc_main` always evaluates using the default LLVM optimizer level and offers no way to change it. There is no way to run a proc/block at a different optimization level (e.g. `-O0`) to study how LLVM optimization affects results or to isolate optimizer issues.

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

Edit the JIT default in code and rebuild, since the optimizer level is only settable via `JitEvaluatorOptions::set_opt_level`. This is slow, local-only, and not reproducible across runs or CI.

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

A `--llvm_opt_level` CLI flag on `eval_proc_main`, accepting values `0..3`, threaded through to both the serial_jit and block_jit backends, with out-of-range values rejected:

```bash
./bazel-bin/xls/tools/eval_proc_main test.ir \
--backend=serial_jit --llvm_opt_level=0
```

Contributor guide

Open the contributing guide

Research direction

Start at the eval_proc_main entry point and inspect how JitEvaluatorOptions::set_opt_level is used for the serial_jit and block_jit backends. Trace the existing CLI option handling, then verify the requested 0..3 values and the out-of-range behavior with the provided Bazel eval_proc_main command. Done means both backends accept the selected LLVM optimization level through --llvm_opt_level.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.