8000 Add an independent LLVM codegen optimization level by romart · Pull Request #5573 · google/xls · GitHub
[go: up one dir, main page]

Skip to content

Add an independent LLVM codegen optimization level - #5573

Open
romart wants to merge 1 commit into
google:mainfrom
romart:codegen_level_opt
Open

romart wants to merge 1 commit into
google:mainfrom
romart:codegen_level_opt

Conversation

@romart
@romart romart commented Nov 30, 2026
Copy link
Copy Markdown
Contributor

Add a machine code optimization setting to the JIT and AOT APIs and expose it as --llvm_codegen_opt_level in eval_proc_main. Default to LLVM's backend level 2.

At LLVM IR O1, lowering the backend level from 2 to 0 cut median block JIT compile time for a local block JIT benchmark from 2.15 s to 1.56 s (27%). Execution rose from 21.8 to 40.8 ms per 10,000 calls.

Add a machine code optimization setting to the JIT and AOT APIs and
expose it as --llvm_codegen_opt_level in eval_proc_main. Default to
LLVM's backend level 2.

At LLVM IR O1, lowering the backend level from 2 to 0 cut median
block JIT compile time for a local block JIT benchmark from 2.15 s to
1.56 s (27%). Execution rose from 21.8 to 40.8 ms per 10,000 calls.
@allight
allight commented Dec 3, 2026
Copy link
Copy Markdown
Contributor

Ok this seems mostly fine but can we maybe instead just have 'opt_level' control both the opt level and codegen_opt_level. I honestly can't think of many situations where I wouldn't want these to be identical. That seems like it would be a much simpler change.

@romart
romart commented Dec 4, 2026
Copy link
Copy Markdown
Contributor Author

I was thinking that having more granular controls would be better, as it would allow us to isolate and diagnose issues more easily. I'm also planning to continue my research into JIT compilation performance, so keeping the keys separate would give us a bit more flexibility. What do you think?

@mikex-oss
mikex-oss requested a review from allight December 4, 2026 18:39
@allight
allight commented Dec 4, 2026
Copy link
Copy Markdown
Contributor

I guess maybe. For now can we just split this into two where the first CL just controls both with the single --llvm_opt_level flag.

For the second give 3 flags --llvm_middle_end_opt_level for current opt_level, --llvm_codegen_opt_level for this stuff and --llvm_opt_level which sets the default value for the other two.

This flag is mostly just a control for running things faster. I don't think we really care too much about debugging llvm internals using this.

8738

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0