Skip to content

Fix unnecessary parse and typecheck overhead when using IR conversion check - #4521

Open
magancarz wants to merge 1 commit into
google:mainfrom
antmicro:ir-check-perf
Open

Fix unnecessary parse and typecheck overhead when using IR conversion check#4521
magancarz wants to merge 1 commit into
google:mainfrom
antmicro:ir-check-perf

Conversation

@magancarz

@magancarz magancarz commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pull request fixes unnecessary overhead introduced by duplicate parsing and typechecking when IR conversion check is enabled. As tested with bazel run -c opt //xls/modules/zstd:zstd_dec_dslx_test and commented tests for simplicity of measuring IR conversion check overhead - on main branch it takes ~3.5 min to finish executing the target, while with this PR changes it finishes in ~38 seconds. Without IR conversion check, the execution time is ~27 seconds. As a result it narrows down IR conversion check overhead from ~3 min to ~11 seconds in the tested case.

@magancarz

Copy link
Copy Markdown
Contributor Author

@richmckeever I've answered your question about used compilation mode by updating the description with used command.

dslx_paths, ir_convert_options, elem,
module_name, &printed_error);
absl::StatusOr<std::string> ir_conv_result =
ConvertOneFunction(tm.module, elem, &import_data,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change the whole reason it's faster? I'm having trouble wrapping my head around the immense increase in speed with this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It speeds up the IR conversion check, because ConvertOneFunction gives a possibility to do module typechecking just once by performing it earlier and passing it with tm.module, while ConvertFilesToPackage call did module typechecking separately for each IR conversion check entry in ir_converter.cc#L641.

@dplassgit dplassgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richmckeever do you have any thoughts? It looks good to me

@dplassgit
dplassgit requested a review from richmckeever July 27, 2026 20:59
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