Skip to content

Reserve WebGPU program vector capacity#28534

Open
Lingavasan wants to merge 1 commit into
microsoft:mainfrom
Lingavasan:codex/onnxruntime-webgpu-program-reserve
Open

Reserve WebGPU program vector capacity#28534
Lingavasan wants to merge 1 commit into
microsoft:mainfrom
Lingavasan:codex/onnxruntime-webgpu-program-reserve

Conversation

@Lingavasan
Copy link
Copy Markdown

Fixes #28516

Summary

  • add ProgramBase reserve helpers for inputs, outputs, and uniform variables
  • reserve capacity when bulk-adding inputs, outputs, and uniform variables
  • apply explicit capacity hints in WebGPU convolution program setup paths
  • add compile-time checks that the new reserve helpers preserve chain-style ProgramBase& returns

Validation

  • git diff --check
  • PATH="$PWD/.venv/bin:$PATH" .venv/bin/lintrunner -a onnxruntime/core/providers/webgpu/program.h onnxruntime/core/providers/webgpu/program.cc onnxruntime/core/providers/webgpu/program_test.cc onnxruntime/core/providers/webgpu/nn/conv.cc onnxruntime/core/providers/webgpu/nn/conv2d_mm.cc
  • PATH="$PWD/.venv/bin:$PATH" python3 tools/ci_build/build.py --build_dir /private/tmp/ort-webgpu-build --config Release --update --use_webgpu --cmake_path "$PWD/.venv/bin/cmake" --cmake_generator Ninja --skip_tests
  • PATH="$PWD/.venv/bin:$PATH" .venv/bin/ninja -C /private/tmp/ort-webgpu-build/Release onnxruntime_providers_webgpu
  • PATH="$PWD/.venv/bin:$PATH" .venv/bin/ninja -C /private/tmp/ort-webgpu-build/Release onnxruntime_test_all onnxruntime_provider_test onnx_test_runner
  • PATH="$PWD/.venv/bin:$PATH" .venv/bin/ctest --test-dir /private/tmp/ort-webgpu-build/Release --output-on-failure

CTest note: onnx_test_pytorch_converted and onnx_test_pytorch_operator passed locally. onnxruntime_test_all and onnxruntime_provider_test built successfully but abort on this local macOS environment because Dawn reports Failed to get a WebGPU adapter: No supported adapters while initializing the WebGPU EP, before completing the suite.

Signed-off-by: Lingavasan <lsuresh4@asu.edu>
@Lingavasan
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Lingavasan Lingavasan marked this pull request as ready for review May 17, 2026 22: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.

[WebGPU] Proposal: C++ optimization by reserving program inputs, output, and uniform variables

1 participant