From: Daniel Bevenius Date: Thu, 11 Jul 2024 15:53:42 +0000 (+0200) Subject: cuda : suppress 'noreturn' warn in no_device_code (llama/8414) X-Git-Tag: upstream/0.0.1642~522 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=c01efb10727cd9ad2f23cd91ed3feead17571aa5;p=pkg%2Fggml%2Fsources%2Fggml cuda : suppress 'noreturn' warn in no_device_code (llama/8414) * cuda : suppress 'noreturn' warn in no_device_code This commit adds a while(true) loop to the no_device_code function in common.cuh. This is done to suppress the warning: ```console /src/ggml-cuda/template-instances/../common.cuh:346:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn] 346 | } | ^ ``` The motivation for this is to reduce the number of warnings when compilng with GGML_HIPBLAS=ON. Signed-off-by: Daniel Bevenius * squash! cuda : suppress 'noreturn' warn in no_device_code Update __trap macro instead of using a while loop to suppress the warning. Signed-off-by: Daniel Bevenius --------- Signed-off-by: Daniel Bevenius --- diff --git a/src/ggml-cuda/common.cuh b/src/ggml-cuda/common.cuh index 4ff06b87..26d9412a 100644 --- a/src/ggml-cuda/common.cuh +++ b/src/ggml-cuda/common.cuh @@ -104,7 +104,7 @@ #define cudaStreamWaitEvent(stream, event, flags) hipStreamWaitEvent(stream, event, flags) #define cudaStream_t hipStream_t #define cudaSuccess hipSuccess -#define __trap abort +#define __trap() do { abort(); __builtin_unreachable(); } while(0) #define CUBLAS_STATUS_SUCCESS HIPBLAS_STATUS_SUCCESS #define CUBLAS_STATUS_NOT_INITIALIZED HIPBLAS_STATUS_NOT_INITIALIZED #define CUBLAS_STATUS_ALLOC_FAILED HIPBLAS_STATUS_ALLOC_FAILED