Commit 0c7da6f
committed
Add: Unified runtime hardware dispatch layer (Phase 5.6)
Replaces scattered compile-time #ifdef chains with a centralized runtime
hardware detection and backend selection module. CPUID probes AVX-512 at
runtime, CUDA/Metal availability checked via device queries, OpenMP thread
count detected dynamically. Backend can be overridden via FLEXAIDS_BACKEND
environment variable with automatic fallback to next-best available.
New files:
- LIB/hardware_dispatch.h — HardwareBackend enum, HardwareCapabilities struct, API
- LIB/hardware_dispatch.cpp — CPUID, CUDA, Metal, OpenMP detection + selection logic
Updated:
- ShannonThermoStack now uses runtime dispatch for report strings and exposes
active_shannon_backend() for programmatic backend queries
- CMakeLists.txt wires hardware_dispatch.cpp into all targets, fixes Eigen
compile definition propagation for test_hardware_dispatch, adds SIMD
configuration to test target
- 18 new tests covering runtime detection, backend selection, fallback logic,
exclusion lists, edge cases (100k histograms, extreme ranges, single-bin)
All 63 hardware dispatch tests pass. Pre-existing StatMech tolerance test
(HighTemperatureFlattensWeights) unchanged.
https://claude.ai/code/session_015b2LFt2aRHwau6rv6hnHoZ1 parent af69aee commit 0c7da6f
File tree
6 files changed
+606
-27
lines changed- LIB
- ShannonThermoStack
- tests
6 files changed
+606
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| |||
488 | 489 | | |
489 | 490 | | |
490 | 491 | | |
491 | | - | |
| 492 | + | |
492 | 493 | | |
493 | 494 | | |
494 | 495 | | |
| 496 | + | |
495 | 497 | | |
496 | 498 | | |
497 | 499 | | |
498 | 500 | | |
499 | 501 | | |
500 | 502 | | |
501 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
502 | 509 | | |
503 | 510 | | |
504 | 511 | | |
505 | | - | |
| 512 | + | |
506 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
507 | 518 | | |
508 | 519 | | |
509 | 520 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
293 | 289 | | |
294 | 290 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 291 | + | |
299 | 292 | | |
300 | 293 | | |
301 | 294 | | |
302 | 295 | | |
303 | 296 | | |
304 | 297 | | |
305 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
306 | 330 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
90 | 99 | | |
0 commit comments