1
1
// SPDX-FileCopyrightText: Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved
2
2
// SPDX-License-Identifier: MIT
3
3
4
+ #define CL_TARGET_OPENCL_VERSION 220
5
+
6
+ // suppress warnings in CL headers for GCC and Clang
7
+ #pragma GCC diagnostic ignored "-Wgnu-anonymous-struct"
8
+ #pragma GCC diagnostic ignored "-Woverlength-strings"
9
+
4
10
#include " ggml-opencl2.h"
5
11
#include " ggml-backend.h"
6
12
#include " ggml-impl.h"
@@ -1237,10 +1243,6 @@ static void ggml_backend_opencl2_buffer_init_tensor(ggml_backend_buffer_t buffer
1237
1243
tensor->extra = extra;
1238
1244
}
1239
1245
}
1240
-
1241
- // This should be removed. Keep it to make it easier to identify the backend
1242
- // when debugging until backend is removed from tensor.
1243
- tensor->backend = GGML_BACKEND_TYPE_GPU;
1244
1246
}
1245
1247
1246
1248
// The optimized gemm and gemv kernels are used for large matrices without batch.
@@ -1938,18 +1940,7 @@ static struct ggml_backend_device_i ggml_backend_opencl2_device_i = {
1938
1940
/* .event_synchronize = */ NULL ,
1939
1941
};
1940
1942
1941
- //
1942
- // Backend registration
1943
- //
1944
-
1945
- GGML_API ggml_backend_t ggml_backend_reg_opencl2_init (const char * params, void * user_data) {
1946
- return ggml_backend_opencl2_init ();
1947
-
1948
- GGML_UNUSED (params);
1949
- GGML_UNUSED (user_data);
1950
- }
1951
-
1952
- // new API
1943
+ // Backend registry
1953
1944
1954
1945
static const char * ggml_backend_opencl2_reg_get_name (ggml_backend_reg_t reg) {
1955
1946
return " OpenCL2" ;
@@ -1986,6 +1977,7 @@ ggml_backend_reg_t ggml_backend_opencl2_reg(void) {
1986
1977
1987
1978
if (!initialized) {
1988
1979
reg = ggml_backend_reg {
1980
+ /* .api_version = */ GGML_BACKEND_API_VERSION,
1989
1981
/* .iface = */ ggml_backend_opencl2_reg_i,
1990
1982
/* .context = */ NULL ,
1991
1983
};
@@ -2004,6 +1996,8 @@ ggml_backend_reg_t ggml_backend_opencl2_reg(void) {
2004
1996
return ®
2005
1997
}
2006
1998
1999
+ GGML_BACKEND_DL_IMPL (ggml_backend_opencl2_reg)
2000
+
2007
2001
// ------------------------------------------------------------------------------
2008
2002
// Debugging utils
2009
2003
// ------------------------------------------------------------------------------
@@ -2921,13 +2915,11 @@ static void ggml_cl_mul_mat(ggml_backend_t backend, const ggml_tensor * src0, co
2921
2915
// init CL objects
2922
2916
// <--------------------------------------------> //
2923
2917
cl_int status;
2924
- cl_event evt;
2925
2918
cl_image_format img_fmt_1d;
2926
2919
cl_image_desc img_desc_1d;
2927
2920
cl_buffer_region region;
2928
2921
cl_mem A_image1d;
2929
2922
cl_mem B_image1d;
2930
- cl_mem A_sub_buffer;
2931
2923
cl_mem B_sub_buffer;
2932
2924
cl_mem C_d;
2933
2925
// for B transpose
0 commit comments