Skip to content

Conversation

Lzy17
Copy link

@Lzy17 Lzy17 commented Nov 4, 2024

Replace the cuda specs with a more general gpu specs that supports both rocm and cuda

@Lzy17 Lzy17 changed the base branch from main to rocm_enabled_multi_backend November 4, 2024 15:43
@Lzy17 Lzy17 requested review from lcskrishna and pnunna93 November 8, 2024 20:22
from .base import Backend

if lib and lib.compiled_with_cuda:
if lib and lib.compiled_with_gpu:
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are only for cuda and rocm as of now, may be use BNB_BACKEND from cextension instead?

Get the disk path to the CUDA BNB native library specified by the
given CUDA specs, taking into account the `BNB_CUDA_VERSION` override environment variable.
Get the disk path to the GPU BNB native library specified by the
given GPU specs, taking into account the `BNB_GPU_VERSION` override environment variable.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Leave env var as BNB_CUDA_VERSION and mention 'for cuda'

library_name += "_nocublaslt"
library_name = f"{library_name}{DYNAMIC_LIBRARY_SUFFIX}"

# Do I need to change it to BNB_GPU_VERSION here? IGNORE FOR NOW!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this comment


# Do I need to change it to BNB_GPU_VERSION here? IGNORE FOR NOW!
override_value = os.environ.get("BNB_CUDA_VERSION")
if override_value:
Copy link
Collaborator

Choose a reason for hiding this comment

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

add condition for cuda backend

def find_cudart_libraries() -> Iterator[Path]:
def find_gpu_rt_libraries() -> Iterator[Path]:
"""
Searches for a cuda installations, in the following order of priority:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make this comment generic for gpu backend

print_header("OTHER")
cuda_specs = get_cuda_specs()
gpu_specs = get_gpu_specs()
if HIP_ENVIRONMENT:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Refactor the code to print gpu specs directly

name2qmap = {}

if lib and lib.compiled_with_cuda:
if lib and lib.compiled_with_gpu:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change this to BNB_BACKEND cuda and rocm

import re
import subprocess
from typing import List, Optional, Tuple
from typing import Optional, Tuple, Union
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we remove Union if its not used anymore?

cuda_version_string="120",
def cuda120_spec() -> GPUSpecs:
return GPUSpecs(
backend_version_string="120",
Copy link
Collaborator

Choose a reason for hiding this comment

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

set gpu_backend here

return CUDASpecs(
cuda_version_string="111",
def cuda111_noblas_spec() -> GPUSpecs:
return GPUSpecs(
Copy link
Collaborator

Choose a reason for hiding this comment

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

set gpu_backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants