원클릭으로
ort-build
Build ONNX Runtime from source. Use this skill when asked to build, compile, or generate CMake files for ONNX Runtime.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Build ONNX Runtime from source. Use this skill when asked to build, compile, or generate CMake files for ONNX Runtime.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Audit and fix out-of-range output writes in ONNX Runtime operator shape-inference functions. Use when reviewing or fixing a contrib (or standard) op TypeAndShapeInference where a getNumOutputs() guard precedes a write to a higher output index - optional trailing outputs make a smaller output count schema-valid, so getOutputType(index) can run one past the declared outputs at Graph::Resolve.
Build and run ONNX Runtime WebGPU provider tests on Linux WITHOUT a real GPU, using a software Vulkan adapter (Mesa lavapipe). Use when you need to exercise WebGPU EP kernels off-Mac — the Linux webgpu CI leg is build-only, so software Vulkan is how you actually run WebGPU correctness tests locally. SCOPE - lavapipe only validates host-side enforce/shape bugs and MatMul-free kernels; any graph containing MatMul (including the expanded-Attention node tests) crashes lavapipe and runs ONLY on macOS-arm64 Metal, which is the source of truth for those. Covers install (dnf on Azure Linux), the --use_webgpu build flag, the onnxruntime_provider_test target, VK_ICD_FILENAMES, and the lavapipe MatMul crash gotcha.
Patterns and pitfalls for the ONNX domain Attention operator (opset 23/24) CUDA implementation. Use when modifying the dispatch cascade in core/providers/cuda/llm/attention.cc, writing mask/bias CUDA kernels, debugging attention test routing, or adding features to the ONNX Attention op. NOT for contrib domain MultiHeadAttention/GroupQueryAttention.
Use when rebuilding ONNX Runtime CUDA after editing CUTLASS fused-MHA headers (onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/*.h such as kernel_forward.h or fmha_launch_template.h), or when a header edit "passed" an incremental build but test behavior did not change. Explains the nvcc depfile gotcha that produces stale Memory-Efficient-Attention (MEA) kernels and binaries, and how to force a correct recompile. Also covers disk-space frugality on shared GPU dev boxes.
Run ONNX Runtime tests. Use this skill when asked to run tests, debug test failures, or find and execute specific test cases in ONNX Runtime.
Step-by-step checklist for bumping the pinned ONNX dependency / opset in ONNX Runtime (e.g. ONNX 1.21 / opset 26 → 1.22 / opset 27). Use when integrating a new ONNX release or release-candidate, updating the cmake/deps.txt onnx pin or the cmake/external/onnx submodule, regenerating cmake/patches/onnx/onnx.patch, raising kMaxSupportedOpset, or adding a new opset's CPU kernels. Covers the file taxonomy, archive-hash procedures, patch rebase/mirror rules, the RC→formal strategy, and the optimizer/EP gotchas that the automated audit script misses.
| name | ort-build |
| description | Build ONNX Runtime from source. Use this skill when asked to build, compile, or generate CMake files for ONNX Runtime. |
The build scripts build.sh (Linux/macOS) and build.bat (Windows) delegate to tools/ci_build/build.py.
Three phases, controlled by flags:
--update — generate CMake build files--build — compile (add --parallel to speed this up)--test — run testsFor native builds, if none are specified (and --skip_tests is not passed), all three run by default. For cross-compiled builds, the default is --update + --build only.
--updateYou need --update when:
You do not need --update when only modifying existing .cc/.h files — just use --build. Skipping it saves time.
# Full build (update + build + test)
./build.sh --config Release --parallel
.\build.bat --config Release --parallel # Windows
# Just regenerate CMake files
./build.sh --config Release --update
# Just compile (skip CMake regeneration and tests)
./build.sh --config Release --build --parallel
# Just run tests (after a prior build)
./build.sh --config Release --test
# Build with CUDA execution provider
./build.sh --config Release --parallel --use_cuda --cuda_home /usr/local/cuda --cudnn_home /usr/local/cuda
# Build Python wheel
./build.sh --config Release --parallel --build_wheel
# Build a specific CMake target (much faster than a full build)
./build.sh --config Release --build --parallel --target onnxruntime_common
# Load flags from an option file (one flag per line)
./build.sh "@./custom_options.opt" --build --parallel
| Flag | Description |
|---|---|
--config | Debug, MinSizeRel, Release, or RelWithDebInfo |
--parallel | Enable parallel compilation (recommended) |
--skip_tests | Skip running tests after build |
--build_wheel | Build the Python wheel package |
--use_cuda | Enable CUDA EP. Requires --cuda_home/--cudnn_home or CUDA_HOME/CUDNN_HOME env vars. On Windows, only cuda_home/CUDA_HOME is validated. |
--target T | Build a specific CMake target (requires --build; e.g., onnxruntime_common, onnxruntime_test_all) |
--use_webgpu | Enable WebGPU EP. To run its tests locally on Linux without a GPU, see the webgpu-local-testing skill. |
--cmake_extra_defines onnxruntime_QUICK_BUILD=ON | Faster CUDA build: instantiates a reduced kernel set. Side effect: Flash is compiled for head_dim 128 only, so most attention shapes fall back to MEA (changes which attention kernel is compiled/dispatched). Don't use it to characterize Flash-vs-arch behavior. |
--build_dir | Build output directory |
Default: build/<Platform>/<Config>/ where Platform is Linux, MacOS, or Windows.
With Visual Studio multi-config generators, the config name appears twice (e.g., build/Windows/Release/Release/).
It may be customized with --build_dir.
AGENTS.md.ort-test skill → "Verify which path/kernel actually executed"). Concrete instance:
onnxruntime_QUICK_BUILD=ON compiles FlashAttention for head_dim 128 only, so most
attention shapes silently dispatch to Memory-Efficient Attention instead of Flash —
details in the cuda-attention-kernel-patterns skill.python tools/ci_build/build.py directly over build.bat/build.sh when redirecting output. The .bat wrapper runs in cmd.exe, which breaks PowerShell redirection.> build_log.txt 2>&1). Build output is large and will overflow terminal buffers."Build complete" or errors.--parallel by default unless the user says otherwise.