Skip to content

Commit 6dd763d

Browse files
committed
feat(build): Add multi-architecture optimized Bazel build configuration
* scripts/apollo_build.sh: - Implement architecture-aware compilation flags: * aarch64: Enable native instruction set optimization (-march=native) * x86_64: Enable AVX2 instruction set optimization (-mavx2) - Unified resource control strategy: * Parallel jobs: $(nproc) * Memory constraints: HOST_RAM*0.7 - Maintain backward compatibility for build command interfaces
1 parent f45e5e2 commit 6dd763d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/apollo_build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,12 @@ function run_bazel_build() {
247247
info "${TAB}Build Targets: ${GREEN}${build_targets}${NO_COLOR}"
248248
info "${TAB}Disabled: ${YELLOW}${disabled_targets}${NO_COLOR}"
249249

250-
local job_args="--copt=-mavx2 --host_copt=-mavx2 --jobs=$(nproc) --local_ram_resources=HOST_RAM*0.7"
250+
if [[ "$(uname -m)" == "aarch64" ]]; then
251+
local job_args="--copt=-march=native --host_copt=-march=native --jobs=$(nproc) --local_ram_resources=HOST_RAM*0.7"
252+
else
253+
# x64
254+
local job_args="--copt=-mavx2 --host_copt=-mavx2 --jobs=$(nproc) --local_ram_resources=HOST_RAM*0.7"
255+
fi
251256
bazel build ${CMDLINE_OPTIONS} ${job_args} -- ${formatted_targets}
252257
}
253258

0 commit comments

Comments
 (0)