Skip to content
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

Add cmake option to build without CUDA VMM #6889

Closed
WilliamTambellini opened this issue Apr 25, 2024 · 1 comment
Closed

Add cmake option to build without CUDA VMM #6889

WilliamTambellini opened this issue Apr 25, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@WilliamTambellini
Copy link
Contributor

WilliamTambellini commented Apr 25, 2024

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [X ] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • [X ] I carefully followed the README.md.
  • [X ] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [X ] I reviewed the Discussions, and have a new bug or useful enhancement to share.

Feature Description

As today ggml-cuda.cu tries to take advantage of cuda VMM if possible:

CUdevice device;

This is not necessarilly possible/desired eg:
https://forums.developer.nvidia.com/t/potential-nvshmem-allocated-memory-performance-issue/275416/4

Would you mind if I add a cmake/make option/define in order to build ggml-cuda with(default) or without VMM support ?

Best
WT

Motivation

In order to build llamacpp/ggml without vmm.

Possible Implementation

Adding a cmake arg 'GGML_USE_CUDA_VMM' (default ON)
and then line 115:

#if !defined(GGML_USE_HIPBLAS) && defined(GGML_USE_CUDA_VMM)
        CUdevice device;
        CU_CHECK(cuDeviceGet(&device, id));
        CU_CHECK(cuDeviceGetAttribute(&device_vmm, CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED, device));
     ...
@WilliamTambellini WilliamTambellini added the enhancement New feature or request label Apr 25, 2024
@slaren
Copy link
Collaborator

slaren commented Apr 25, 2024

Feel free to open a PR if this is useful for you, I never was able to measure a performance difference. However, make the flag negative so that it is still enabled without additional compilation flags, and use the GGML_CUDA prefix (eg. something like GGML_CUDA_NO_VMM).

WilliamTambellini added a commit to WilliamTambellini/llama.cpp that referenced this issue May 4, 2024
WilliamTambellini added a commit to WilliamTambellini/llama.cpp that referenced this issue May 6, 2024
@slaren slaren closed this as completed in 858f6b7 May 6, 2024
github-actions bot pushed a commit to KerfuffleV2/ggml-sys-bleedingedge that referenced this issue May 7, 2024
== Relevant log messages from source repo:

commit 858f6b73f6e57a62523d16a955d565254be889b4
Author: William Tambellini <william.tambellini@gmail.com>
Date:   Mon May 6 11:12:14 2024 -0700

    Add an option to build without CUDA VMM (#7067)

    Add an option to build ggml cuda without CUDA VMM
    resolves
    ggerganov/llama.cpp#6889
    https://forums.developer.nvidia.com/t/potential-nvshmem-allocated-memory-performance-issue/275416/4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants