-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathruntime_settings.cpp
More file actions
42 lines (36 loc) · 1.01 KB
/
runtime_settings.cpp
File metadata and controls
42 lines (36 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "runtime_settings.h"
namespace Generators {
std::unique_ptr<RuntimeSettings> CreateRuntimeSettings() {
return std::make_unique<RuntimeSettings>();
}
std::string RuntimeSettings::GenerateConfigOverlay() const {
constexpr std::string_view webgpu_overlay_pre = R"({
"model": {
"decoder": {
"session_options": {
"provider_options": [
{
"WebGPU": {
"dawnProcTable": ")";
constexpr std::string_view webgpu_overlay_post = R"("
}
}
]
}
}
}
}
)";
auto it = handles_.find("dawnProcTable");
if (it != handles_.end()) {
void* dawn_proc_table_handle = it->second;
std::string overlay;
overlay.reserve(webgpu_overlay_pre.size() + webgpu_overlay_post.size() + 20); // Optional small optimization of buffer size
overlay += webgpu_overlay_pre;
overlay += std::to_string((size_t)(dawn_proc_table_handle));
overlay += webgpu_overlay_post;
return overlay;
}
return {};
}
} // namespace Generators