Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Use naive decompress for SM<8.0 #32

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions vllm/model_executor/layers/sparsity/sparse_w16a16.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,36 @@

import torch

from vllm.logger import init_logger
from vllm.model_executor.layers.sparsity.base_config import SparsityConfig

from .sparse_w16a16_linear_method import SparseW16A16LinearMethod
from magic_wand import (CompressedStorageFormat, SparseBEGemmStorageFormat)
from magic_wand import (CompressedStorageFormat, SparseBitmaskStorageFormat,
SparseBEGemmStorageFormat)

logger = init_logger(__name__)

class SparseW16A16Config(SparsityConfig):
"""Config class for SparseW16A16.

TODO: Add based on need
"""
class SparseW16A16Config(SparsityConfig):
"""Config class for SparseW16A16."""

def __init__(self) -> None:
# TODO: Add new configs here
pass

def __repr__(self) -> str:
return "SparseW16A16Config()"

@classmethod
def get_storage_format_cls(cls) -> Type[CompressedStorageFormat]:
return SparseBEGemmStorageFormat
cuda_compute_capability = torch.cuda.get_device_capability()
if cuda_compute_capability >= (8, 0):
return SparseBEGemmStorageFormat
else:
# For NVIDIA SM < 8.0
logger.warning("Unstructured sparse kernels are not optimized for "
"NVIDIA SM < 8.0. Naive decompress kernels will be "
"used and can be slower than dense models")
return SparseBitmaskStorageFormat

@classmethod
def get_name(cls) -> str:
Expand All @@ -35,8 +43,7 @@ def get_supported_act_dtypes(cls) -> List[torch.dtype]:

@classmethod
def get_min_capability(cls) -> int:
# TODO: Update after checks on more GPUs
return 80
return 70

@classmethod
def get_config_filenames(cls) -> List[str]:
Expand Down
Loading