Skip to content

test: add performance testing harness#23

Merged
voltjia merged 1 commit into
masterfrom
test/add-performance-testing-harness
Jul 10, 2026
Merged

test: add performance testing harness#23
voltjia merged 1 commit into
masterfrom
test/add-performance-testing-harness

Conversation

@voltjia

@voltjia voltjia commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add an opt-in INFINI_RT_BUILD_PERFORMANCE_TESTING CMake path under tests/performance.
  • Add lightweight runtime dispatch, memory, and TensorView performance tests that emit JSON lines with unit, mean, and median.
  • Add scripts/run_performance_tests.py and scripts/compare_performance_results.py for local result collection and baseline/candidate comparison.
  • Document local performance-test build, run, collection, and comparison commands in docs/build.md.

Motivation

InfiniRT currently has functional coverage but no repeatable local mechanism for measuring runtime overhead and catching performance regressions. This PR introduces the first local performance-testing harness without mixing it into the default functional INFINI_RT_BUILD_TESTING flow.

Closes N/A

Type of Change

  • feat - new feature / new operator / new platform
  • fix - bug fix
  • perf - performance improvement (no behavioral change)
  • refactor - code restructuring without behavior change
  • test - adding or fixing tests only
  • docs - documentation only
  • build / ci - build system or CI configuration
  • chore - tooling, formatting, or other non-code changes
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

$ git diff --check HEAD~1..HEAD
# passed

$ python -m py_compile scripts/run_performance_tests.py scripts/compare_performance_results.py
# passed with bundled Python runtime

GitHub Actions on PR #23:
- build: pass
- clang-format: pass
- ruff: pass
- deploy: skipped

Remote validation on ssh nvidia, commit 4f72c9bc87de289400b108ba3bec2ce33b8d6f9a:
- CPU performance build: passed
- CPU ctest -L performance: passed, 3/3 tests, 4.55 sec total
- CPU result collection: wrote 36 results to perf-current-cpu.json
- NVIDIA performance build: passed with CUDA 13.0.88
- NVIDIA perf_runtime_dispatch: passed when run directly
- NVIDIA perf_tensor_view: passed when run directly
- NVIDIA perf_memory: exceeded 90 seconds after printing the first 4 KiB MallocFree result

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA Yes Build passed on ssh nvidia; direct perf_runtime_dispatch and perf_tensor_view runs passed. perf_memory is too slow with current default CUDA allocator iterations and exceeded a 90s direct-run timeout after one result.
Iluvatar Yes Not run No Iluvatar runner was used for this PR validation.
MetaX Yes Not run No MetaX runner was used for this PR validation.
Cambricon Yes Not run No Cambricon runner was used for this PR validation.
Moore Yes Not run No Moore runner was used for this PR validation.
Ascend Yes Not run No Ascend runner was used for this PR validation.
Remote CPU CTest output
Internal ctest changing into directory: /tmp/infinirt-perf-nb3EjJ/InfiniRT/build-perf-cpu
Test project /tmp/infinirt-perf-nb3EjJ/InfiniRT/build-perf-cpu
    Start 1: perf_runtime_dispatch
1/3 Test #1: perf_runtime_dispatch ............   Passed    0.08 sec
    Start 2: perf_memory
2/3 Test #2: perf_memory ......................   Passed    4.20 sec
    Start 3: perf_tensor_view
3/3 Test #3: perf_tensor_view .................   Passed    0.27 sec

100% tests passed, 0 tests failed out of 3

Label Time Summary:
performance    =   4.54 sec*proc (3 tests)

Total Test time (real) =   4.55 sec

Benchmark / Performance Impact

This PR adds opt-in performance tests only. It does not change runtime behavior unless INFINI_RT_BUILD_PERFORMANCE_TESTING=ON is explicitly configured.

Remote validation was run on ssh nvidia in /tmp/infinirt-perf-nb3EjJ/InfiniRT at commit 4f72c9bc87de289400b108ba3bec2ce33b8d6f9a.

Environment:

Linux master 5.15.0-179-generic x86_64
cmake 3.22.1
ctest 3.22.1
g++ 11.4.0
python3 3.10.12
CUDA compiler NVIDIA 13.0.88
GPU: 8 x NVIDIA A100-SXM4-80GB, driver 580.105.08

