-
Notifications
You must be signed in to change notification settings - Fork 801
[CI][benchmarks] Modify benchmark scripts and CI workflow to enable gdb_mode #20891
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: sycl
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -34,6 +34,9 @@ on: | |
| Extra options to be added to LIT_OPTS. | ||
| type: string | ||
| default: '' | ||
| gdb_mode: | ||
| type: string | ||
| required: False | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls add |
||
|
|
||
| repo_ref: | ||
| type: string | ||
|
|
@@ -379,3 +382,4 @@ jobs: | |
| exit_on_failure: ${{ inputs.benchmark_exit_on_failure }} | ||
| build_ref: ${{ inputs.repo_ref }} | ||
| runner: ${{ inputs.runner }} | ||
| gdb_mode: ${{ inputs.gdb_mode }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,9 @@ inputs: | |
| type: string | ||
| required: False | ||
| default: "" | ||
| gdb_mode: | ||
| type: string | ||
| required: False | ||
| # dry-run is passed only to compare.py (to not fail on regression), not to main.py (where such flag would omit all benchmark runs) | ||
| dry_run: | ||
| type: string | ||
|
|
@@ -280,6 +283,7 @@ runs: | |
| echo "::endgroup::" | ||
| echo "::group::run_benchmarks" | ||
|
|
||
| export LLVM_BENCHMARKS_USE_GDB=${LLVM_BENCHMARKS_USE_GDB} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when is |
||
| numactl --cpunodebind "$NUMA_NODE" --membind "$NUMA_NODE" \ | ||
| ./devops/scripts/benchmarks/main.py "$BENCH_WORKDIR" \ | ||
| --sycl "$(realpath $CMPLR_ROOT)" \ | ||
|
|
@@ -299,17 +303,21 @@ runs: | |
| echo "::endgroup::" | ||
| echo "::group::compare_results" | ||
|
|
||
| python3 ./devops/scripts/benchmarks/compare.py to_hist \ | ||
| --avg-type EWMA \ | ||
| --cutoff "$(date -u -d '7 days ago' +'%Y%m%d_%H%M%S')" \ | ||
| --name "$SAVE_NAME" \ | ||
| --compare-file "${BENCHMARK_RESULTS_REPO_PATH}/results/${SAVE_NAME}_${SAVE_TIMESTAMP}.json" \ | ||
| --results-dir "${BENCHMARK_RESULTS_REPO_PATH}/results/" \ | ||
| --regression-filter '^[a-z_]+_sycl .* CPU count' \ | ||
| --regression-filter-type 'SYCL benchmark (measured using CPU cycle count)' \ | ||
| --verbose \ | ||
| --produce-github-summary \ | ||
| ${{ inputs.dry_run == 'true' && '--dry-run' || '' }} \ | ||
| if [ "$LLVM_BENCHMARKS_USE_GDB" == "false" ]; then | ||
| python3 ./devops/scripts/benchmarks/compare.py to_hist \ | ||
| --avg-type EWMA \ | ||
| --cutoff "$(date -u -d '7 days ago' +'%Y%m%d_%H%M%S')" \ | ||
| --name "$SAVE_NAME" \ | ||
| --compare-file "${BENCHMARK_RESULTS_REPO_PATH}/results/${SAVE_NAME}_${SAVE_TIMESTAMP}.json" \ | ||
| --results-dir "${BENCHMARK_RESULTS_REPO_PATH}/results/" \ | ||
| --regression-filter '^[a-z_]+_sycl .* CPU count' \ | ||
| --regression-filter-type 'SYCL benchmark (measured using CPU cycle count)' \ | ||
| --verbose \ | ||
| --produce-github-summary \ | ||
| ${{ inputs.dry_run == 'true' && '--dry-run' || '' }} | ||
| else | ||
| echo "Skipping regression comparison due to GDB mode enabled." | ||
| fi | ||
|
|
||
| echo "::endgroup::" | ||
| - name: Run benchmarks integration tests | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import csv | ||
| import io | ||
| import math | ||
| import os | ||
| from enum import Enum | ||
| from itertools import product | ||
| from pathlib import Path | ||
|
|
@@ -88,6 +89,8 @@ def setup(self) -> None: | |
| f"-DUSE_SYSTEM_LEVEL_ZERO=OFF", | ||
| f"-DCMAKE_CXX_COMPILER=clang++", | ||
| f"-DCMAKE_C_COMPILER=clang", | ||
| f"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG -fdebug-info-for-profiling", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps we should only add these when GDB is enabled...? |
||
| f"-DCMAKE_BUILD_TYPE=RelWithDebInfo", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modify the |
||
| ] | ||
| if options.ur_adapter == "cuda": | ||
| extra_args += [ | ||
|
|
@@ -561,28 +564,36 @@ def __enabled_runtimes(self) -> list[RUNTIMES]: | |
| return runtimes | ||
|
|
||
| def __parse_output(self, output: str) -> list[tuple[float, float]]: | ||
| csv_file = io.StringIO(output) | ||
| reader = csv.reader(csv_file) | ||
| next(reader, None) | ||
| results = [] | ||
| while True: | ||
| data_row = next(reader, None) | ||
| if data_row is None: | ||
| break | ||
| try: | ||
| mean = float(data_row[1]) | ||
| median = float(data_row[2]) | ||
| # compute benchmarks report stddev as % | ||
| stddev = mean * (float(data_row[3].strip("%")) / 100.0) | ||
| if not math.isfinite(stddev): | ||
| stddev = 0.0 # Default to 0.0 if stddev is invalid | ||
|
|
||
| results.append((median, stddev)) | ||
| except (ValueError, IndexError) as e: | ||
| raise ValueError(f"Error parsing output: {e}") | ||
| if len(results) == 0: | ||
| raise ValueError("Benchmark output does not contain data.") | ||
| return results | ||
| is_gdb_benchmarks = os.environ.get("LLVM_BENCHMARKS_USE_GDB", "") == "true" | ||
| print(output) | ||
|
|
||
| if is_gdb_benchmarks: | ||
| return [(0.0, 0.0)] | ||
|
|
||
| else: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for else, since you returned on the |
||
| csv_file = io.StringIO(output) | ||
| reader = csv.reader(csv_file) | ||
| next(reader, None) | ||
| results = [] | ||
| while True: | ||
| data_row = next(reader, None) | ||
| # print("my data",data_row) | ||
| if data_row is None: | ||
| break | ||
| try: | ||
| mean = float(data_row[1]) | ||
| median = float(data_row[2]) | ||
| # compute benchmarks report stddev as % | ||
| stddev = mean * (float(data_row[3].strip("%")) / 100.0) | ||
| if not math.isfinite(stddev): | ||
| stddev = 0.0 # Default to 0.0 if stddev is invalid | ||
|
|
||
| results.append((median, stddev)) | ||
| except (ValueError, IndexError) as e: | ||
| raise ValueError(f"Error parsing output: {e}") | ||
| if len(results) == 0: | ||
| raise ValueError("Benchmark output does not contain data.") | ||
| return results | ||
|
|
||
| def __validate_attr(self, attr_name: str): | ||
| if ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,25 @@ def run( | |
| if isinstance(command, str): | ||
| command = command.split() | ||
|
|
||
| is_gdb_benchmarks = os.environ.get("LLVM_BENCHMARKS_USE_GDB", "") == "true" | ||
| if command[0] == "taskset" and is_gdb_benchmarks: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we check if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did it so
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can it be not the first one? e.g. in command like |
||
| gdb_cmd = [ | ||
| "gdb", | ||
| "-return-child-result", | ||
| "--batch", | ||
| "--ex", | ||
| "set confirm off", | ||
| "--ex", | ||
| "run", | ||
| "--ex", | ||
| "bt", | ||
| "--ex", | ||
| "quit", | ||
| "--args", | ||
| ] + command | ||
| command = gdb_cmd | ||
| print(f"Running in gdb mode: {command}") | ||
|
|
||
| env = os.environ.copy() | ||
| for ldlib in ld_library: | ||
| if os.path.isdir(ldlib): | ||
|
|
||
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.
pls move below and add to the name prefix
benchmark_