Skip to content

Commit 5bed93c

Browse files
authored
bazel: align Linux MKL release parity (#3662)
* bazel: align Linux MKL release parity Align Bazel Linux MKL release output with Make by fixing oneAPI, parameter, threading, ELF metadata, algorithm coverage, and Linux release packaging boundaries. Validation on onedal-build: - bazelisk clean - bazelisk build //:release --backend_config=mkl --release_dpc=false --jobs=8 --verbose_failures - passed in 327.09s, 3179 actions Final compare vs Make MKL release: - release tree: only_make 0, only_bazel 0 - libonedal_core: members 1919/1919, exports 8545/8545, MKL exports 0 - libonedal_thread: members 2/2, exports 319/319, MKL exports 0 - libonedal: exports 3422/3422, MKL exports 0 - libonedal_parameters: members 8/8, exports 71/71, MKL exports 0 - SONAME/DT_NEEDED match for checked libs; RUNPATH absent Report: - /home/ubuntu/onedal-mkl-rootcause-20260614-223805/mkl-close-gaps-final-report.txt * bazel: fix PR parity CI issues Add missing license headers for new files. Use Linux release SONAME symlinks in @onedal_release imports so release-dynamic Bazel example tests can resolve libonedal*.so.4 from _solib runfiles while release artifacts stay RUNPATH-free. Let only the DPC dynamic oneAPI library include DAAL-tagged objects needed by DPC host helpers, without restoring DAAL object leakage to the host libonedal.so. * bazel: address MKL parity review findings * bazel: share release metadata checks * ci: avoid GitHub API in Bazelisk bootstrap * ci: compare Make and Bazel release artifacts * ci: restore Bazelisk release metadata lookup * bazel: hardcode binary ABI version * ci: fix Bazel and Conda PR checks * bazel: fix release dynamic linkage * bazel: align release metadata generation * bazel: match release config metadata * bazel: resolve Windows onedal services link * bazel: embed DAAL objects into Windows onedal.dll The previous attempt to bring in DAAL symbols on Windows via `core_embed` + `core_dynamic` host_deps only re-added the services + data_management + DLL shim and the onedal_core import library, but the Windows linker still saw unresolved DAAL classes consumed object-locally inside onedal.dll: PCA `interface3::BatchParameter` ctor / `check()`, PCA `BatchKernel<...>::compute(...)`, covariance `interface1::Batch` ctor / `Input::set` / `Input::~Input`, and zscore `interface3::Batch` ctor — none of which onedal_core.dll exports. lld-link emits hundreds of "undefined symbol" errors and fails the release build with "too many errors emitted". Linux .so links are tolerant of unresolved externals and resolve those DAAL symbols at runtime via DT_NEEDED libonedal_core.so. Windows DLLs must resolve everything at link time. Restore link-time resolution by selecting "daal" into the host `lib_tags` on Windows, mirroring the DPC variant. The DAAL-tagged objects then flow into onedal.dll directly. Drop the now-unneeded core_embed module and the core_dynamic host_dep, and keep only services_win_dll_shim (delay-loads the threading entry points the embedded kernels reference). On Linux the host build keeps lib_tags=["dal"] so DAAL is not duplicated into libonedal.so. * bazel: restore MKL link inputs for DPC DLL * bazel: fix Windows DPC parameters linkage * bazel: embed MKL into Windows onedal DLL * bazel: fix Windows host parameters linkage * bazel: link LR optimizer into Windows parameters DLL * conda: avoid timestamped TBB staging path * ci: normalize build date in release compare * ci: use package-aware oneDAL setup
1 parent f0b41dd commit 5bed93c

42 files changed

Lines changed: 767 additions & 175 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/pipeline/ci.yml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ jobs:
415415
# Display oneDAL build configuration
416416
bazel build @config//:dump
417417
echo
418-
cat bazel-bin/external/+_repo_rules+config/config.json
418+
cat bazel-bin/external/+declare_onedal_config+config/config.json
419419
echo
420420
displayName: 'bazel-configure'
421421
@@ -524,10 +524,12 @@ jobs:
524524
displayName: 'Clean Bazel cache (expunge)'
525525
526526
- script: |
527+
. "$(DALROOT)/env/vars.sh"
527528
bazel test //examples/daal/cpp:all \
528529
--test_link_mode=release_dynamic \
529530
--test_thread_mode=par \
530-
--test_env DALROOT
531+
--test_env DALROOT \
532+
--test_env LD_LIBRARY_PATH
531533
displayName: 'daal-cpp-examples-thread-release-dynamic'
532534
533535
- script: |
@@ -536,10 +538,12 @@ jobs:
536538
displayName: 'Clean Bazel cache (expunge)'
537539
538540
- script: |
541+
. "$(DALROOT)/env/vars.sh"
539542
bazel test //examples/oneapi/cpp:all \
540543
--test_link_mode=release_dynamic \
541544
--test_thread_mode=par \
542-
--test_env DALROOT
545+
--test_env DALROOT \
546+
--test_env LD_LIBRARY_PATH
543547
displayName: 'cpp-examples-thread-release-dynamic'
544548
545549
- script: |
@@ -593,6 +597,27 @@ jobs:
593597
fi
594598
displayName: 'bazel-cache-limit'
595599
600+
- job: 'LinuxReleaseCompare'
601+
dependsOn:
602+
- LinuxMakeGNU_MKL
603+
- LinuxBazel
604+
pool:
605+
vmImage: '$(VM_IMAGE)'
606+
steps:
607+
- task: DownloadPipelineArtifact@2
608+
inputs:
609+
artifact: 'lnx32e build'
610+
path: '$(Pipeline.Workspace)/make'
611+
- task: DownloadPipelineArtifact@2
612+
inputs:
613+
artifact: 'lnx32e Bazel build'
614+
path: '$(Pipeline.Workspace)/bazel'
615+
- script: |
616+
python3 dev/release_tests/compare_release_trees.py \
617+
--platform linux \
618+
--make "$(Pipeline.Workspace)/make/daal/latest" \
619+
--bazel "$(Pipeline.Workspace)/bazel"
620+
displayName: 'Compare Make and Bazel release trees'
596621
597622
- job: 'WindowsBazel'
598623
timeoutInMinutes: 0
@@ -849,6 +874,12 @@ jobs:
849874
call %TEMP%\oneapi\setvars.bat --force
850875
.\.ci\scripts\build.bat onedal_dpc icx avx2
851876
displayName: 'make onedal_dpc'
877+
- task: PublishPipelineArtifact@1
878+
inputs:
879+
artifactName: '$(platform.type) icx build'
880+
targetPath: '$(Build.Repository.LocalPath)/$(release.dir)'
881+
displayName: 'Upload Intel build artifacts'
882+
continueOnError: true
852883
- script: |
853884
call %TEMP%\oneapi\setvars.bat --force
854885
.\.ci\scripts\test.bat daal\cpp lib icx cmake
@@ -866,6 +897,30 @@ jobs:
866897
ls -lh __nuget/inteldal*.nupkg
867898
displayName: 'nuget pkg'
868899
900+
- job: 'WindowsReleaseCompare'
901+
dependsOn:
902+
- WindowsMakeIntel
903+
- WindowsBazel
904+
pool:
905+
vmImage: '$(WIN_VM_IMAGE)'
906+
steps:
907+
- task: DownloadPipelineArtifact@2
908+
inputs:
909+
artifact: 'win32e icx build'
910+
path: '$(Pipeline.Workspace)\make'
911+
- task: DownloadPipelineArtifact@2
912+
inputs:
913+
artifact: 'win32e Bazel icx build'
914+
path: '$(Pipeline.Workspace)\bazel'
915+
- powershell: |
916+
python dev/release_tests/compare_release_trees.py `
917+
--platform windows `
918+
--structure-only `
919+
--make "$(Pipeline.Workspace)\make\daal\latest" `
920+
--bazel "$(Pipeline.Workspace)\bazel"
921+
displayName: 'Compare Make and Bazel release tree structure'
922+
continueOnError: true
923+
869924
870925
- job: WindowsSklearnex
871926
dependsOn: WindowsMakeVC

BUILD

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ load("@onedal//dev/bazel:release.bzl",
44
"release_extra_file",
55
)
66
load("@onedal//dev/bazel:scripts.bzl",
7-
"generate_vars_sh",
7+
"generate_cmake_config",
8+
"generate_modulefile",
89
"generate_pkgconfig",
10+
"generate_vars_sh",
911
)
1012

1113
config_setting(
@@ -18,6 +20,11 @@ generate_vars_sh(
1820
out = "env/vars.sh",
1921
)
2022

23+
generate_modulefile(
24+
name = "release_modulefile_dal",
25+
out = "modulefiles/dal",
26+
)
27+
2128
generate_pkgconfig(
2229
name = "release_pkgconfig",
2330
out = "lib/pkgconfig/onedal.pc",
@@ -39,14 +46,16 @@ filegroup(
3946
srcs = ["@onedal//cpp/oneapi/dal:public_includes"],
4047
)
4148

42-
filegroup(
49+
generate_cmake_config(
4350
name = "release_cmake_config",
44-
srcs = ["cmake/templates/oneDALConfig.cmake.in"],
51+
template = "cmake/templates/oneDALConfig.cmake.in",
52+
out = "lib/cmake/oneDAL/oneDALConfig.cmake",
4553
)
4654

47-
filegroup(
55+
generate_cmake_config(
4856
name = "release_cmake_config_version",
49-
srcs = ["cmake/templates/oneDALConfigVersion.cmake.in"],
57+
template = "cmake/templates/oneDALConfigVersion.cmake.in",
58+
out = "lib/cmake/oneDAL/oneDALConfigVersion.cmake",
5059
)
5160

5261
filegroup(
@@ -64,14 +73,22 @@ filegroup(
6473
srcs = ["deploy/nuget/inteldal.nuspec.tpl"],
6574
)
6675

76+
filegroup(
77+
name = "release_mpi_daal_lst_linux",
78+
srcs = ["samples/daal/cpp/mpi/daal_lnx.lst"],
79+
)
80+
81+
filegroup(
82+
name = "release_mpi_makefile_linux",
83+
srcs = ["samples/daal/cpp/mpi/makefile_lnx"],
84+
)
85+
6786
filegroup(
6887
name = "release_package_files",
6988
srcs = glob([
7089
"examples/cmake/setup_examples.cmake",
7190
"samples/cmake/*.cmake",
7291
"samples/daal/cpp/mpi/CMakeLists.txt",
73-
"samples/daal/cpp/mpi/daal.lst.bat",
74-
"samples/daal/cpp/mpi/launcher.bat",
7592
"samples/daal/cpp/mpi/license.txt",
7693
"samples/daal/cpp/mpi/resources/*",
7794
"samples/daal/cpp/mpi/sources/*.cpp",
@@ -82,7 +99,13 @@ filegroup(
8299
"samples/oneapi/cpp/mpi/CMakeLists.txt",
83100
"samples/oneapi/cpp/mpi/sources/*.cpp",
84101
"samples/oneapi/cpp/mpi/sources/*.hpp",
85-
]),
102+
]) + select({
103+
":windows": glob([
104+
"samples/daal/cpp/mpi/daal.lst.bat",
105+
"samples/daal/cpp/mpi/launcher.bat",
106+
]),
107+
"//conditions:default": [],
108+
}),
86109
)
87110

88111
release(
@@ -123,17 +146,21 @@ release(
123146
"//data:datasets",
124147
":release_package_files",
125148
"//examples/daal/cpp:release_files",
149+
"//examples/oneapi/cpp:release_files",
126150
],
127151
extra_files = [
128152
release_extra_file(":release_vars_sh", "env/vars.sh", windows_dst_path = "env/vars.bat"),
129-
release_extra_file(":release_pkgconfig", "lib/pkgconfig/onedal.pc", windows_dst_path = ""),
130-
release_extra_file(":release_pkgconfig_dynamic_threading_host", "", windows_dst_path = "lib/pkgconfig/dal-dynamic-threading-host.pc"),
131-
release_extra_file(":release_pkgconfig_static_threading_host", "", windows_dst_path = "lib/pkgconfig/dal-static-threading-host.pc"),
153+
release_extra_file(":release_pkgconfig", "", windows_dst_path = "lib/pkgconfig/onedal.pc"),
154+
release_extra_file(":release_pkgconfig_dynamic_threading_host", "lib/pkgconfig/dal-dynamic-threading-host.pc", windows_dst_path = ""),
155+
release_extra_file(":release_pkgconfig_static_threading_host", "lib/pkgconfig/dal-static-threading-host.pc", windows_dst_path = ""),
132156
release_extra_file("//deploy/local:config_file", "config/config.txt"),
157+
release_extra_file(":release_modulefile_dal", "modulefiles/dal", windows_dst_path = ""),
158+
release_extra_file(":release_mpi_daal_lst_linux", "samples/daal/cpp/mpi/daal.lst", windows_dst_path = ""),
159+
release_extra_file(":release_mpi_makefile_linux", "samples/daal/cpp/mpi/makefile", windows_dst_path = ""),
133160
release_extra_file(":release_cmake_config", "lib/cmake/oneDAL/oneDALConfig.cmake"),
134161
release_extra_file(":release_cmake_config_version", "lib/cmake/oneDAL/oneDALConfigVersion.cmake"),
135-
release_extra_file(":release_nuspec_devel", "nuspec/inteldal.devel.win-x64.nuspec", windows_dst_path = "nuspec/inteldal.devel.win-x64.nuspec"),
136-
release_extra_file(":release_nuspec_redist", "nuspec/inteldal.redist.win-x64.nuspec", windows_dst_path = "nuspec/inteldal.redist.win-x64.nuspec"),
137-
release_extra_file(":release_nuspec_static", "nuspec/inteldal.static.win-x64.nuspec", windows_dst_path = "nuspec/inteldal.static.win-x64.nuspec"),
162+
release_extra_file(":release_nuspec_devel", "nuspec/inteldal.devel.linux.nuspec", windows_dst_path = "nuspec/inteldal.devel.win-x64.nuspec"),
163+
release_extra_file(":release_nuspec_redist", "nuspec/inteldal.redist.linux.nuspec", windows_dst_path = "nuspec/inteldal.redist.win-x64.nuspec"),
164+
release_extra_file(":release_nuspec_static", "nuspec/inteldal.static.linux.nuspec", windows_dst_path = "nuspec/inteldal.static.win-x64.nuspec"),
138165
],
139166
)

conda-recipe/build.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ export DPL_ROOT=$PREFIX
2727
# libtbbmalloc.so.<N>, etc.) while oneDAL Make expects unversioned names in
2828
# TBBROOT/lib prerequisites. Mirror the full libtbb* tree into a staging dir,
2929
# adding unversioned symlinks where missing.
30-
# Keep the staging path outside $SRC_DIR: conda-build can create source work
31-
# directories with shell/make-special characters on rebuilds (for example
32-
# ".../work(1)"), and oneDAL Make uses TBBROOT in prerequisites.
33-
export TBBROOT="$BUILD_PREFIX/__onedal_tbbroot"
30+
# Keep the staging path outside conda-build work/build prefixes:
31+
# oneDAL Make escapes parentheses as "222" internally, so timestamped conda
32+
# paths containing that digit sequence can be decoded into bogus parentheses
33+
# when used in prerequisites.
34+
export TBBROOT="/tmp/onedal-tbbroot"
3435
rm -rf "$TBBROOT"
3536
mkdir -p "$TBBROOT/lib"
3637

conda-recipe/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ outputs:
159159
source_files:
160160
- examples
161161
- data
162+
- dev/release_tests/package_metadata_test.sh
162163
- .ci/env/MKLConfig.cmake
163164
script: test-devel.sh # [linux]
164165
about:

conda-recipe/test-devel.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ set -eu
1616
# limitations under the License.
1717
#===============================================================================
1818

19-
test -f $CONDA_PREFIX/lib/pkgconfig/dal-dynamic-threading-host.pc
20-
test -f $CONDA_PREFIX/lib/pkgconfig/dal-static-threading-host.pc
19+
./dev/release_tests/package_metadata_test.sh "$CONDA_PREFIX"
2120

2221
# Load oneDAL environment helpers required by pkg-config/CMake example builds.
2322
. "$CONDA_PREFIX/env/vars.sh"

cpp/daal/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ daal_module(
156156
daal_module(
157157
name = "threading_tbb",
158158
srcs = glob(["src/threading/**/*.cpp"]),
159+
visibility_hidden = False,
159160
local_defines = [
160161
"__TBB_NO_IMPLICIT_LINKAGE",
161162
"__TBB_LEGACY_MODE",
@@ -227,6 +228,7 @@ daal_algorithms(
227228
"objective_function/cross_entropy_loss",
228229
"objective_function/logistic_loss",
229230
"objective_function/mse",
231+
"objective_function/precomputed",
230232
"optimization_solver",
231233
"optimization_solver/lbfgs",
232234
"optimization_solver/coordinate_descent",
@@ -238,6 +240,7 @@ daal_algorithms(
238240
"ridge_regression",
239241
"svd",
240242
"svm",
243+
"tsne",
241244
],
242245
)
243246

@@ -259,6 +262,10 @@ daal_static_lib(
259262
],
260263
)
261264

265+
exports_files([
266+
"thread_dynamic.lds",
267+
])
268+
262269
daal_dynamic_lib(
263270
name = "core_dynamic",
264271
lib_name = "onedal_core",
@@ -282,6 +289,7 @@ daal_dynamic_lib(
282289
daal_dynamic_lib(
283290
name = "thread_dynamic",
284291
lib_name = "onedal_thread",
292+
linker_scripts = [":thread_dynamic.lds"],
285293
deps = [
286294
":threading_tbb",
287295
],

cpp/daal/src/algorithms/tsne/BUILD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#===============================================================================
2+
# Copyright contributors to the oneDAL project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#===============================================================================
16+
17+
package(default_visibility = ["//visibility:public"])
18+
load("@onedal//dev/bazel:daal.bzl", "daal_module")
19+
20+
daal_module(
21+
name = "kernel",
22+
auto = True,
23+
deps = [
24+
"@onedal//cpp/daal:core",
25+
],
26+
)

cpp/daal/thread_dynamic.lds

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright contributors to the oneDAL project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
{
18+
local:
19+
__bss_start;
20+
_edata;
21+
_end;
22+
};

0 commit comments

Comments
 (0)