Skip to content

Commit 02fc26c

Browse files
committed
CUDA set scheduling strategy to spinning for cc121
1 parent fa882fd commit 02fc26c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ static ggml_cuda_device_info ggml_cuda_init() {
207207
#endif // GGML_CUDA_FORCE_CUBLAS
208208
GGML_LOG_INFO("%s: found %d " GGML_CUDA_NAME " devices:\n", __func__, info.device_count);
209209

210+
bool is_cc121 = false;
210211
std::vector<std::pair<int, std::string>> turing_devices_without_mma;
211212
for (int id = 0; id < info.device_count; ++id) {
212213
int device_vmm = 0;
@@ -273,6 +274,9 @@ static ggml_cuda_device_info ggml_cuda_init() {
273274
} else if (device_name.substr(0, 21) == "NVIDIA GeForce GTX 16") {
274275
turing_devices_without_mma.push_back({ id, device_name });
275276
}
277+
278+
is_cc121 |= info.devices[id].cc == 1210;
279+
276280
#endif // defined(GGML_USE_HIP)
277281
}
278282

@@ -293,6 +297,11 @@ static ggml_cuda_device_info ggml_cuda_init() {
293297
// configure logging to stdout
294298
// CUBLAS_CHECK(cublasLoggerConfigure(1, 1, 0, nullptr));
295299

300+
// Setting device scheduling strategy for iGPUs to "spinning" to avoid delays in cuda synchronize calls.
301+
if (is_cc121) {
302+
CUDA_CHECK(cudaSetDeviceFlags(cudaDeviceScheduleSpin));
303+
}
304+
296305
return info;
297306
}
298307

0 commit comments

Comments
 (0)