Remove sampling profile support from pgo rule
Sampling profiles should use afdo rule instead.
Test: presubmit
Bug: 218791486
Change-Id: I6073da27d184a779be0f6796f336e6ec051beceb
diff --git a/cc/pgo.go b/cc/pgo.go
index 0632c15..463e2e6 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -41,7 +41,6 @@
const profileInstrumentFlag = "-fprofile-generate=/data/local/tmp"
const profileUseInstrumentFormat = "-fprofile-use=%s"
-const profileUseSamplingFormat = "-fprofile-sample-accurate -fprofile-sample-use=%s"
func getPgoProfileProjects(config android.DeviceConfig) []string {
return config.OnceStringSlice(pgoProfileProjectsConfigKey, func() []string {
@@ -56,12 +55,11 @@
type PgoProperties struct {
Pgo struct {
Instrumentation *bool
- Sampling *bool `android:"arch_variant"`
Profile_file *string `android:"arch_variant"`
Benchmarks []string
Enable_profile_use *bool `android:"arch_variant"`
// Additional compiler flags to use when building this module
- // for profiling (either instrumentation or sampling).
+ // for profiling.
Cflags []string `android:"arch_variant"`
} `android:"arch_variant"`
@@ -79,10 +77,6 @@
return props.Pgo.Instrumentation != nil && *props.Pgo.Instrumentation == true
}
-func (props *PgoProperties) isSampling() bool {
- return props.Pgo.Sampling != nil && *props.Pgo.Sampling == true
-}
-
func (pgo *pgo) props() []interface{} {
return []interface{}{&pgo.Properties}
}
@@ -135,18 +129,8 @@
return android.OptionalPathForPath(nil)
}
-func (props *PgoProperties) profileUseFlag(ctx ModuleContext, file string) string {
- if props.isInstrumentation() {
- return fmt.Sprintf(profileUseInstrumentFormat, file)
- }
- if props.isSampling() {
- return fmt.Sprintf(profileUseSamplingFormat, file)
- }
- return ""
-}
-
func (props *PgoProperties) profileUseFlags(ctx ModuleContext, file string) []string {
- flags := []string{props.profileUseFlag(ctx, file)}
+ flags := []string{fmt.Sprintf(profileUseInstrumentFormat, file)}
flags = append(flags, profileUseOtherFlags...)
return flags
}
@@ -169,19 +153,14 @@
// if profileFile gets updated
flags.CFlagsDeps = append(flags.CFlagsDeps, profileFilePath)
flags.LdFlagsDeps = append(flags.LdFlagsDeps, profileFilePath)
-
- if props.isSampling() {
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-no-warn-sample-unused=true")
- }
}
return flags
}
func (props *PgoProperties) isPGO(ctx BaseModuleContext) bool {
isInstrumentation := props.isInstrumentation()
- isSampling := props.isSampling()
- profileKindPresent := isInstrumentation || isSampling
+ profileKindPresent := isInstrumentation
filePresent := props.Pgo.Profile_file != nil
benchmarksPresent := len(props.Pgo.Benchmarks) > 0
@@ -194,7 +173,7 @@
if !profileKindPresent || !filePresent {
var missing []string
if !profileKindPresent {
- missing = append(missing, "profile kind (either \"instrumentation\" or \"sampling\" property)")
+ missing = append(missing, "profile kind")
}
if !filePresent {
missing = append(missing, "profile_file property")
@@ -208,14 +187,6 @@
ctx.ModuleErrorf("Instrumentation PGO specification is missing benchmark property")
}
- if isSampling {
- ctx.ModuleErrorf("Sampling PGO is deprecated, use AFDO instead")
- }
-
- if isSampling && isInstrumentation {
- ctx.PropertyErrorf("pgo", "Exactly one of \"instrumentation\" and \"sampling\" properties must be set")
- }
-
return true
}