Skip to content

cuda: remove linking to cublasLt #14790

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

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

yeahdongcn
Copy link
Collaborator

@yeahdongcn yeahdongcn commented Jul 21, 2025

Make sure to read the contributing guidelines before submitting a PR

The new MUSA SDK now includes mublasLt (the equivalent of cublasLt). However, I found that llama.cpp doesn't use any of the cublasLt* APIs. Therefore, this PR removes cublasLt from the build link dependencies.

# ldd /usr/local/lib/python3.12/dist-packages/nvidia/cublas/lib/libcublas.so.12
        linux-vdso.so.1 (0x00007ffc7b9d8000)
        libcublasLt.so.12 => /usr/local/lib/python3.12/dist-packages/nvidia/cublas/lib/libcublasLt.so.12 (0x00007fdf7cc00000)
        librt.so.1 => /usr/lib/x86_64-linux-gnu/librt.so.1 (0x00007fdfa1857000)
        libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdfa1852000)
        libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdfa184d000)
        libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007fdfa1764000)
        libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fdfa1744000)
        libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007fdf7c9d7000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fdfa1865000)

@github-actions github-actions bot added Nvidia GPU Issues specific to Nvidia GPUs ggml changes relating to the ggml tensor library for machine learning labels Jul 21, 2025
@yeahdongcn yeahdongcn marked this pull request as ready for review July 21, 2025 06:29
@slaren
Copy link
Member

slaren commented Jul 21, 2025

I am pretty sure that cublas depends on cublasLt, and building without it with the Makefile resulted in link errors. cmake adds the dependency automatically when linking to cublas, so removing it there is probably correct: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindCUDAToolkit.cmake#L1282. The Makefile is broken at this point, so I could not test it.

@yeahdongcn
Copy link
Collaborator Author

I am pretty sure that cublas depends on cublasLt, and building without it with the Makefile resulted in link errors. cmake adds the dependency automatically when linking to cublas, so removing it there is probably correct: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindCUDAToolkit.cmake#L1282. The Makefile is broken at this point, so I could not test it.

Let me revert the change to Makefile.

@yeahdongcn yeahdongcn force-pushed the cuda/remove_cublasLt branch from 28d7b3c to 02373a3 Compare July 21, 2025 10:25
Copy link
Collaborator

@JohannesGaessler JohannesGaessler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the CUDA documentation:

The cuBLASLt library is a new lightweight library dedicated to GEneral Matrix-to-matrix Multiply (GEMM) operations with a new flexible API.

We don't use cuBLASLt directly, but I guess they may be mapping the old cuBLAS API to cuBLASLt?

@yeahdongcn
Copy link
Collaborator Author

We don't use cuBLASLt directly, but I guess they may be mapping the old cuBLAS API to cuBLASLt?

In my understanding (though I’m not certain), cuBLAS might have a mechanism to automatically dispatch or fall back to cuBLASLt depending on the data types, memory layouts, or hardware.

@yeahdongcn yeahdongcn merged commit 48b86c4 into ggml-org:master Jul 21, 2025
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ggml changes relating to the ggml tensor library for machine learning Nvidia GPU Issues specific to Nvidia GPUs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants