Skip to content

bazel: add Linux standard allocator option - #3714

Open
napetrov wants to merge 2 commits into
mainfrom
issue3530-stdalloc
Open

bazel: add Linux standard allocator option#3714
napetrov wants to merge 2 commits into
mainfrom
issue3530-stdalloc

Conversation

@napetrov

Copy link
Copy Markdown
Contributor

Description

Add a typed Bazel --stdalloc=true option for the allocator-selection part of Make STDALLOC=yes on Linux DAAL core builds.

This is a focused Make-to-Bazel option-parity improvement toward #3530. The option is disabled by default.

What changed

  • add the typed boolean --stdalloc=true interface
  • define USE_STD_ALLOC only for DAAL core compilation actions
  • keep separately built threading objects on TBB scalable allocation, matching Make target scope
  • reject non-Linux DAAL configurations clearly
  • document the difference from Make+ICX, which also adds -static-libstdc++
  • add a bounded Bazel configuration-analysis smoke to CI

Validation

Validated on Linux at exact branch head 8ce584627c78d90ca5d18eb709adff9c85dd1c71.

Exact-head GCC build/test

CC=gcc bazelisk build \
  //cpp/daal:core_static //cpp/daal:core_dynamic \
  //cpp/daal:thread_static //cpp/daal:thread_dynamic \
  --stdalloc=true --cpu=sse2 --jobs=2

CC=gcc bazelisk test \
  //cpp/daal/src/algorithms/dtrees/gbt/regression:test_gbt_regression_model_builder_unit_host \
  --stdalloc=true --cpu=sse2 --jobs=2 --test_output=errors

Results: build passed (1,151 actions); 1/1 test passed. CI YAML parse and git diff --check also passed.

ICX proof

Validated with ICX/ICPX 2026.0 and Bazel 9.2:

  • enabled core actions: 1,140/1,140 contain USE_STD_ALLOC
  • enabled threading actions: 0/2 contain USE_STD_ALLOC
  • default core actions: 0/1,140 contain USE_STD_ALLOC
  • static/dynamic core and threading build passed
  • representative tests passed
  • runtime allocation/free probe passed with 64-byte alignment
  • core resolves to aligned_alloc/free; threading retains TBB scalable allocation

Scope notes

This option controls allocator selection only. Make builds with COMPILER=icx STDALLOC=yes additionally pass -static-libstdc++; Bazel link options are intentionally unchanged.


Checklist

  • Changes reviewed locally
  • Documentation updated
  • Commits include Signed-off-by
  • Focused build/test validation completed
  • No default behavior changes
  • No performance change unless the option is explicitly enabled

Ubuntu added 2 commits July 24, 2026 07:59
Signed-off-by: Ubuntu <ubuntu@ip-172-31-3-43.ec2.internal>
Signed-off-by: Ubuntu <ubuntu@ip-172-31-3-43.ec2.internal>
@napetrov
napetrov marked this pull request as ready for review July 26, 2026 11:58
Copilot AI review requested due to automatic review settings July 26, 2026 11:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Bazel flag parity for Make’s STDALLOC=yes allocator-selection behavior by introducing a typed --stdalloc=true option that enables standard-library aligned allocation for Linux DAAL core compilation while keeping the separately built TBB threading objects on scalable allocation (matching Make’s scope).

Changes:

  • Introduces a typed boolean Bazel flag (--stdalloc=true) and wires it into DAAL compilation via USE_STD_ALLOC on Linux only.
  • Ensures threading_tbb is explicitly excluded from USE_STD_ALLOC to preserve TBB scalable allocation for threading objects.
  • Adds documentation and a bounded CI analysis-only smoke check for the new configuration.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dev/bazel/README.md Documents --stdalloc behavior, Linux-only restriction, and scope differences vs Make/ICX.
dev/bazel/daal.bzl Adds stdalloc control to daal_module(), defines USE_STD_ALLOC when enabled, and enforces Linux-only support.
dev/bazel/config/config.tpl.BUILD Declares the stdalloc build setting and config_settings for enabled/disabled with Linux gating plus a clear failure target.
dev/bazel/config/config.bzl Adds an unsupported_config rule used to fail analysis with a targeted message on unsupported configurations.
cpp/daal/BUILD Disables stdalloc for threading_tbb to match Make’s target-specific macro scope.
.ci/pipeline/ci.yml Adds an analysis-only CI smoke check for :release with --stdalloc=true (and DPC disabled).
.bazelrc Exposes --stdalloc via --flag_alias for user-facing CLI parity.

Comment thread .ci/pipeline/ci.yml
bazel build --nobuild :release --config=release-dpc --cpu=all

echo "Checking Bazel config: stdalloc"
bazel build --nobuild :release --stdalloc=true --release_dpc=false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alexandr-Solovev Would this be a problem with the space constraints that you've been trying to address? And wouldn't this potentially increase running times significantly?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the first question, it should not(especially with disabled dpc) For the second: we can take a look on the job time, because it is hard to estimate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants