-
Notifications
You must be signed in to change notification settings - Fork 224
bazel: release target auto-compiles all ISAs and DPC++ by default #3537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a6519c5
dd03ca7
d98f6c4
970b86f
ec91166
3a4e03b
b89addf
4fd605f
476819a
38afec2
a9906be
93a2e73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,6 @@ | ||||||||
| package(default_visibility = ["//visibility:public"]) | ||||||||
|
|
||||||||
| exports_files(["mkl_linkage_test.sh"]) | ||||||||
| exports_files([ | ||||||||
| "isa_coverage_test.sh", | ||||||||
|
||||||||
| "isa_coverage_test.sh", | |
| "isa_coverage_test.sh", | |
| "mkl_linkage_test.sh", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #!/usr/bin/env bash | ||
| #=============================================================================== | ||
| # Copyright contributors to the oneDAL project | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| #=============================================================================== | ||
| # | ||
| # Verifies that libonedal_core.so contains CPU dispatch symbols for all | ||
| # required ISA variants: sse2, sse42, avx2, avx512 (CpuType E0/E2/E4/E6). | ||
| # | ||
| # Make builds all 4 ISA variants by default. Building via //:release | ||
| # automatically compiles all ISA variants (cfg transition on release rule). | ||
| # This test enforces that contract. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| LIB="${1:-}" | ||
| if [[ -z "${LIB}" ]]; then | ||
| echo "Usage: $0 <path-to-libonedal_core.so>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -f "${LIB}" ]]; then | ||
| echo "ERROR: Library not found: ${LIB}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| PASS=0 | ||
| FAIL=0 | ||
|
|
||
| check_isa() { | ||
| local cpu_type="$1" # e.g. CpuTypeE2 | ||
| local isa_name="$2" # e.g. sse42 | ||
| local count | ||
| count=$(nm -D "${LIB}" | grep -c "${cpu_type}" || true) | ||
| if [[ "${count}" -gt 0 ]]; then | ||
| echo " OK ${isa_name} (${cpu_type}): ${count} dispatch symbols" | ||
| PASS=$((PASS + 1)) | ||
| else | ||
| echo " FAIL ${isa_name} (${cpu_type}): 0 dispatch symbols found" | ||
| echo " Build via //:release (uses all ISAs via cfg transition) or pass --cpu=all" | ||
| FAIL=$((FAIL + 1)) | ||
| fi | ||
| } | ||
|
|
||
| echo "=== ISA coverage check: $(basename "${LIB}") ===" | ||
| check_isa "CpuTypeE0" "sse2" | ||
| check_isa "CpuTypeE2" "sse42" | ||
| check_isa "CpuTypeE4" "avx2" | ||
| check_isa "CpuTypeE6" "avx512" | ||
|
|
||
| echo "" | ||
| if [[ "${FAIL}" -gt 0 ]]; then | ||
| echo "RESULT: FAILED (${FAIL} ISA(s) missing, ${PASS} present)" | ||
| exit 1 | ||
| else | ||
| echo "RESULT: PASSED (all 4 ISA variants present)" | ||
| exit 0 | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description says CI workflows were updated to build with
--config=release, but this workflow was changed tobazel build :release --cpu=avx2. If the intent is to validate the new release behavior (all ISA variants) in CI, this should use the release config/behavior rather than restricting toavx2(or update the PR description accordingly).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow intentionally uses --cpu=avx2 for faster CI (documented in the inline comment above the bazel build line). The PR description was inaccurate — updated to clarify that CI overrides the ISA to avx2 for speed, while the //:release transition handles all ISAs when cpu is unset.