Commands used for CPU validation:

cmake -S . -B build-perf-cpu \
  -DCMAKE_BUILD_TYPE=Release \
  -DWITH_CPU=ON \
  -DINFINI_RT_BUILD_PERFORMANCE_TESTING=ON
cmake --build build-perf-cpu -j
ctest --test-dir build-perf-cpu -L performance --output-on-failure
python3 scripts/run_performance_tests.py \
  --build-dir build-perf-cpu \
  --backend cpu \
  --output perf-current-cpu.json

Commands used for NVIDIA validation:

env PATH=/usr/local/cuda-13.0/bin:$PATH \
  LD_LIBRARY_PATH=/usr/local/cuda-13.0/targets/x86_64-linux/lib:${LD_LIBRARY_PATH:-} \
  CUDACXX=/usr/local/cuda-13.0/bin/nvcc \
  cmake -S . -B build-perf-nvidia2 \
  -DCMAKE_BUILD_TYPE=Release \
  -DWITH_NVIDIA=ON \
  -DINFINI_RT_BUILD_PERFORMANCE_TESTING=ON

env PATH=/usr/local/cuda-13.0/bin:$PATH \
  LD_LIBRARY_PATH=/usr/local/cuda-13.0/targets/x86_64-linux/lib:${LD_LIBRARY_PATH:-} \
  cmake --build build-perf-nvidia2 -j

CPU result summary from perf-current-cpu.json:

