Skip to content

Commit d25d716

Browse files
committed
Remove build time dependency on webgpu (#1201)
1 parent c80a530 commit d25d716

File tree

7 files changed

+2
-16
lines changed

7 files changed

+2
-16
lines changed

CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ include(cmake/check_cuda.cmake)
4141
include(cmake/check_rocm.cmake)
4242
# Checking if DML is supported
4343
include(cmake/check_dml.cmake)
44-
# Checking if WebGpu is supported
45-
include(cmake/check_webgpu.cmake)
4644

4745
include(cmake/cxx_standard.cmake)
4846

build.py

-3
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescript
126126

127127
parser.add_argument("--use_rocm", action="store_true", help="Whether to use ROCm. Default is to not use rocm.")
128128

129-
parser.add_argument("--use_webgpu", action="store_true", help="Whether to use WebGpu. Default is to not use WebGpu.")
130-
131129
parser.add_argument("--use_dml", action="store_true", help="Whether to use DML. Default is to not use DML.")
132130

133131
# The following options are mutually exclusive (cross compiling options such as android, ios, etc.)
@@ -473,7 +471,6 @@ def update(args: argparse.Namespace, env: dict[str, str]):
473471
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
474472
f"-DUSE_CUDA={'ON' if args.use_cuda else 'OFF'}",
475473
f"-DUSE_ROCM={'ON' if args.use_rocm else 'OFF'}",
476-
f"-DUSE_WEBGPU={'ON' if args.use_webgpu else 'OFF'}",
477474
f"-DUSE_DML={'ON' if args.use_dml else 'OFF'}",
478475
f"-DENABLE_JAVA={'ON' if args.build_java else 'OFF'}",
479476
f"-DBUILD_WHEEL={build_wheel}",

cmake/check_webgpu.cmake

-6
This file was deleted.

cmake/options.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include(CMakeDependentOption)
44
option(USE_CUDA "Build with CUDA support" ON)
55
option(USE_ROCM "Build with ROCm support" ON)
66
option(USE_DML "Build with DML support" OFF)
7-
option(USE_WEBGPU "Build with WEBGPU support" ON)
87

98
# bindings
109
option(ENABLE_JAVA "Build the Java API." OFF)

src/models/model.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,12 @@ void Model::InitDeviceAllocator(OrtSession& session) {
317317
}
318318
#endif
319319

320-
#if USE_WEBGPU
321320
if (device_type_ == DeviceType::WEBGPU) {
322321
// for webgpu we only use device memory for kv_cache
323322
memory_info_device_ = OrtMemoryInfo::Create("WebGPU_Buffer", OrtAllocatorType::OrtDeviceAllocator, 0, OrtMemType::OrtMemTypeDefault);
324323
owned_allocator_device_ = Ort::Allocator::Create(session, *memory_info_device_);
325324
allocator_kvcache_ = owned_allocator_device_.get();
326325
}
327-
#endif
328326

329327
if (device_type_ == DeviceType::QNN) {
330328
memory_info_device_ = OrtMemoryInfo::Create("QnnHtpShared", OrtAllocatorType::OrtDeviceAllocator, 0,

src/python/python.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ PYBIND11_MODULE(onnxruntime_genai, m) {
554554
m.def("is_cuda_available", []() { return USE_CUDA != 0; });
555555
m.def("is_dml_available", []() { return USE_DML != 0; });
556556
m.def("is_rocm_available", []() { return USE_ROCM != 0; });
557-
m.def("is_webgpu_available", []() { return USE_WEBGPU != 0; });
557+
m.def("is_webgpu_available", []() { return true; });
558+
m.def("is_qnn_available", []() { return true; });
558559

559560
m.def("set_current_gpu_device_id", [](int device_id) { Ort::SetCurrentGpuDeviceId(device_id); });
560561
m.def("get_current_gpu_device_id", []() { return Ort::GetCurrentGpuDeviceId(); });

src/runtime_settings.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ std::unique_ptr<RuntimeSettings> CreateRuntimeSettings() {
77
}
88

99
std::string RuntimeSettings::GenerateConfigOverlay() const {
10-
// #if USE_WEBGPU
1110
constexpr std::string_view webgpu_overlay_pre = R"({
1211
"model": {
1312
"decoder": {

0 commit comments

Comments
 (0)