Hash :
13776ac3
Author :
Date :
2023-10-24T11:10:25
Compile with optimize_max instead of default_optimization Android builds default to aggressive optimization for size (-Oz) which results in subpar performance in some spots. AFAICT the effect of this change on cflags is: -Oz -enable-ml-inliner=release to -O2 Note that -enable-ml-inliner=release has a more significant impact on the binary size than -Oz/-O2: With it: -Oz 5.7M, -O2 6.15M Without it: -Oz: 6.3M, -O2 7.1M So this change goes 5.7M -> 7.1M (+1.4M). That's in standalone ANGLE builds. Unsure if Chrome builds might be different. Skipping a few dEQP tests where this switch seems to uncover UB. Bug: b/306391262 Bug: b/307584642 Change-Id: I44d0f3bcf25de0c36a4228895cad19ea38502cbf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4968419 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Roman Lavrov <romanl@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
# Copyright 2023 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../gni/angle.gni")
template("angle_trace") {
angle_shared_library(target_name) {
testonly = true
# Similar to capture replay sample, use the file index for sources
sources = invoker.sources
data = invoker.data
defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ]
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
deps = [
"$angle_root/util:angle_trace_fixture",
"$angle_root/util:angle_trace_loader",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (is_android) {
libs = [ "log" ]
}
# Disable optimization in the trace perf tests to avoid optimizing huge files.
if (!is_debug && !is_ubsan) {
suppressed_configs += [
"//build/config/compiler:afdo",
"//build/config/compiler:afdo_optimize_size",
"//build/config/compiler:optimize_max",
"//build/config/compiler/pgo:default_pgo_flags",
]
configs += [ "//build/config/compiler:no_optimize" ]
}
include_dirs = [ "." ]
if (defined(invoker.output_name)) {
output_name = invoker.output_name
}
}
}
set_defaults("angle_trace_libs") {
# Uses a short name to work around file path limits on Windows.
short_names = false
}
template("angle_trace_libs") {
_trace_targets = []
_trace_lib_files = []
if (invoker.short_names) {
_trace_counter = 1
}
if (is_android && is_component_build) {
_cr_suffix = ".cr"
} else {
_cr_suffix = ""
}
foreach(_trace_and_version, invoker.trace_list) {
_trace_and_version_arr = []
_trace_and_version_arr = string_split(_trace_and_version)
_trace = _trace_and_version_arr[0]
if (defined(invoker.trace_dir)) {
_trace_dir = invoker.trace_dir
} else {
_trace_dir = _trace
}
_trace_json_path = "$_trace_dir/$_trace.json"
_trace_data = []
_trace_data = read_file(_trace_json_path, "json")
if (invoker.short_names) {
_target = "cr_trace_${_trace_counter}"
_trace_counter += 1
} else {
_target = "${target_name}_$_trace"
}
_gen_target = "gen${target_name}_$_trace"
action(_gen_target) {
script = "//scripts/tracegz.py"
args = [
_trace,
rebase_path(_trace_dir, root_build_dir),
]
outputs = [ "$root_gen_dir/tracegz_$_trace.gz" ]
}
angle_trace(_target) {
sources = rebase_path(_trace_data.TraceFiles, ".", _trace_dir)
data = [
"$_trace_dir/$_trace.json",
"$_trace_dir/$_trace.angledata.gz",
"$root_gen_dir/tracegz_$_trace.gz",
]
deps = [ ":$_gen_target" ]
if (invoker.short_names) {
output_name = _trace
}
}
_trace_targets += [ ":$_target" ]
_trace_lib_files += [ "${root_out_dir}/lib${_target}${_cr_suffix}.so" ]
}
angle_shared_library(target_name) {
testonly = true
data = [ invoker.json_path ]
data_deps = _trace_targets
deps = [ "$angle_root:angle_common" ]
public_deps = [ "$angle_root/util:angle_trace_loader" ]
}
if (restricted_traces_outside_of_apk) {
group("${target_name}__unpacked_libs") {
testonly = true
deps = [
":angle_restricted_traces",
"$angle_root/util:angle_trace_interpreter",
]
# Also need files listed as data to be picked up by isolate
data = _trace_lib_files +
[ "${root_out_dir}/libangle_trace_interpreter${_cr_suffix}.so" ]
}
}
}