| 86 | test_restore_env("DS4_METAL_DISABLE_STREAMING_PREFILL_BATCH_SELECTED_ADDR", |
| 87 | saved.batch_selected_addr); |
| 88 | } |
| 89 | |
| 90 | static ds4_backend test_model_backend(void) { |
| 91 | const char *backend = getenv("DS4_TEST_BACKEND"); |
| 92 | if (backend && !strcmp(backend, "cpu")) return DS4_BACKEND_CPU; |
| 93 | #ifdef __APPLE__ |
| 94 | return DS4_BACKEND_METAL; |
| 95 | #else |
| 96 | return DS4_BACKEND_CUDA; |
| 97 | #endif |
| 98 | } |
| 99 | |
| 100 | static ds4_engine *test_open_engine(bool quality) { |
| 101 | ds4_engine *engine = NULL; |
| 102 | /* DS4_TEST_MTP loads the MTP head on the fast engine so the speculative |
| 103 | * verify regression can reuse it; draft=4 hits the multi-row verify path. */ |
| 104 | const char *mtp = getenv("DS4_TEST_MTP"); |
| 105 | ds4_engine_options opt = { |
| 106 | .model_path = test_model_path(), |
| 107 | .backend = test_model_backend(), |
| 108 | .quality = quality, |
| 109 | .ssd_streaming = test_env_bool("DS4_TEST_SSD_STREAMING"), |
| 110 | .ssd_streaming_cold = test_env_bool("DS4_TEST_SSD_STREAMING_COLD"), |
| 111 | .ssd_streaming_cache_experts = |
| 112 | test_env_u32("DS4_TEST_SSD_STREAMING_CACHE_EXPERTS"), |
| 113 | .ssd_streaming_cache_bytes = |
| 114 | test_env_gib("DS4_TEST_SSD_STREAMING_CACHE_GB"), |
| 115 | .ssd_streaming_preload_experts = |
| 116 | test_env_u32("DS4_TEST_SSD_STREAMING_PRELOAD_EXPERTS"), |
| 117 | .mtp_path = (mtp && mtp[0] && !quality) ? mtp : NULL, |
no test coverage detected