Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions bitsandbytes/backends/triton/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

from . import kernels_4bit, kernels_8bit_quant, kernels_optim

# currently codes unused, kept for reference
# Should be the same for quant/dequant
# from bitsandbytes.functional import get_4bit_type
# _FP4_QUANT_TABLE = get_4bit_type("fp4", device="xpu")
# _NF4_QUANT_TABLE = get_4bit_type("nf4", device="xpu")
device_type = torch.accelerator.current_accelerator().type if hasattr(torch, "accelerator") else "cuda"
torch_accelerator_module = getattr(torch, device_type, torch.cuda)

Expand Down
50 changes: 0 additions & 50 deletions bitsandbytes/backends/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,6 @@
triton_available = False


_NF4_QUANT_TABLE = torch.tensor(
[
-1.0,
-0.6961928009986877,
-0.5250730514526367,
-0.39491748809814453,
-0.28444138169288635,
-0.18477343022823334,
-0.09105003625154495,
0.0,
0.07958029955625534,
0.16093020141124725,
0.24611230194568634,
0.33791524171829224,
0.44070982933044434,
0.5626170039176941,
0.7229568362236023,
1.0,
],
dtype=torch.float32,
device="xpu"
if hasattr(torch, "xpu") and torch.xpu.is_available()
else "cpu", # Only cpu/xpu use this table for now.
)
_FP4_QUANT_TABLE = torch.tensor(
[
0.0000,
0.0052,
0.6667,
1.0000,
0.3333,
0.5000,
0.1667,
0.2500,
0.0000,
-0.0052,
-0.6667,
-1.0000,
-0.3333,
-0.5000,
-0.1667,
-0.2500,
],
dtype=torch.float32,
device="xpu"
if hasattr(torch, "xpu") and torch.xpu.is_available()
else "cpu", # Only cpu/xpu use this table for now.
)
CODE = {"nf4": _NF4_QUANT_TABLE, "fp4": _FP4_QUANT_TABLE}

# Cache 4-bit dequantization code tensors per (quant_type, device).
_code_4bit_cache: dict[tuple[str, torch.device], torch.Tensor] = {}

Expand Down