Repository navigation
Compile time: comdat table first in the module; --mlir-timing reports each stage - #863
Merged
Merged
Conversation
MLIR's verifier and its translation to LLVM IR look the comdat table up by name for every global and function that has a comdat (a vtable, an RTTI record, a generic's instance), each time scanning the module from its start. The table was created wherever the first such global happened to be lowered. It is now created at the start of the module and moved to the front once the conversion to LLVM is done (the globals lowered since are put in front of it). With the table last in a module of 4,000 classes the translation to LLVM IR takes 2.9 s, with it first 0.5 s. The LLVM IR does not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The option was registered but printed nothing: no timing manager was given to the pass manager. It now reports MLIR generation, each MLIR pass, the translation to LLVM IR, LLVM's optimizations and code emission, for every --emit. The JIT ends the process without running destructors, so it prints the report before the program runs. docs/performance.md gets a "Compile time" section with the option and current figures. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #862: one more compile-time fix, and a working
--mlir-timingto measure the rest with.The module's comdat table is its first operation
MLIR's verifier and its translation to LLVM IR look the comdat table up by name for every global and function that has a comdat (a vtable, an RTTI record, a generic's instance), each time scanning the module from its start. tslang created the table wherever the first such global happened to be lowered.
It is now created at the start of the module and moved to the front once the conversion to LLVM is done (globals lowered after it are put in front of it during the conversion).
Translation to LLVM IR for a file of 4,000 small classes, object file, no optimisation:
The position before this change was in between: the whole compile went from 8.0 s to 7.8 s. Where the table stands changes nothing in the LLVM IR.
--mlir-timingreports where a compilation spends its timeThe option was registered but printed nothing, because no timing manager was given to the pass manager. It now reports MLIR generation, each MLIR pass, the translation to LLVM IR, LLVM's optimizations and code emission, for every
--emit.docs/performance.mdgets a "Compile time" section with the option and current figures.Testing
test-borrow-facts-*. As in Compile time: no module scan for every new global (2,000 classes: 100 s -> 3 s) #862, they fail on my machine only (the build cache'sCMAKE_ARnames an MSVC toolset that is no longer installed) and pass when rerun with the installedlib.exe.TSLANG_VERIFY_LLVM_GLOBALS_INDEXset (run for the comdat commit): no difference logged.--opt_level=3and-mm=rc: identical except00param_assigned_owned.ts, whose output already differs from run to run.--mlir-timingchecked by hand for--emit=obj,llvm,exeandjit(with and without the JIT cache); a JIT run without the option prints only the program's output.Not covered
--mlir-timingor for compile time.🤖 Generated with Claude Code