Enable AutoFDO.
This largely involves implementing the options debug-info-for-profiling and profile-sample-use and forwarding them on to LLVM. AutoFDO can be used on x86-64 Linux like this: rustc -O -Cdebug-info-for-profiling main.rs -o main perf record -b ./main create_llvm_prof --binary=main --out=code.prof rustc -O -Cprofile-sample-use=code.prof main.rs -o main2 Now `main2` will have feedback directed optimization applied to it. The create_llvm_prof tool can be obtained from this github repository: https://github.com/google/autofdo Fixes #64892.
This commit is contained in:
parent
d7539a6af0
commit
a17193dbb9
12 changed files with 120 additions and 9 deletions
|
@ -1040,6 +1040,8 @@ options! {
|
|||
"combine CGUs into a single one"),
|
||||
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
|
||||
"inject the given attribute in the crate"),
|
||||
debug_info_for_profiling: bool = (false, parse_bool, [TRACKED],
|
||||
"emit discriminators and other data necessary for AutoFDO"),
|
||||
debug_macros: bool = (false, parse_bool, [TRACKED],
|
||||
"emit line numbers debug info inside macros (default: no)"),
|
||||
deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED],
|
||||
|
@ -1242,6 +1244,8 @@ options! {
|
|||
(default based on relative source path)"),
|
||||
profiler_runtime: String = (String::from("profiler_builtins"), parse_string, [TRACKED],
|
||||
"name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)"),
|
||||
profile_sample_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
|
||||
"use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)"),
|
||||
query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
|
||||
"enable queries of the dependency graph for regression testing (default: no)"),
|
||||
query_stats: bool = (false, parse_bool, [UNTRACKED],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue