Skip to content

Add Adreno GPU support #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 28 commits into from
Closed

Add Adreno GPU support #17

wants to merge 28 commits into from

Conversation

lhez
Copy link
Collaborator

@lhez lhez commented Nov 25, 2024

Add new OpenCL backend to support Adreno GPUs


@sparkleholic
Copy link

sparkleholic commented Dec 18, 2024

@lhez It looks a nice feature for qualcomm SoCs.
I've tested this on QCS8550(Adreno 740), and faced the following issue. (It might be a problem dependent on gpu driver.)
1st (Due to the different gpu device name, ignored gpu acceleration)

ggml_opencl: selecting platform: 'QUALCOMM Snapdragon(TM)'
ggml_opencl: selecting device: 'QUALCOMM '

So, tested with the following change.

// ggml/src/ggml-opencl/ggml-opencl.cpp
-    if (strstr(default_device->name, "Adreno")) {
+    if (strstr(default_device->name, "Adreno") || strstr(default_device->name, "QUALCOMM")) {

2nd (runtime error)

llama-cli -m /mnt/sdcard/models/Qwen1.5-7B-Chat-Q4_0.gguf -b 128
  -p "Explain LG." -ngl 20
ggml_opencl: selecting platform: 'QUALCOMM Snapdragon(TM)'
ggml_opencl: selecting device: 'QUALCOMM '
ggml_opencl: Unsupported Adreno GPU: , using wave size 128, may not work as expected
ggml_opencl: device OpenCL version: OpenCL 3.0 
ggml_opencl: OpenCL driver: OpenCL 3.0 QUALCOMM build: commit unknown Compiler E031.42.20.00
ggml_opencl: vector subgroup broadcast support: false
ggml_opencl: device FP16 support: true
ggml_opencl: mem base addr align: 1024
ggml_opencl: max mem alloc size: 256 MB
ggml_opencl: SVM coarse grain buffer support: true
ggml_opencl: SVM fine grain buffer support: true
ggml_opencl: SVM fine grain system support: false
ggml_opencl: SVM atomics support: true
ggml_opencl: flattening quantized weights representation as struct of arrays (GGML_OPENCL_SOA_Q)
ggml_opencl: using kernels optimized for Adreno (GGML_OPENCL_USE_ADRENO_KERNELS)
ggml_opencl: (backend_ctx->A_q_d_max = clCreateBuffer(context, 0, max_A_q_d_bytes, NULL, &err), err) error -61 at /usr/src/debug/llama-cpp-adreno/1.0-r0/git/ggml/src/ggml-opencl/ggml-opencl.cpp:803
/usr/src/debug/llama-cpp-adreno/1.0-r0/git/ggml/src/ggml-opencl/ggml-opencl.cpp:803: GGML_ASSERT(0) failed
[New LWP 3809968]
warning: Unable to determine the number of hardware watchpoints available.
warning: Unable to determine the number of hardware breakpoints available.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
0x0000007f8b26a558 in __GI___wait4 (pid=3809976, stat_loc=0x7fe7fb8468, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
30	../sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
#0  0x0000007f8b26a558 in __GI___wait4 (pid=3809976, stat_loc=0x7fe7fb8468, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
30	in ../sysdeps/unix/sysv/linux/wait4.c
#1  0x00000055745b2cf8 [PAC] in ?? ()
#2  0x00000055745addec [PAC] in ?? ()
#3  0x00000055745af0e8 [PAC] in ?? ()
#4  0x00000055745af514 [PAC] in ?? ()
#5  0x000000557456ab00 [PAC] in ?? ()
#6  0x000000557456b3b4 [PAC] in ?? ()
#7  0x00000055744bb2e0 [PAC] in ?? ()
#8  0x0000005574454038 [PAC] in ?? ()
#9  0x000000557445b2cc [PAC] in ?? ()
#10 0x0000005574433988 [PAC] in ?? ()
#11 0x0000007f8b1db4b0 [PAC] in __libc_start_call_main (main=main@entry=0x5574433910, argc=argc@entry=9, argv=argv@entry=0x7fe7fbe4d8) at ../sysdeps/nptl/libc_start_call_main.h:58
58	../sysdeps/nptl/libc_start_call_main.h: No such file or directory.
#12 0x0000007f8b1db58c [PAC] in __libc_start_main_impl (main=0x5574433910, argc=9, argv=0x7fe7fbe4d8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:389
389	../csu/libc-start.c: No such file or directory.
#13 0x000000557443e570 [PAC] in ?? ()
[Inferior 1 (process 3809967) detached]
Aborted (core dumped)

@contra-bit
Copy link

I have rebased the this branch onto the current llama.cpp master. Everthing works for on the T14s Gen6 Qualcom under linux. If anytests are required please ping me. I hope this gets merged soon

@lhez
Copy link
Collaborator Author

lhez commented Feb 6, 2025

I have rebased the this branch onto the current llama.cpp master. Everthing works for on the T14s Gen6 Qualcom under linux. If anytests are required please ping me. I hope this gets merged soon

@contra-bit Thank you for testing it out. This has already been merged upstream.

@lhez
Copy link
Collaborator Author

lhez commented Feb 6, 2025

@lhez It looks a nice feature for qualcomm SoCs. I've tested this on QCS8550(Adreno 740), and faced the following issue. (It might be a problem dependent on gpu driver.) 1st (Due to the different gpu device name, ignored gpu acceleration)

ggml_opencl: selecting platform: 'QUALCOMM Snapdragon(TM)'
ggml_opencl: selecting device: 'QUALCOMM '

So, tested with the following change.

// ggml/src/ggml-opencl/ggml-opencl.cpp
-    if (strstr(default_device->name, "Adreno")) {
+    if (strstr(default_device->name, "Adreno") || strstr(default_device->name, "QUALCOMM")) {

2nd (runtime error)

llama-cli -m /mnt/sdcard/models/Qwen1.5-7B-Chat-Q4_0.gguf -b 128
  -p "Explain LG." -ngl 20
ggml_opencl: selecting platform: 'QUALCOMM Snapdragon(TM)'
ggml_opencl: selecting device: 'QUALCOMM '
ggml_opencl: Unsupported Adreno GPU: , using wave size 128, may not work as expected
ggml_opencl: device OpenCL version: OpenCL 3.0 
ggml_opencl: OpenCL driver: OpenCL 3.0 QUALCOMM build: commit unknown Compiler E031.42.20.00
ggml_opencl: vector subgroup broadcast support: false
ggml_opencl: device FP16 support: true
ggml_opencl: mem base addr align: 1024
ggml_opencl: max mem alloc size: 256 MB
ggml_opencl: SVM coarse grain buffer support: true
ggml_opencl: SVM fine grain buffer support: true
ggml_opencl: SVM fine grain system support: false
ggml_opencl: SVM atomics support: true
ggml_opencl: flattening quantized weights representation as struct of arrays (GGML_OPENCL_SOA_Q)
ggml_opencl: using kernels optimized for Adreno (GGML_OPENCL_USE_ADRENO_KERNELS)
ggml_opencl: (backend_ctx->A_q_d_max = clCreateBuffer(context, 0, max_A_q_d_bytes, NULL, &err), err) error -61 at /usr/src/debug/llama-cpp-adreno/1.0-r0/git/ggml/src/ggml-opencl/ggml-opencl.cpp:803
/usr/src/debug/llama-cpp-adreno/1.0-r0/git/ggml/src/ggml-opencl/ggml-opencl.cpp:803: GGML_ASSERT(0) failed
[New LWP 3809968]
warning: Unable to determine the number of hardware watchpoints available.
warning: Unable to determine the number of hardware breakpoints available.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
0x0000007f8b26a558 in __GI___wait4 (pid=3809976, stat_loc=0x7fe7fb8468, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
30	../sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
#0  0x0000007f8b26a558 in __GI___wait4 (pid=3809976, stat_loc=0x7fe7fb8468, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
30	in ../sysdeps/unix/sysv/linux/wait4.c
#1  0x00000055745b2cf8 [PAC] in ?? ()
#2  0x00000055745addec [PAC] in ?? ()
#3  0x00000055745af0e8 [PAC] in ?? ()
#4  0x00000055745af514 [PAC] in ?? ()
#5  0x000000557456ab00 [PAC] in ?? ()
#6  0x000000557456b3b4 [PAC] in ?? ()
#7  0x00000055744bb2e0 [PAC] in ?? ()
#8  0x0000005574454038 [PAC] in ?? ()
#9  0x000000557445b2cc [PAC] in ?? ()
#10 0x0000005574433988 [PAC] in ?? ()
#11 0x0000007f8b1db4b0 [PAC] in __libc_start_call_main (main=main@entry=0x5574433910, argc=argc@entry=9, argv=argv@entry=0x7fe7fbe4d8) at ../sysdeps/nptl/libc_start_call_main.h:58
58	../sysdeps/nptl/libc_start_call_main.h: No such file or directory.
#12 0x0000007f8b1db58c [PAC] in __libc_start_main_impl (main=0x5574433910, argc=9, argv=0x7fe7fbe4d8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:389
389	../csu/libc-start.c: No such file or directory.
#13 0x000000557443e570 [PAC] in ?? ()
[Inferior 1 (process 3809967) detached]
Aborted (core dumped)

@sparkleholic Sorry for missing this. I didn't seem to receive notification about this. Did you use a commercial device or a development board (or a testing device)?

@lhez lhez marked this pull request as draft February 6, 2025 06:27
@lhez
Copy link
Collaborator Author

lhez commented Feb 14, 2025

Merged upstream.

@lhez lhez closed this Feb 14, 2025
@sparkleholic
Copy link

sparkleholic commented Mar 28, 2025

@lhez <
I didn't get a notice as well.
I've just tested again via the latest llama.cpp complied with GGML_OPENCL=ON, ran on QCS8550 installed hlos.
And it crashed on the following step.
https://github.com/ggml-org/llama.cpp/blob/master/ggml/src/ggml-opencl/ggml-opencl.cpp#L929

    size_t max_A_q_d_bytes = 311164928;
    size_t max_A_s_d_bytes = 38895616;
    size_t max_B_d_bytes = 45088768;

    CL_CHECK((backend_ctx->A_q_d_max = clCreateBuffer(context, 0, max_A_q_d_bytes, NULL, &err), err));

Hence I've check the OpenCL info on QCS8550.

Number of platforms                               1
  Platform Name                                   QUALCOMM Snapdragon(TM)
  Platform Vendor                                 QUALCOMM
  Platform Version                                OpenCL 3.0 QUALCOMM build: commit unknown
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions with Version                cl_khr_icd                                                       0xc00000 (3.0.0)
  Platform Numeric Version                        0xc00000 (3.0.0)
  Platform Extensions function suffix             QCOM
  Platform Host timer resolution                  0ns

  Platform Name                                   QUALCOMM Snapdragon(TM)
Number of devices                                 1
  Device Name                                     QUALCOMM Adreno(TM) 740
  Device Vendor                                   QUALCOMM
  Device Vendor ID                                0x5143
  Device Version                                  OpenCL 3.0 Adreno(TM) 740
  Device Numeric Version                          0xc00000 (3.0.0)
  Driver Version                                  OpenCL 3.0 QUALCOMM build: commit unknown Compiler E031.42.20.00
  Device OpenCL C Version                         OpenCL C 3.0 Adreno(TM) 740
  Device OpenCL C all versions                    OpenCL C                                                         0xc00000 (3.0.0)
                                                  OpenCL C                                                         0x800000 (2.0.0)
                                                  OpenCL C                                                         0x402000 (1.2.0)
                                                  OpenCL C                                                         0x401000 (1.1.0)
                                                  OpenCL C                                                         0x400000 (1.0.0)
  Device OpenCL C features                        __opencl_c_3d_image_writes                                       0xc00000 (3.0.0)
                                                  __opencl_c_atomic_order_acq_rel                                  0xc00000 (3.0.0)
                                                  __opencl_c_atomic_order_seq_cst                                  0xc00000 (3.0.0)
                                                  __opencl_c_atomic_scope_device                                   0xc00000 (3.0.0)
                                                  __opencl_c_atomic_scope_all_devices                              0xc00000 (3.0.0)
                                                  __opencl_c_device_enqueue                                        0xc00000 (3.0.0)
                                                  __opencl_c_generic_address_space                                 0xc00000 (3.0.0)
                                                  __opencl_c_images                                                0xc00000 (3.0.0)
                                                  __opencl_c_int64                                                 0xc00000 (3.0.0)
                                                  __opencl_c_pipes                                                 0xc00000 (3.0.0)
                                                  __opencl_c_program_scope_global_variables                        0xc00000 (3.0.0)
                                                  __opencl_c_read_write_images                                     0xc00000 (3.0.0)
                                                  __opencl_c_subgroups                                             0xc00000 (3.0.0)
                                                  __opencl_c_work_group_collective_functions                       0xc00000 (3.0.0)
                                                  __opencl_c_integer_dot_product_input_4x8bit                      0xc00000 (3.0.0)
                                                  __opencl_c_integer_dot_product_input_4x8bit_packed               0xc00000 (3.0.0)
  Latest comfornace test passed                   v2022-11-15-03
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               6
  Max clock frequency                             1MHz
  Device Partition                                (core)
    Max number of sub-devices                     1
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             1024
  Preferred work group size multiple (device)     64
  Preferred work group size multiple (kernel)     128
  Max sub-groups per work group                   16
  Preferred / native vector sizes                 
    char                                                 1 / 1       
    short                                                1 / 1       
    int                                                  1 / 1       
    long                                                 1 / 0       
    half                                                 1 / 1        (cl_khr_fp16)
    float                                                1 / 1       
    double                                               0 / 0        (n/a)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (n/a)
  Address bits                                    64, Little-Endian
  Global memory size                              1073741824 (1024MiB)
  Error Correction support                        No
  Max memory allocation                           268435456 (256MiB)
  Unified memory for Host and Device              Yes
  Shared Virtual Memory (SVM) capabilities        (core)
    Coarse-grained buffer sharing                 Yes
    Fine-grained buffer sharing                   Yes
    Fine-grained system sharing                   No
    Atomics                                       Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Page size (QCOM)                                4096 bytes
  External memory padding (QCOM)                  0 bytes
  Preferred alignment for atomics                 
    SVM                                           128 bytes
    Global                                        0 bytes
    Local                                         0 bytes
  Atomic memory capabilities                      relaxed, acquire/release, sequentially-consistent, work-item scope, work-group scope, device scope, all-devices scope
  Atomic fence capabilities                       relaxed, acquire/release, sequentially-consistent, work-item scope, work-group scope, device scope, all-devices scope
  Max size for global variable                    65536 (64KiB)
  Preferred total size of global vars             1048576 (1024KiB)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        1048576 (1024KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            134217728 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   64 bytes
    Pitch alignment for 2D image buffers          64 pixels
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             16384x16384x2048 pixels
    Max number of read image args                 128
    Max number of write image args                64
    Max number of read/write image args           64
  Pipe support                                    Yes
  Max number of pipe args                         16
  Max active pipe reservations                    12288
  Max pipe packet size                            1024
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Max number of constant args                     8
  Max constant buffer size                        65536 (64KiB)
  Generic address space support                   Yes
  Max size of kernel argument                     1024
  Queue properties (on host)                      
    Out-of-order execution                        Yes
    Profiling                                     Yes
  Device enqueue capabilities                     supported
  Queue properties (on device)                    
    Out-of-order execution                        Yes
    Profiling                                     Yes
    Preferred size                                655376 (640KiB)
    Max size                                      655376 (640KiB)
  Max queues on device                            1
  Max events on device                            1024
  Prefer user sync for interop                    No
  Profiling timer resolution                      1000ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
    Non-uniform work-groups                       Yes
    Work-group collective functions               Yes
    Sub-group independent forward progress        Yes
    IL version                                    (n/a)
    ILs with version                              (n/a)
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                (n/a)
  Built-in kernels with version                   (n/a)
  Device Extensions                               cl_ext_image_from_buffer cl_ext_image_requirements_info cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_egl_event cl_khr_egl_image cl_khr_fp16 cl_khr_gl_sharing cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_image2d_from_buffer cl_khr_integer_dot_product cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_mipmap_image cl_khr_srgb_image_writes cl_khr_subgroups cl_qcom_accelerated_image_ops cl_qcom_bfloat16_product cl_qcom_bitreverse cl_qcom_compressed_image cl_qcom_create_buffer_from_image cl_qcom_dmabuf_host_ptr cl_qcom_dot_product8 cl_qcom_ext_host_ptr cl_qcom_ext_host_ptr_iocoherent cl_qcom_extended_query_image_info cl_qcom_extract_image_plane cl_qcom_filter_bicubic cl_qcom_ml_ops cl_qcom_other_image cl_qcom_perf_hint cl_qcom_priority_hint cl_qcom_protected_context cl_qcom_recordable_queues cl_qcom_reqd_sub_group_size cl_qcom_subgroup_shuffle cl_qcom_vector_image_ops cl_qcom_onchip_global_memory cl_qcom_large_buffer 
  Device Extensions with Version                  cl_ext_image_from_buffer                                         0x400000 (1.0.0)
                                                  cl_ext_image_requirements_info                                   0x400000 (1.0.0)
                                                  cl_khr_3d_image_writes                                           0x400000 (1.0.0)
                                                  cl_khr_byte_addressable_store                                    0x400000 (1.0.0)
                                                  cl_khr_depth_images                                              0x400000 (1.0.0)
                                                  cl_khr_egl_event                                                 0x400000 (1.0.0)
                                                  cl_khr_egl_image                                                 0x400000 (1.0.0)
                                                  cl_khr_fp16                                                      0x400000 (1.0.0)
                                                  cl_khr_gl_sharing                                                0x400000 (1.0.0)
                                                  cl_khr_global_int32_base_atomics                                 0x400000 (1.0.0)
                                                  cl_khr_global_int32_extended_atomics                             0x400000 (1.0.0)
                                                  cl_khr_image2d_from_buffer                                       0x400000 (1.0.0)
                                                  cl_khr_integer_dot_product                                       0x400000 (1.0.0)
                                                  cl_khr_local_int32_base_atomics                                  0x400000 (1.0.0)
                                                  cl_khr_local_int32_extended_atomics                              0x400000 (1.0.0)
                                                  cl_khr_mipmap_image                                              0x400000 (1.0.0)
                                                  cl_khr_srgb_image_writes                                         0x400000 (1.0.0)
                                                  cl_khr_subgroups                                                 0x400000 (1.0.0)
                                                  cl_qcom_accelerated_image_ops                                    0x400008 (1.0.8)
                                                  cl_qcom_bfloat16_product                                         0x400000 (1.0.0)
                                                  cl_qcom_bitreverse                                               0x400001 (1.0.1)
                                                  cl_qcom_compressed_image                                         0x400003 (1.0.3)
                                                  cl_qcom_create_buffer_from_image                                 0x400007 (1.0.7)
                                                  cl_qcom_dmabuf_host_ptr                                          0x400000 (1.0.0)
                                                  cl_qcom_dot_product8                                             0x401001 (1.1.1)
                                                  cl_qcom_ext_host_ptr                                             0x400005 (1.0.5)
                                                  cl_qcom_ext_host_ptr_iocoherent                                  0x400004 (1.0.4)
                                                  cl_qcom_extended_query_image_info                                0x400000 (1.0.0)
                                                  cl_qcom_extract_image_plane                                      0x400005 (1.0.5)
                                                  cl_qcom_filter_bicubic                                           0x400000 (1.0.0)
                                                  cl_qcom_ml_ops                                                   0x400001 (1.0.1)
                                                  cl_qcom_other_image                                              0x400006 (1.0.6)
                                                  cl_qcom_perf_hint                                                0x400004 (1.0.4)
                                                  cl_qcom_priority_hint                                            0x400005 (1.0.5)
                                                  cl_qcom_protected_context                                        0x400005 (1.0.5)
                                                  cl_qcom_recordable_queues                                        0x400001 (1.0.1)
                                                  cl_qcom_reqd_sub_group_size                                      0x400001 (1.0.1)
                                                  cl_qcom_subgroup_shuffle                                         0x400006 (1.0.6)
                                                  cl_qcom_vector_image_ops                                         0x400009 (1.0.9)
                                                  cl_qcom_onchip_global_memory                                     0x400000 (1.0.0)
                                                  cl_qcom_large_buffer                                             0x400000 (1.0.0)

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              Success [QCOM]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 QUALCOMM Snapdragon(TM)
    Device Name                                   QUALCOMM Adreno(TM) 740
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 QUALCOMM Snapdragon(TM)
    Device Name                                   QUALCOMM Adreno(TM) 740
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  Invalid device type for platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 QUALCOMM Snapdragon(TM)
    Device Name                                   QUALCOMM Adreno(TM) 740

ICD loader properties
  ICD loader Name                                 Khronos OpenCL ICD Loader
  ICD loader Vendor                               Khronos Group
  ICD loader Version                              OPENCL_ICD_LOADER_VERSION_MAJOR.OPENCL_ICD_LOADER_VERSION_MINOR.OPENCL_ICD_LOADER_VERSION_REV
  ICD loader Profile                              OpenCL 3.0

I suspect the following hard-coded size might be the cause.
https://github.com/ggml-org/llama.cpp/blob/5d01670266859444366e4f333ade5e0e5e2ae63d/ggml/src/ggml-opencl/ggml-opencl.cpp#L925

size_t max_A_q_d_bytes = 311164928;

Because of the following resource limitations.

  Max memory allocation                           268435456 (256MiB)

I've just verified it's working well by reducing the allocation size not exceeding 256MB.
Thanks! 👍

sparkleholic added a commit to sparkleholic/llama.cpp that referenced this pull request Mar 30, 2025
issue:
CodeLinaro#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
max-krasnyansky pushed a commit to ggml-org/llama.cpp that referenced this pull request Apr 1, 2025
issue:
CodeLinaro#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
ggerganov pushed a commit to ggml-org/ggml that referenced this pull request Apr 2, 2025
issue:
CodeLinaro/llama.cpp#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
ggerganov pushed a commit to ggml-org/ggml that referenced this pull request Apr 2, 2025
issue:
CodeLinaro/llama.cpp#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
ggerganov pushed a commit to ggml-org/whisper.cpp that referenced this pull request Apr 2, 2025
issue:
CodeLinaro/llama.cpp#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
ggerganov pushed a commit to ggml-org/whisper.cpp that referenced this pull request Apr 2, 2025
issue:
CodeLinaro/llama.cpp#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
Erick-0923 pushed a commit to Erick-0923/llama.cpp that referenced this pull request May 30, 2025
issue:
CodeLinaro/llama.cpp#17 (comment)

This patch fixes the memory allocation size
not exceeding the maximum size of the OpenCL device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants