|
1 | 1 | #define CL_TARGET_OPENCL_VERSION 220 |
2 | 2 |
|
3 | 3 | // suppress warnings in CL headers for GCC and Clang |
4 | | -#pragma GCC diagnostic ignored "-Wgnu-anonymous-struct" |
5 | 4 | #pragma GCC diagnostic ignored "-Woverlength-strings" |
| 5 | +#ifdef __clang__ |
| 6 | +#pragma GCC diagnostic ignored "-Wgnu-anonymous-struct" |
| 7 | +#endif |
6 | 8 |
|
7 | 9 | #include "ggml-opencl.h" |
8 | 10 | #include "ggml-backend.h" |
@@ -1163,9 +1165,7 @@ static void * ggml_backend_opencl_buffer_get_base(ggml_backend_buffer_t buffer) |
1163 | 1165 | static void ggml_backend_opencl_buffer_init_tensor(ggml_backend_buffer_t buffer, ggml_tensor * tensor) { |
1164 | 1166 | ggml_backend_opencl_buffer_context * ctx = (ggml_backend_opencl_buffer_context *) buffer->context; |
1165 | 1167 |
|
1166 | | - ggml_backend_opencl_context * backend_ctx = |
1167 | | - (ggml_backend_opencl_context *)ggml_cl2_init(buffer->buft->device); |
1168 | | - cl_context context = backend_ctx->context; |
| 1168 | + ggml_cl2_init(buffer->buft->device); |
1169 | 1169 |
|
1170 | 1170 | if (tensor->view_src != nullptr) { |
1171 | 1171 | GGML_ASSERT(tensor->view_src->buffer->buft == buffer->buft); |
@@ -3604,8 +3604,9 @@ static void ggml_cl_soft_max(ggml_backend_t backend, const ggml_tensor * src0, c |
3604 | 3604 | const int ne02 = src0 ? src0->ne[2] : 0; |
3605 | 3605 | const int ne03 = src0 ? src0->ne[3] : 0; |
3606 | 3606 |
|
3607 | | - const float scale = ((float *) dst->op_params)[0]; |
3608 | | - const float max_bias = ((float *) dst->op_params)[1]; |
| 3607 | + float scale, max_bias; |
| 3608 | + memcpy(&scale, dst->op_params + 0, sizeof(float)); |
| 3609 | + memcpy(&max_bias, dst->op_params + 1, sizeof(float)); |
3609 | 3610 |
|
3610 | 3611 | const int nrows_x = ggml_nrows(src0); |
3611 | 3612 | const int nrows_y = src0->ne[1]; |
@@ -3845,10 +3846,6 @@ bool ggml_cl_compute_forward(ggml_backend_t backend, struct ggml_tensor * tensor |
3845 | 3846 | func = ggml_cl_cpy; |
3846 | 3847 | break; |
3847 | 3848 | case GGML_OP_DUP: |
3848 | | - if (!any_on_device) { |
3849 | | - return false; |
3850 | | - } |
3851 | | - func = ggml_cl_dup; |
3852 | 3849 | case GGML_OP_CONT: |
3853 | 3850 | if (!any_on_device) { |
3854 | 3851 | return false; |
|
0 commit comments