@@ -73,6 +73,16 @@ struct ggml_cl_compiler_version {
73
73
int major = -1 ;
74
74
int minor = -1 ;
75
75
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
+ }
76
86
};
77
87
78
88
// 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
633
643
// mul_mv_q4_0_f32_1d_8x_flat
634
644
// This kernel does not compiler on Adreno cl compiler 38.01. Skip it for
635
645
// 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 ) ) {
637
647
#ifdef GGML_OPENCL_EMBED_KERNELS
638
648
const std::string kernel_src {
639
649
#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
651
661
// mul_mv_q4_0_f32_1d_16x_flat
652
662
// This kernel does not compiler on Adreno cl compiler 38.01. Skip it for
653
663
// 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 ) ) {
655
665
#ifdef GGML_OPENCL_EMBED_KERNELS
656
666
const std::string kernel_src {
657
667
#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
1973
1983
inline bool use_adreno_kernels (const ggml_backend_opencl_context *backend_ctx, const ggml_tensor *tensor) {
1974
1984
int64_t threshold_ne0 = 512 ;
1975
1985
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 ) ) {
1977
1987
threshold_ne0 = 128 ;
1978
1988
threshold_ne1 = 128 ;
1979
1989
}
0 commit comments