Only enable MLGO for ARM64 ThinLTO targets
The MLGO model we embed in the Android Clang is trained on ARM64 ThinLTO artefacts. Applying the model across architectures does not necessarily translate to performance improvement. Therefore only enable the optimisation on ARM64 ThinLTO for now. Test: presubmit Bug: 293827654 Change-Id: Ie64a65c11191cf700a463637a0746c8470d3aa3c
This commit is contained in:
@@ -174,9 +174,6 @@ var (
|
|||||||
"-Werror=format-security",
|
"-Werror=format-security",
|
||||||
"-nostdlibinc",
|
"-nostdlibinc",
|
||||||
|
|
||||||
// Enable MLGO for register allocation.
|
|
||||||
"-mllvm -regalloc-enable-advisor=release",
|
|
||||||
|
|
||||||
// Emit additional debug info for AutoFDO
|
// Emit additional debug info for AutoFDO
|
||||||
"-fdebug-info-for-profiling",
|
"-fdebug-info-for-profiling",
|
||||||
}
|
}
|
||||||
@@ -205,8 +202,6 @@ var (
|
|||||||
"-Wl,--exclude-libs,libgcc_stripped.a",
|
"-Wl,--exclude-libs,libgcc_stripped.a",
|
||||||
"-Wl,--exclude-libs,libunwind_llvm.a",
|
"-Wl,--exclude-libs,libunwind_llvm.a",
|
||||||
"-Wl,--exclude-libs,libunwind.a",
|
"-Wl,--exclude-libs,libunwind.a",
|
||||||
// Enable MLGO for register allocation.
|
|
||||||
"-Wl,-mllvm,-regalloc-enable-advisor=release",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceGlobalLldflags = append(append(deviceGlobalLdflags, commonGlobalLldflags...),
|
deviceGlobalLldflags = append(append(deviceGlobalLdflags, commonGlobalLldflags...),
|
||||||
|
@@ -147,11 +147,16 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For ML training
|
// Register allocation MLGO flags for ARM64.
|
||||||
|
if ctx.Arch().ArchType == android.Arm64 {
|
||||||
|
ltoCFlags = append(ltoCFlags, "-mllvm -regalloc-enable-advisor=release")
|
||||||
|
ltoLdFlags = append(ltoLdFlags, "-Wl,-mllvm,-regalloc-enable-advisor=release")
|
||||||
|
// Flags for training MLGO model.
|
||||||
if ctx.Config().IsEnvTrue("THINLTO_EMIT_INDEXES_AND_IMPORTS") {
|
if ctx.Config().IsEnvTrue("THINLTO_EMIT_INDEXES_AND_IMPORTS") {
|
||||||
ltoLdFlags = append(ltoLdFlags, "-Wl,--save-temps=import")
|
ltoLdFlags = append(ltoLdFlags, "-Wl,--save-temps=import")
|
||||||
ltoLdFlags = append(ltoLdFlags, "-Wl,--thinlto-emit-index-files")
|
ltoLdFlags = append(ltoLdFlags, "-Wl,--thinlto-emit-index-files")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flags.Local.CFlags = append(flags.Local.CFlags, ltoCFlags...)
|
flags.Local.CFlags = append(flags.Local.CFlags, ltoCFlags...)
|
||||||
flags.Local.AsFlags = append(flags.Local.AsFlags, ltoCFlags...)
|
flags.Local.AsFlags = append(flags.Local.AsFlags, ltoCFlags...)
|
||||||
|
Reference in New Issue
Block a user