Commit 9cdb2b0
authored
[lit][offloader][ninja] Add ability to toggle gpu by name (#646)
This change allows you to set an enviornment variable to pick which gpu
the offloader will use. For example say I have an Intel GPU I can do:
```
set "OFFLOADTEST_GPU_NAME=Intel(R) Arc(TM) A770 Graphics" && ninja -C ..\llvm-build\ check-hlsl-clang-d3d12
```
Or if I just want to specify the vendor I can do
```
set "OFFLOADTEST_GPU_NAME=Intel" && ninja -C ..\llvm-build\ check-hlsl-clang-d3d12
```
This was made via `llvm::regex` so you can use any casing. Say on linux
we would do
```bash
vulkaninfo --summary | grep deviceName
deviceName = NVIDIA GeForce RTX 4070 Ti (NVK AD104)
deviceName = llvmpipe (LLVM 20.1.2, 256 bits)
OFFLOADTEST_GPU_NAME=nvidia ninja -C ../llvm_builds/llvm_rel_with_debug_offload/ check-hlsl-clang-vk
OFFLOADTEST_GPU_NAME=llvmpipe ninja -C ../llvm_builds/llvm_rel_with_debug_offload/ check-hlsl-clang-vk
```
I am also adding a way to use the adapter index because in testing I
found typing out even just the substring can be more annoying than a
single char for the gpu index. The index is just the order we see them
in the device array.
I am also adding the ability to toggle between vulkan drivers on the
mac. To do this we just needed to encode the driver name into the
Description. Since `KosmicKrisp` is apple silicon only I limit its usage
to `if defined(__APPLE__) && defined(__aarch64__)`.
```bash
OFFLOADTEST_GPU_NAME=KosmicKrisp ninja -C ../builds/llvm_relwithdebinfo_offload check-hlsl-clang-vk
```
This change was useful for me to pick between multiple discrete gpus on
a single rig, egpus, and integrated gpus. It works now for both DirectX
and Vulkan devices.1 parent d1fa558 commit 9cdb2b0
3 files changed
Lines changed: 51 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
271 | 273 | | |
272 | 274 | | |
273 | 275 | | |
| |||
377 | 379 | | |
378 | 380 | | |
379 | 381 | | |
380 | | - | |
| 382 | + | |
381 | 383 | | |
382 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
383 | 396 | | |
384 | 397 | | |
385 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
141 | | - | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| |||
197 | 203 | | |
198 | 204 | | |
199 | 205 | | |
200 | | - | |
201 | 206 | | |
| 207 | + | |
202 | 208 | | |
203 | 209 | | |
| 210 | + | |
204 | 211 | | |
205 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
206 | 215 | | |
207 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
208 | 221 | | |
209 | 222 | | |
210 | 223 | | |
211 | 224 | | |
212 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
213 | 229 | | |
214 | 230 | | |
215 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| |||
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
| |||
141 | 153 | | |
142 | 154 | | |
143 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
144 | 159 | | |
145 | 160 | | |
146 | 161 | | |
| |||
0 commit comments