Skip to content
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
11 changes: 9 additions & 2 deletions bitsandbytes/backends/hpu/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@

import torch

from bitsandbytes.utils import _reverse_4bit_compress_format

from ..._ops import register_kernel
from ..utils import GAUDI_SW_VER


# convert btw standard 4-bit compression format and ipex compression format
# needed for backward compatibility with older versions of gaudi sw
def _reverse_4bit_compress_format(weight: torch.Tensor):
out_1 = (weight & 0xF0) >> 4
out_2 = (weight & 0xF) << 4
out = out_1 | out_2
return out


@register_kernel("bitsandbytes::dequantize_4bit", "hpu")
def _(
A: torch.Tensor,
Expand Down
Loading