backend benchmark params unit mean median
cpu perf_runtime_dispatch.runtime_device_type - ns 4.041143 4.042901
cpu perf_runtime_dispatch.set_runtime_device_type - ns 4.049595 4.049852
cpu perf_runtime_dispatch.dispatch_GetDevice - ns 5.719349 5.67667
cpu perf_runtime_dispatch.direct_GetDevice - ns 0.33768 0.333525
cpu perf_runtime_dispatch.dispatch_DeviceSynchronize - ns 5.416481 5.45549
cpu perf_runtime_dispatch.direct_DeviceSynchronize - ns 0.333524 0.333535
cpu perf_memory.MallocFree size_bytes=4096 us 0.033613 0.033011
cpu perf_memory.MallocHostFreeHost size_bytes=4096 us 0.032115 0.032018
cpu perf_memory.MemcpyHostToDevice size_bytes=4096 us 0.058539 0.058533
cpu perf_memory.MemcpyDeviceToHost size_bytes=4096 us 0.042204 0.042176
cpu perf_memory.MemcpyDeviceToDevice size_bytes=4096 us 0.0592 0.059227
cpu perf_memory.Memset size_bytes=4096 us 0.03265 0.032688
cpu perf_memory.MallocFree size_bytes=65536 us 0.035048 0.035026
cpu perf_memory.MallocHostFreeHost size_bytes=65536 us 0.036511 0.035368
cpu perf_memory.MemcpyHostToDevice size_bytes=65536 us 1.76187 1.707405
cpu perf_memory.MemcpyDeviceToHost size_bytes=65536 us 1.672602 1.668868
cpu perf_memory.MemcpyDeviceToDevice size_bytes=65536 us 1.694215 1.691289
cpu perf_memory.Memset size_bytes=65536 us 1.140936 1.139347
cpu perf_memory.MallocFree size_bytes=1048576 us 0.034184 0.03412
cpu perf_memory.MallocHostFreeHost size_bytes=1048576 us 0.034083 0.03383
cpu perf_memory.MemcpyHostToDevice size_bytes=1048576 us 69.968505 69.737025
cpu perf_memory.MemcpyDeviceToHost size_bytes=1048576 us 68.963916 68.89886
cpu perf_memory.MemcpyDeviceToDevice size_bytes=1048576 us 69.855087 71.085695
cpu perf_memory.Memset size_bytes=1048576 us 20.037856 20.46497
cpu perf_memory.MallocFree size_bytes=16777216 us 0.036593 0.0356
cpu perf_memory.MallocHostFreeHost size_bytes=16777216 us 0.036471 0.0352
cpu perf_memory.MemcpyHostToDevice size_bytes=16777216 us 1005.073136 1005.7637
cpu perf_memory.MemcpyDeviceToHost size_bytes=16777216 us 1050.115293 1062.5111
cpu perf_memory.MemcpyDeviceToDevice size_bytes=16777216 us 1075.486771 1077.0393
cpu perf_memory.Memset size_bytes=16777216 us 745.283186 735.2114
cpu perf_tensor_view.construct_contiguous ndim=2 ns 35.52444 35.484405
cpu perf_tensor_view.operator_index ndim=2 ns 71.172309 70.905275
cpu perf_tensor_view.numel ndim=2 ns 3.00286 3.0001
cpu perf_tensor_view.is_contiguous_true ndim=2 ns 27.974801 27.978335
cpu perf_tensor_view.is_contiguous_false ndim=2 ns 21.211595 21.310235
cpu perf_tensor_view.hash ndim=2 ns 11.050151 11.01058
Raw NVIDIA perf_runtime_dispatch output
{"backend":"nvidia","benchmark":"perf_runtime_dispatch.runtime_device_type","params":{},"iterations":1000000,"unit":"ns","mean":5.724313,"median":5.82811}
{"backend":"nvidia","benchmark":"perf_runtime_dispatch.set_runtime_device_type","params":{},"iterations":1000000,"unit":"ns","mean":5.83061171429,"median":5.813068}
{"backend":"nvidia","benchmark":"perf_runtime_dispatch.dispatch_GetDevice","params":{},"iterations":200000,"unit":"ns","mean":65.0808092857,"median":48.231315}
{"backend":"nvidia","benchmark":"perf_runtime_dispatch.direct_GetDevice","params":{},"iterations":200000,"unit":"ns","mean":42.586075,"median":42.065435}
{"backend":"nvidia","benchmark":"perf_runtime_dispatch.dispatch_DeviceSynchronize","params":{},"iterations":200000,"unit":"ns","mean":2015.20736643,"median":1785.503775}
{"backend":"nvidia","benchmark":"perf_runtime_dispatch.direct_DeviceSynchronize","params":{},"iterations":200000,"unit":"ns","mean":1824.255975,"median":1889.21806}
Raw NVIDIA perf_tensor_view output
{"backend":"nvidia","benchmark":"perf_tensor_view.construct_contiguous","params":{"ndim":2},"iterations":200000,"unit":"ns","mean":35.2714471429,"median":35.26721}
{"backend":"nvidia","benchmark":"perf_tensor_view.operator_index","params":{"ndim":2},"iterations":200000,"unit":"ns","mean":70.49953,"median":70.459035}
{"backend":"nvidia","benchmark":"perf_tensor_view.numel","params":{"ndim":2},"iterations":200000,"unit":"ns","mean":3.09144928571,"median":3.00024}
{"backend":"nvidia","benchmark":"perf_tensor_view.is_contiguous_true","params":{"ndim":2},"iterations":200000,"unit":"ns","mean":28.1229221429,"median":28.096425}
{"backend":"nvidia","benchmark":"perf_tensor_view.is_contiguous_false","params":{"ndim":2},"iterations":200000,"unit":"ns","mean":20.7970757143,"median":20.842875}
{"backend":"nvidia","benchmark":"perf_tensor_view.hash","params":{"ndim":2},"iterations":200000,"unit":"ns","mean":11.0330228571,"median":11.017515}
Raw NVIDIA perf_memory partial output

The direct run used timeout 90s ./perf_memory. It printed one result before the timeout ended the process:

{"backend":"nvidia","benchmark":"perf_memory.MallocFree","params":{"size_bytes":4096},"iterations":2000,"unit":"us","mean":1244.18359121,"median":1091.6453825}

This suggests the current CUDA allocator benchmark iteration count is too high for practical review-time validation. The harness works, but CUDA memory benchmarks should likely get backend-specific iteration tuning before they are used as a gating signal.

