89 rivejä
4.9 KiB
Diff
89 rivejä
4.9 KiB
Diff
diff --git a/ggml/src/ggml-opencl/ggml-opencl.cpp b/ggml/src/ggml-opencl/ggml-opencl.cpp
|
|
index 5c96b9a9f..90ce16da8 100644
|
|
--- a/ggml/src/ggml-opencl/ggml-opencl.cpp
|
|
+++ b/ggml/src/ggml-opencl/ggml-opencl.cpp
|
|
@@ -1160,7 +1160,8 @@ static void load_cl_kernels_argsort(ggml_backend_opencl_context *backend_ctx) {
|
|
std::string("CL") + std::to_string(backend_ctx->opencl_c_version.major) + "." + std::to_string(backend_ctx->opencl_c_version.minor);
|
|
std::string compile_opts = std::string("-cl-std=") + opencl_c_std +
|
|
" -cl-mad-enable -cl-unsafe-math-optimizations"
|
|
- " -cl-finite-math-only -cl-fast-relaxed-math";
|
|
+ " -cl-finite-math-only -cl-fast-relaxed-math"
|
|
+ " -D cl_qcom_reqd_sub_group_size";
|
|
|
|
// argsort
|
|
if (!backend_ctx->kernels_loaded_argsort) {
|
|
@@ -1203,7 +1204,8 @@ static void load_cl_kernels(ggml_backend_opencl_context *backend_ctx) {
|
|
std::string("CL") + std::to_string(backend_ctx->opencl_c_version.major) + "." + std::to_string(backend_ctx->opencl_c_version.minor);
|
|
std::string compile_opts = std::string("-cl-std=") + opencl_c_std +
|
|
" -cl-mad-enable -cl-unsafe-math-optimizations"
|
|
- " -cl-finite-math-only -cl-fast-relaxed-math";
|
|
+ " -cl-finite-math-only -cl-fast-relaxed-math"
|
|
+ " -D cl_qcom_reqd_sub_group_size";
|
|
|
|
if (backend_ctx->adreno_use_large_buffer) {
|
|
compile_opts += " -qcom-enable-large-buffer ";
|
|
@@ -5343,6 +5345,7 @@ static bool ggml_opencl_is_device_supported(ggml_backend_dev_t dev) {
|
|
GGML_ASSERT(dev_ctx->device);
|
|
|
|
if (strstr(dev_ctx->device_name.c_str(), "Adreno") ||
|
|
+ strstr(dev_ctx->device_name.c_str(), "FD6") ||
|
|
strstr(dev_ctx->device_name.c_str(), "Qualcomm") ||
|
|
strstr(dev_ctx->device_version.c_str(), "Adreno")) {
|
|
dev_ctx->gpu_family = GPU_FAMILY::ADRENO;
|
|
@@ -5394,7 +5397,8 @@ static bool ggml_opencl_is_device_supported(ggml_backend_dev_t dev) {
|
|
// If OpenCL 3.0 is supported, then check for cl_khr_subgroups, which becomes
|
|
// optional in OpenCL 3.0 (cl_khr_subgroup is mandatory in OpenCL 2.x)
|
|
if (opencl_c_version.major == 3 && strstr(ext_buffer, "cl_khr_subgroups") == NULL &&
|
|
- strstr(ext_buffer, "cl_intel_subgroups") == NULL) {
|
|
+ strstr(ext_buffer, "cl_intel_subgroups") == NULL &&
|
|
+ strstr(ext_buffer, "cl_khr_subgroup_ballot") == NULL) {
|
|
GGML_LOG_WARN("ggml_opencl: device does not support subgroups (cl_khr_subgroups or cl_intel_subgroups) "
|
|
"(note that subgroups is an optional feature in OpenCL 3.0)\n");
|
|
return false;
|
|
diff --git a/ggml/src/ggml-opencl/kernels/mul_mm_q4_k_f32_l4_lm.cl b/ggml/src/ggml-opencl/kernels/mul_mm_q4_k_f32_l4_lm.cl
|
|
index 2235b1ae8..dc191b1d2 100644
|
|
--- a/ggml/src/ggml-opencl/kernels/mul_mm_q4_k_f32_l4_lm.cl
|
|
+++ b/ggml/src/ggml-opencl/kernels/mul_mm_q4_k_f32_l4_lm.cl
|
|
@@ -90,7 +90,7 @@ kernel void kernel_mul_mm_q4_k_f32_l4_lm(
|
|
int is = 2 * n + b;
|
|
int qsi = n * 32 + (iqs % 16) * 2;
|
|
|
|
- char * scales = src0_s + ib * 12;
|
|
+ global uchar * scales = src0_s + ib * 12;
|
|
|
|
int scidx0 = (is < 4) ? is : (is + 4);
|
|
int scidx1 = (is < 4) ? is : (is - 4);
|
|
diff --git a/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl b/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl
|
|
index da2e14ae9..b293c73d6 100644
|
|
--- a/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl
|
|
+++ b/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl
|
|
@@ -180,10 +180,12 @@ kernel void kernel_mul_mat_f16_f32_l4_dr(
|
|
// Kernels for decoding, Adreno only for now
|
|
#define MUL_MAT_F16_F32_L4_DR_LS_R2_MAX 8
|
|
|
|
-#ifdef ADRENO_GPU
|
|
+#if defined(ADRENO_GPU) && defined(cl_qcom_subgroup_shuffle)
|
|
#pragma OPENCL EXTENSION cl_qcom_subgroup_shuffle : enable
|
|
#define sub_group_shuffle_xor(val, mask) qcom_sub_group_shuffle_xor((val), (mask), CLK_SUB_GROUP_SHUFFLE_WIDTH_WAVE_SIZE_QCOM, 0.0f)
|
|
+#endif
|
|
|
|
+#ifdef ADRENO_GPU
|
|
REQD_SUBGROUP_SIZE_64
|
|
kernel void kernel_mul_mat_f16_f32_l4_dr_ls(
|
|
global char * src0,
|
|
diff --git a/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32.cl b/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32.cl
|
|
index 71ab98982..64cff077f 100644
|
|
--- a/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32.cl
|
|
+++ b/ggml/src/ggml-opencl/kernels/mul_mv_q4_k_f32.cl
|
|
@@ -151,8 +151,8 @@ kernel void kernel_mul_mv_q4_K_f32(
|
|
acc2.s3 += yh[i+9] * (q2[i/2] & 0xF000);
|
|
}
|
|
|
|
- float dall = dh[0];
|
|
- float dmin = dh[1];
|
|
+ float dall = vload_half(0, dh);
|
|
+ float dmin = vload_half(1, dh);
|
|
sumf[row] += dall * ((acc1.s0 + 1.f/256.f * acc1.s1) * sc8[0] +
|
|
(acc1.s2 + 1.f/256.f * acc1.s3) * sc8[1] * 1.f/16.f +
|
|
(acc2.s0 + 1.f/256.f * acc2.s1) * sc8[4] +
|