Skip to content
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

Add WebGPU Provider #960

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See documentation at https://onnxruntime.ai/docs/genai.
|API| Python <br/>C# <br/>C/C++ <br/> Java ^ |Objective-C||
|Platform| Linux <br/> Windows <br/>Mac ^ <br/>Android ^ ||iOS |||
|Architecture|x86 <br/> x64 <br/> Arm64 ~ ||||
|Hardware Acceleration|CUDA<br/>DirectML<br/>|QNN <br/> ROCm |OpenVINO|
|Hardware Acceleration|CUDA<br/>DirectML<br/>|QNN <br/> ROCm <br/> WebGPU |OpenVINO|
|Features|| Interactive decoding <br/> Customization (fine-tuning)| Speculative decoding |

\* The Llama model architecture supports similar model families such as CodeLlama, Vicuna, Yi, and more.
Expand Down
9 changes: 8 additions & 1 deletion src/models/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,15 @@ void Model::CreateSessionOptionsFromConfig(const Config::SessionOptions& config_
}

session_options.AppendExecutionProvider("QNN", opts);
} else
} else if (provider_options.name == "WebGPU") {
vraspar marked this conversation as resolved.
Show resolved Hide resolved
std::unordered_map<std::string, std::string> opts;
for (auto& option : provider_options.options) {
opts.emplace(option.first, option.second);
}
session_options.AppendExecutionProvider("WebGPU", opts);
} else {
throw std::runtime_error("Unknown provider type: " + provider_options.name);
}
}
}

Expand Down
12 changes: 8 additions & 4 deletions tools/ci_build/github/android/build_aar_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ def _build_aar(args):
build_config = args.config
aar_dir = intermediates_dir / "aar" / build_config
jnilibs_dir = intermediates_dir / "jnilibs" / build_config
base_build_command = ([sys.executable, str(BUILD_PY),
f"--config={build_config}", f"--ort_home={str(args.ort_home)}"] +
build_settings["build_params"])

base_build_command = [sys.executable, str(BUILD_PY), f"--config={build_config}"]

if args.ort_home:
base_build_command.append(f"--ort_home={args.ort_home}")

base_build_command += build_settings["build_params"]

header_files_path = None

# Build binary for each ABI, one by one
Expand Down Expand Up @@ -181,7 +185,7 @@ def parse_args():
help="Configuration to build.",
)

parser.add_argument("--ort_home", type=Path, default=REPO_ROOT / "ort",
parser.add_argument("--ort_home", type=Path, default=None,
help="Path to an unzipped onnxruntime AAR.")

parser.add_argument(
Expand Down
Loading