DUP: move to cpy.cpp, set debug logs and adjust include

This commit is contained in:
Akarshan Biswas 2025-02-02 11:48:03 +05:30
parent 927925ffe2
commit 0c319bf721
No known key found for this signature in database
GPG key ID: 52A578A14B32134D
3 changed files with 12 additions and 6 deletions

View file

@ -1,5 +1,7 @@
#include "cpy.hpp" #include "cpy.hpp"
#include <float.h>
static void cpy_1_f32_f32(const char * cxi, char * cdsti) { static void cpy_1_f32_f32(const char * cxi, char * cdsti) {
const float * xi = (const float *) cxi; const float * xi = (const float *) cxi;
float * dsti = (float *) cdsti; float * dsti = (float *) cdsti;
@ -350,6 +352,8 @@ void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, co
char * src0_ddc = (char *) src0->data; char * src0_ddc = (char *) src0->data;
char * src1_ddc = (char *) src1->data; char * src1_ddc = (char *) src1->data;
GGML_SYCL_DEBUG("%s: type combination supplied: %s to %s\n", __func__, ggml_type_name(src0->type),
ggml_type_name(src1->type));
if (src0->type == GGML_TYPE_F32 && src1->type == GGML_TYPE_F32) { if (src0->type == GGML_TYPE_F32 && src1->type == GGML_TYPE_F32) {
ggml_cpy_f32_f32_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10, ggml_cpy_f32_f32_sycl(src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10,
@ -387,3 +391,10 @@ void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, co
std::cerr << exc.what() << "Exception caught at file:" << __FILE__ << ", line:" << __LINE__ << std::endl; std::cerr << exc.what() << "Exception caught at file:" << __FILE__ << ", line:" << __LINE__ << std::endl;
std::exit(1); std::exit(1);
} }
void ggml_sycl_dup(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
// TODO: why do we pass dst as src1 here?
GGML_SYCL_DEBUG("call %s\n", __func__);
ggml_sycl_cpy(ctx, dst->src[0], dst);
GGML_SYCL_DEBUG("call %s done\n", __func__);
}

View file

@ -2,10 +2,10 @@
#define GGML_SYCL_CPY_HPP #define GGML_SYCL_CPY_HPP
#include "common.hpp" #include "common.hpp"
#include <float.h>
typedef void (*cpy_kernel_t)(const char * cx, char * cdst); typedef void (*cpy_kernel_t)(const char * cx, char * cdst);
void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, const ggml_tensor * src1); void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor * src0, const ggml_tensor * src1);
void ggml_sycl_dup(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
#endif // GGML_SYCL_CPY_HPP #endif // GGML_SYCL_CPY_HPP

View file

@ -2852,11 +2852,6 @@ static void ggml_sycl_clamp(ggml_backend_sycl_context & ctx, ggml_tensor * dst)
ggml_sycl_op_clamp(ctx, dst); ggml_sycl_op_clamp(ctx, dst);
} }
static void ggml_sycl_dup(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
// TODO: why do we pass dst as src1 here?
ggml_sycl_cpy(ctx, dst->src[0], dst);
}
static void ggml_sycl_pool2d(ggml_backend_sycl_context & ctx, ggml_tensor * dst) { static void ggml_sycl_pool2d(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
ggml_sycl_op_pool2d(ctx, dst); ggml_sycl_op_pool2d(ctx, dst);
} }