Skip to content

Commit 9b03e32

Browse files
authored
Call appropriate hip api's (#651)
1 parent 1fc35e2 commit 9b03e32

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llama.cpp/ggml-cuda.cu

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,30 @@ GGML_CALL bool ggml_cuda_link(const struct ggml_backend_api *backend_api) {
359359

360360
if (!FLAG_log_disable) {
361361
int kernelVersion = 0;
362+
#ifdef __HIP_PLATFORM_AMD__
363+
hipDriverGetVersion(&kernelVersion);
364+
fprintf(stderr, "%s: HIP driver version %d.%d.%d\n", __func__,
365+
kernelVersion / 10000000, (kernelVersion / 100000) % 100,
366+
kernelVersion % 100000);
367+
#else
362368
cudaDriverGetVersion(&kernelVersion);
363369
fprintf(stderr, "%s: CUDA kernel version %d.%d\n", __func__,
364370
kernelVersion / 1000, (kernelVersion % 1000) / 10);
371+
#endif
365372

366373
int runtimeVersion = 0;
374+
#ifdef __HIP_PLATFORM_AMD__
375+
hipRuntimeGetVersion(&runtimeVersion);
376+
fprintf(stderr, "%s: HIP runtime version is %d.%d.%d%s\n", __func__,
377+
runtimeVersion / 10000000, (runtimeVersion / 100000) % 100,
378+
runtimeVersion % 100000,
379+
runtimeVersion > kernelVersion ? " (!!!)" : "");
380+
#else
367381
cudaRuntimeGetVersion(&runtimeVersion);
368382
fprintf(stderr, "%s: CUDA runtime version is %d.%d%s\n", __func__,
369383
runtimeVersion / 1000, (runtimeVersion % 1000) / 10,
370384
runtimeVersion > kernelVersion ? " (!!!)" : "");
385+
#endif
371386

372387
fprintf(stderr, "%s: welcome to " GGML_CUDA_NAME " SDK with " BLAS_NAME "\n", __func__);
373388
}

0 commit comments

Comments
 (0)