@@ -73,6 +73,16 @@ struct ggml_cl_compiler_version {
7373 int major = -1 ;
7474 int minor = -1 ;
7575 int patch = -1 ;
76+
77+ bool same (int x, int y, int z) const {
78+ return major == x && minor == y && patch == z;
79+ }
80+ bool newer_than (int x, int y, int z) const {
81+ return major*10000 + minor*100 + patch > x*10000 + y*100 + z;
82+ }
83+ bool newer_than_or_same (int x, int y, int z) const {
84+ return same (x, y, z) || newer_than (x, y, z);
85+ }
7686};
7787
7888// Parses a version string of form "XX.YY ". On an error returns ggml_cl_version with all zeroes.
@@ -633,7 +643,7 @@ static void load_cl_kernels(ggml_backend_opencl_context *backend_ctx, ggml_cl_ve
633643 // mul_mv_q4_0_f32_1d_8x_flat
634644 // This kernel does not compiler on Adreno cl compiler 38.01. Skip it for
635645 // those compiler versions since it is anyway not used for Adreno.
636- if (backend_ctx->gpu_family != ADRENO || backend_ctx->adreno_cl_compiler_version .major > 38 ) {
646+ if (backend_ctx->gpu_family != ADRENO || backend_ctx->adreno_cl_compiler_version .newer_than_or_same ( 38 , 11 , 0 ) ) {
637647#ifdef GGML_OPENCL_EMBED_KERNELS
638648 const std::string kernel_src {
639649 #include " mul_mv_q4_0_f32_1d_8x_flat.cl.h"
@@ -651,7 +661,7 @@ static void load_cl_kernels(ggml_backend_opencl_context *backend_ctx, ggml_cl_ve
651661 // mul_mv_q4_0_f32_1d_16x_flat
652662 // This kernel does not compiler on Adreno cl compiler 38.01. Skip it for
653663 // those compiler versions since it is anyway not used for Adreno.
654- if (backend_ctx->gpu_family != ADRENO || backend_ctx->adreno_cl_compiler_version .major > 38 ) {
664+ if (backend_ctx->gpu_family != ADRENO || backend_ctx->adreno_cl_compiler_version .newer_than_or_same ( 38 , 11 , 0 ) ) {
655665#ifdef GGML_OPENCL_EMBED_KERNELS
656666 const std::string kernel_src {
657667 #include " mul_mv_q4_0_f32_1d_16x_flat.cl.h"
@@ -1973,7 +1983,7 @@ static enum ggml_status ggml_backend_opencl_buffer_init_tensor(ggml_backend_buff
19731983inline bool use_adreno_kernels (const ggml_backend_opencl_context *backend_ctx, const ggml_tensor *tensor) {
19741984 int64_t threshold_ne0 = 512 ;
19751985 int64_t threshold_ne1 = 512 ;
1976- if (backend_ctx->adreno_cl_compiler_version .major <= 38 ) {
1986+ if (! backend_ctx->adreno_cl_compiler_version .newer_than_or_same ( 38 , 11 , 0 ) ) {
19771987 threshold_ne0 = 128 ;
19781988 threshold_ne1 = 128 ;
19791989 }
0 commit comments