Skip to content

Commit 54bb97e

Browse files
JTischbeinJohannesGaessler
authored andcommitted
CUDA: Changing the CUDA scheduling strategy to spin (ggml-org#16585)
* CUDA set scheduling strategy to spinning for cc121 * Using prop.major and prop.minor, include HIP and MUSA * Exclude HIP and MUSA * Remove trailing whitespace Co-authored-by: Johannes Gäßler <[email protected]> * Remove empty line Co-authored-by: Johannes Gäßler <[email protected]> --------- Co-authored-by: Johannes Gäßler <[email protected]>
1 parent 1c709d1 commit 54bb97e

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
@@ -273,6 +273,15 @@ static ggml_cuda_device_info ggml_cuda_init() {
273273
} else if (device_name.substr(0, 21) == "NVIDIA GeForce GTX 16") {
274274
turing_devices_without_mma.push_back({ id, device_name });
275275
}
276+
277+
// Temporary performance fix:
278+
// Setting device scheduling strategy for iGPUs with cc121 to "spinning" to avoid delays in cuda synchronize calls.
279+
// TODO: Check for future drivers the default scheduling strategy and
280+
// remove this call again when cudaDeviceScheduleSpin is default.
281+
if (prop.major == 12 && prop.minor == 1) {
282+
CUDA_CHECK(cudaSetDeviceFlags(cudaDeviceScheduleSpin));
283+
}
284+
276285
#endif // defined(GGML_USE_HIP)
277286
}
278287

0 commit comments

Comments
 (0)