Attached output file: perf-current-cpu.json
[
  {
    "backend": "cpu",
    "benchmark": "perf_runtime_dispatch.runtime_device_type",
    "params": {},
    "iterations": 1000000,
    "unit": "ns",
    "mean": 4.04114271429,
    "median": 4.042901,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_runtime_dispatch.set_runtime_device_type",
    "params": {},
    "iterations": 1000000,
    "unit": "ns",
    "mean": 4.04959485714,
    "median": 4.049852,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_runtime_dispatch.dispatch_GetDevice",
    "params": {},
    "iterations": 200000,
    "unit": "ns",
    "mean": 5.71934857143,
    "median": 5.67667,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_runtime_dispatch.direct_GetDevice",
    "params": {},
    "iterations": 200000,
    "unit": "ns",
    "mean": 0.33768,
    "median": 0.333525,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_runtime_dispatch.dispatch_DeviceSynchronize",
    "params": {},
    "iterations": 200000,
    "unit": "ns",
    "mean": 5.41648142857,
    "median": 5.45549,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_runtime_dispatch.direct_DeviceSynchronize",
    "params": {},
    "iterations": 200000,
    "unit": "ns",
    "mean": 0.333523571429,
    "median": 0.333535,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocFree",
    "params": {
      "size_bytes": 4096
    },
    "iterations": 2000,
    "unit": "us",
    "mean": 0.0336127857143,
    "median": 0.033011,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocHostFreeHost",
    "params": {
      "size_bytes": 4096
    },
    "iterations": 2000,
    "unit": "us",
    "mean": 0.0321147142857,
    "median": 0.0320175,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyHostToDevice",
    "params": {
      "size_bytes": 4096
    },
    "iterations": 2000,
    "unit": "us",
    "mean": 0.058539,
    "median": 0.058533,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToHost",
    "params": {
      "size_bytes": 4096
    },
    "iterations": 2000,
    "unit": "us",
    "mean": 0.0422036428571,
    "median": 0.0421755,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToDevice",
    "params": {
      "size_bytes": 4096
    },
    "iterations": 2000,
    "unit": "us",
    "mean": 0.0591995,
    "median": 0.0592265,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.Memset",
    "params": {
      "size_bytes": 4096
    },
    "iterations": 2000,
    "unit": "us",
    "mean": 0.0326498571429,
    "median": 0.0326875,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocFree",
    "params": {
      "size_bytes": 65536
    },
    "iterations": 1000,
    "unit": "us",
    "mean": 0.035048,
    "median": 0.035026,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocHostFreeHost",
    "params": {
      "size_bytes": 65536
    },
    "iterations": 1000,
    "unit": "us",
    "mean": 0.036511,
    "median": 0.035368,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyHostToDevice",
    "params": {
      "size_bytes": 65536
    },
    "iterations": 1000,
    "unit": "us",
    "mean": 1.76186985714,
    "median": 1.707405,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToHost",
    "params": {
      "size_bytes": 65536
    },
    "iterations": 1000,
    "unit": "us",
    "mean": 1.67260242857,
    "median": 1.668868,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToDevice",
    "params": {
      "size_bytes": 65536
    },
    "iterations": 1000,
    "unit": "us",
    "mean": 1.69421542857,
    "median": 1.691289,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.Memset",
    "params": {
      "size_bytes": 65536
    },
    "iterations": 1000,
    "unit": "us",
    "mean": 1.14093642857,
    "median": 1.139347,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocFree",
    "params": {
      "size_bytes": 1048576
    },
    "iterations": 200,
    "unit": "us",
    "mean": 0.0341842857143,
    "median": 0.03412,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocHostFreeHost",
    "params": {
      "size_bytes": 1048576
    },
    "iterations": 200,
    "unit": "us",
    "mean": 0.0340828571429,
    "median": 0.03383,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyHostToDevice",
    "params": {
      "size_bytes": 1048576
    },
    "iterations": 200,
    "unit": "us",
    "mean": 69.968505,
    "median": 69.737025,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToHost",
    "params": {
      "size_bytes": 1048576
    },
    "iterations": 200,
    "unit": "us",
    "mean": 68.9639157143,
    "median": 68.89886,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToDevice",
    "params": {
      "size_bytes": 1048576
    },
    "iterations": 200,
    "unit": "us",
    "mean": 69.8550871429,
    "median": 71.085695,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.Memset",
    "params": {
      "size_bytes": 1048576
    },
    "iterations": 200,
    "unit": "us",
    "mean": 20.0378564286,
    "median": 20.46497,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocFree",
    "params": {
      "size_bytes": 16777216
    },
    "iterations": 20,
    "unit": "us",
    "mean": 0.0365928571429,
    "median": 0.0356,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MallocHostFreeHost",
    "params": {
      "size_bytes": 16777216
    },
    "iterations": 20,
    "unit": "us",
    "mean": 0.0364714285714,
    "median": 0.0352,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyHostToDevice",
    "params": {
      "size_bytes": 16777216
    },
    "iterations": 20,
    "unit": "us",
    "mean": 1005.07313571,
    "median": 1005.7637,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToHost",
    "params": {
      "size_bytes": 16777216
    },
    "iterations": 20,
    "unit": "us",
    "mean": 1050.11529286,
    "median": 1062.5111,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.MemcpyDeviceToDevice",
    "params": {
      "size_bytes": 16777216
    },
    "iterations": 20,
    "unit": "us",
    "mean": 1075.48677143,
    "median": 1077.0393,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_memory.Memset",
    "params": {
      "size_bytes": 16777216
    },
    "iterations": 20,
    "unit": "us",
    "mean": 745.283185714,
    "median": 735.2114,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_tensor_view.construct_contiguous",
    "params": {
      "ndim": 2
    },
    "iterations": 200000,
    "unit": "ns",
    "mean": 35.52444,
    "median": 35.484405,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_tensor_view.operator_index",
    "params": {
      "ndim": 2
    },
    "iterations": 200000,
    "unit": "ns",
    "mean": 71.1723085714,
    "median": 70.905275,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_tensor_view.numel",
    "params": {
      "ndim": 2
    },
    "iterations": 200000,
    "unit": "ns",
    "mean": 3.00286,
    "median": 3.0001,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_tensor_view.is_contiguous_true",
    "params": {
      "ndim": 2
    },
    "iterations": 200000,
    "unit": "ns",
    "mean": 27.9748014286,
    "median": 27.978335,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_tensor_view.is_contiguous_false",
    "params": {
      "ndim": 2
    },
    "iterations": 200000,
    "unit": "ns",
    "mean": 21.211595,
    "median": 21.310235,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  },
  {
    "backend": "cpu",
    "benchmark": "perf_tensor_view.hash",
    "params": {
      "ndim": 2
    },
    "iterations": 200000,
    "unit": "ns",
    "mean": 11.0501507143,
    "median": 11.01058,
    "commit": "4f72c9bc87de289400b108ba3bec2ce33b8d6f9a",
    "compiler": "/usr/bin/c++",
    "build_type": "Release",
    "system": "Linux-5.15.0-179-generic-x86_64-with-glibc2.35"
  }
]

No baseline-vs-new comparison is included because this PR introduces the harness and does not claim a runtime performance improvement. The default memory sweep covers up to 16 MiB; INFINI_RT_PERF_ENABLE_LARGE=1 enables the 256 MiB case.

Notes for Reviewers

  • Performance tests intentionally live under tests/performance and scripts under scripts for this first stage.
  • Result fields intentionally keep units separate from metric names: unit, mean, and median.
  • Full CPU collection output is attached inline above as perf-current-cpu.json so reviewers can inspect the exact JSON emitted by the new harness.
  • NVIDIA validation exposed that perf_memory is too slow with the current allocator benchmark iteration count; this is a useful follow-up before using NVIDIA memory benchmarks as a presubmit gate.

@voltjia voltjia force-pushed the test/add-performance-testing-harness branch 2 times, most recently from 0177427 to 739f9c8 Compare July 9, 2026 05:20
@voltjia voltjia force-pushed the test/add-performance-testing-harness branch from 739f9c8 to 4f72c9b Compare July 9, 2026 05:22
@voltjia voltjia merged commit be8703a into master Jul 10, 2026
6 checks passed
@voltjia voltjia deleted the test/add-performance-testing-harness branch July 10, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant