Put javac, d8 and r8 rules into RBE ninja pool

javac, d8 and r8 rules for module defined in Android.mk files are
running remotely with RBE but are running in the local ninja pool,
restricting them to only running as many jobs in parallel as there
are local CPUs.  Set the ninja pool to let them run 500 jobs in
parallel.

Bug: 228603472
Test: m checkbuild
Change-Id: I60f7859f3657fc1eff0daf0e0a1b0f9fe63551b6
This commit is contained in:
Colin Cross
2022-04-08 10:52:08 -07:00
parent 52233be25c
commit 24575c46e3
3 changed files with 26 additions and 15 deletions

View File

@@ -427,6 +427,21 @@ $(hide) $(HOST_OTOOL) -l $(1) | grep LC_ID_DYLIB -A 5 > $(2)
$(hide) $(HOST_NM) -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true) $(hide) $(HOST_NM) -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true)
endef endef
GOMA_POOL :=
RBE_POOL :=
GOMA_OR_RBE_POOL :=
# When goma or RBE are enabled, kati will be passed --default_pool=local_pool to put
# most rules into the local pool. Explicitly set the pool to "none" for rules that
# should be run outside the local pool, i.e. with -j500.
ifneq (,$(filter-out false,$(USE_GOMA)))
GOMA_POOL := none
GOMA_OR_RBE_POOL := none
else ifneq (,$(filter-out false,$(USE_RBE)))
RBE_POOL := none
GOMA_OR_RBE_POOL := none
endif
.KATI_READONLY := GOMA_POOL RBE_POOL GOMA_OR_RBE_POOL
ifeq ($(CALLED_FROM_SETUP),true) ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ccache.mk include $(BUILD_SYSTEM)/ccache.mk
include $(BUILD_SYSTEM)/goma.mk include $(BUILD_SYSTEM)/goma.mk
@@ -1217,21 +1232,6 @@ define find_warning_allowed_projects
$(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/) $(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/)
endef endef
GOMA_POOL :=
RBE_POOL :=
GOMA_OR_RBE_POOL :=
# When goma or RBE are enabled, kati will be passed --default_pool=local_pool to put
# most rules into the local pool. Explicitly set the pool to "none" for rules that
# should be run outside the local pool, i.e. with -j500.
ifneq (,$(filter-out false,$(USE_GOMA)))
GOMA_POOL := none
GOMA_OR_RBE_POOL := none
else ifneq (,$(filter-out false,$(USE_RBE)))
RBE_POOL := none
GOMA_OR_RBE_POOL := none
endif
.KATI_READONLY := GOMA_POOL RBE_POOL GOMA_OR_RBE_POOL
# These goals don't need to collect and include Android.mks/CleanSpec.mks # These goals don't need to collect and include Android.mks/CleanSpec.mks
# in the source tree. # in the source tree.
dont_bother_goals := out \ dont_bother_goals := out \

View File

@@ -266,6 +266,7 @@ endif # TURBINE_ENABLED != false
# TODO(b/143658984): goma can't handle the --system argument to javac. # TODO(b/143658984): goma can't handle the --system argument to javac.
#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL) #$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL)
$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(JAVAC_NINJA_POOL)
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags) $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES) $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
@@ -489,12 +490,14 @@ ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) $(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
ifdef LOCAL_PROGUARD_ENABLED ifdef LOCAL_PROGUARD_ENABLED
$(built_dex_intermediate): .KATI_NINJA_POOL := $(R8_NINJA_POOL)
$(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar) $(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
$(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS) $(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
$(built_dex_intermediate): PRIVATE_PROGUARD_DICTIONARY := $(proguard_dictionary) $(built_dex_intermediate): PRIVATE_PROGUARD_DICTIONARY := $(proguard_dictionary)
$(built_dex_intermediate) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD) $(LOCAL_PROGUARD_FLAGS_DEPS) $(built_dex_intermediate) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD) $(LOCAL_PROGUARD_FLAGS_DEPS)
$(transform-jar-to-dex-r8) $(transform-jar-to-dex-r8)
else # !LOCAL_PROGUARD_ENABLED else # !LOCAL_PROGUARD_ENABLED
$(built_dex_intermediate): .KATI_NINJA_POOL := $(D8_NINJA_POOL)
$(built_dex_intermediate): PRIVATE_D8_LIBS := $(full_java_bootclasspath_libs) $(full_shared_java_header_libs) $(built_dex_intermediate): PRIVATE_D8_LIBS := $(full_java_bootclasspath_libs) $(full_shared_java_header_libs)
$(built_dex_intermediate): $(full_java_bootclasspath_libs) $(full_shared_java_header_libs) $(built_dex_intermediate): $(full_java_bootclasspath_libs) $(full_shared_java_header_libs)
$(built_dex_intermediate): $(full_classes_pre_proguard_jar) $(DX) $(ZIP2ZIP) $(built_dex_intermediate): $(full_classes_pre_proguard_jar) $(DX) $(ZIP2ZIP)

View File

@@ -14,6 +14,10 @@
# limitations under the License. # limitations under the License.
# #
JAVAC_NINJA_POOL :=
R8_NINJA_POOL :=
D8_NINJA_POOL :=
# Notice: this works only with Google's RBE service. # Notice: this works only with Google's RBE service.
ifneq ($(filter-out false,$(USE_RBE)),) ifneq ($(filter-out false,$(USE_RBE)),)
ifdef RBE_DIR ifdef RBE_DIR
@@ -84,16 +88,20 @@ ifneq ($(filter-out false,$(USE_RBE)),)
ifdef RBE_JAVAC ifdef RBE_JAVAC
JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac --exec_strategy=$(javac_exec_strategy) --platform=$(java_r8_d8_platform)) JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac --exec_strategy=$(javac_exec_strategy) --platform=$(java_r8_d8_platform))
JAVAC_NINJA_POOL := $(RBE_POOL)
endif endif
ifdef RBE_R8 ifdef RBE_R8
R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java) R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
R8_NINJA_POOL := $(RBE_POOL)
endif endif
ifdef RBE_D8 ifdef RBE_D8
D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java) D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
D8_NINJA_POOL := $(RBE_POOL)
endif endif
rbe_dir := rbe_dir :=
endif endif
.KATI_READONLY := JAVAC_NINJA_POOL R8_NINJA_POOL D8_NINJA_POOL