← Back to Pull requests

build(bazel): make the Windows build and tests fit MAX_PATH #3948

Closed
unknown closed this pull request without merging on Oct 29, 2026 08:49 UTC
View on GitHub
unknown unknown commented on Oct 28, 2026 10:19 UTC
Author

Description

Six small changes that together make the Bazel build and tests pass on Windows under a long output base, where MSVC cl.exe, lib.exe and link.exe and Bazel's own test wrapper hit MAX_PATH (260 characters) whatever LongPathsEnabled says. They are combined here so that one Windows CI run validates the whole set; they replace #3943, #3944 and #3945.

1. Short object paths at compile time (dev/bazel/cc/compile.bzl, dev/bazel/cc.bzl). Bazel names every object after its source, bazel-out/<config>/bin/<package>/_objs/<target>[_<fpt>_<cpu>]/<source basename>.obj, plus .params for the compiler's response file; the longest is 139 characters under bin, so with a CI output base of about 120 characters the compile of coordinate_descent, cross_entropy_loss or the decision forest kernels fails before lib.exe is reached (D8022 cannot open '...obj.params', LNK1181). The makefile never has this problem because it keeps all objects of a library in one flat directory named after the source basename only. This does the equivalent for Bazel, where the package directory is fixed. On Windows cc_module first bounds the longest object path a target would get with its real names; a target that fits keeps them, which on a forced Linux run is 392 of the 676 oneAPI objects and 58 of the 1552 DAAL objects. A target that does not fit compiles a one-line stand-in per source, _s/<short>/<n>.cpp, that includes the real source by its exec-root path, and names the per-fpt and per-cpu compile calls f/d and 0..n. The object path becomes <package>/_objs/<short>[_<f|d>_<n>]/<n>.obj, at most 87 characters under bin, and analysis fails with the offending label if any object would still exceed 95 with .params. The real source is a declared input of its own compile call, so edits rebuild exactly as before; because the compiler resolves quote includes, __FILE__ and diagnostics against the including file, same-directory includes keep working and errors still point at the real file and line. Nothing changes on Linux and macOS.

2. lld-link next to icx (dev/bazel/toolchains/cc_toolchain_win.bzl). oneAPI keeps lld-link.exe and llvm-lib.exe in bin\compiler, off PATH, so which() missed them and the icx toolchain fell back to MSVC link.exe and lib.exe. One _find_llvm_tool helper now looks next to the compiler for both, as #3941 did for llvm-lib alone.

3. Graph tests named like the other oneAPI tests (ten renames, no content change). The main test of an algorithm is test/batch.cpp and the argument checks test/badarg.cpp; the graph tests carried a redundant <name>_test.cpp suffix. The test target is derived from the file name, so for example :test_connected_components_test_host becomes :test_batch_host. On Windows this also matters for the test wrapper, which validates <bin>\<pkg>\<test>.exe.runfiles\MANIFEST without long-path support: connected_components and subgraph_isomorphism reached 261 characters and failed to start (CreateProcessW ... error: 3); after the rename they are 241.

4. Two Windows runtime failures skipped (dal_test_suite gets a not_on_windows list). The graph service functions test crashes at teardown and the shortest_paths badargs test dies before printing any test output on Windows, tracked in #3530. Neither failure can be narrowed below the file: one crashes at process exit, the other before the first test runs. The named tests are marked incompatible on Windows, so the suites report them as SKIPPED there and run them everywhere else; naming a file that is not in srcs fails analysis.

5. MSVC cl configured for the Visual Studio the shell was set up with (dev/bazel/toolchains/cc_toolchain_win.bzl, cc_toolchain.bzl, cc_toolchain_win.tpl.BUILD). rules_cc's auto-config takes the newest Visual Studio from vswhere unless BAZEL_VC/BAZEL_VS is set; on a runner with VS 2022 and VS 2026 installed, where the job had run VS 2022's vcvarsall.bat, every compile failed with C1083: Cannot open include file: 'vector', because the toolchain had the cl.exe of VS 2026 and the include directories of neither. The cl toolchain is now produced by calling rules_cc's configure_windows_toolchain from oneDAL's own toolchain repository with BAZEL_VC defaulting to VCINSTALLDIR, the variable vcvarsall.bat exports; rules_cc's BUILD and the files it references land in the msvc package of that repository, so register_toolchains("//:all") still registers only the root toolchain, which points at //msvc:cc-compiler-x64_windows. With a single Visual Studio, or with BAZEL_VC set, nothing changes.

6. Standard-conforming preprocessor under MSVC (dev/bazel/cc/compile.bzl). MSVC's traditional preprocessor expands __VA_ARGS__ as a single token, so the test engine's COMBINE_TYPES, which unpacks parenthesized type lists through a variadic helper, fails to parse (C2059, C2947) in every test that uses it. cc_module passes /Zc:preprocessor when the toolchain compiler is msvc-cl; icx and clang-cl conform without a switch.

7. Catch2 suites that compile under MSVC (three test files). MSVC rejects three constructs that icx and GCC accept. A lambda reads a constexpr local without capturing it in the hdbscan cluster_utils test (C3493), and if constexpr reads through a by-reference capture in the decision forest fixture (C2131); both locals are now static constexpr. global_context.cpp reads the CPU vendor with GCC inline assembly, which MSVC does not have on x64 (C2059); under _MSC_VER it now uses the __cpuidex intrinsic, as DAAL's CPU detection does.

8. A Bazel example in the Windows PR workflow (.github/workflows/ci-win.yml). A new x86_64 job builds with plain MSVC cl on a stock windows-2025 runner and runs //examples/oneapi/cpp:kmeans_lloyd_dense_batch_host. MKL and TBB come from the @mkl/@tbb downloads, so the runner needs no Intel compiler, and Visual Studio is located with vswhere. Bazel runs with --output_user_root=C:\b, like the Azure Bazel lane. The ARM64 clang-cl job runs the same example after its PE checks. Until now, PR CI built Windows Bazel binaries but ran none of them.

9. Online SPMD tests built for DPC++ only (four BUILD files). Host SPMD finalize is not implemented, so the basic_statistics, covariance, pca and linear_regression online SPMD tests return at SKIP_IF(is_cpu()) on host. Their host binaries still referenced the host SPMD finalize dispatchers: GCC drops those calls at -O2, but MSVC link.exe resolves them and fails with LNK2019. GCC fails the same way at -O0 on main. The four tests now live in a DPC++-only suite, so test_online_spmd_dpc keeps its name and only the empty host targets are gone.

Validation

On Linux: bazel build --nobuild //cpp/oneapi/dal:tests //:release analyses, and bazel test --config=host on the graph, connected_components, shortest_paths and subgraph_isomorphism suites runs 8 of 8 tests green under the new names. With the short-path mode forced on for Linux, //cpp/daal:all_static and //cpp/oneapi/dal:all_static build, the pca, dbscan, decision_forest and threading suites pass, bazel aquery shows each compile action taking _s/<short>/<n>.cpp as its source with the real .cpp among its inputs, and a deliberate error appended to df_classification_model.cpp is reported at that file's own path and line.

The Windows result comes from the WindowsBazel CI lanes; the MSVC cl lane in particular validates items 5 to 7 and 9, which Linux analysis can only load, not run. Item 8 is checked by its own jobs once public CI runs on this PR.

🤖 Generated with Claude Code

Diff: 650 lines (+487 / -163) across 8 files Reviewer: Alexandr-Solovev Review duration: 1349m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.388
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3948"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52% (MEDIUM) · Higher = larger blast radius
52%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 20.5% · Safe to merge
20.5%