Skip to content

Commit a68888a

Browse files
committed
Fall back to GPU_ARCHS for teh fp8 dtype when no GPU (build machine)
Signed-off-by: aurianer <[email protected]>
1 parent 03aa566 commit a68888a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎aiter/utility/dtypes.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import torch
66

7-
from ..jit.utils.chip_info import get_gfx_runtime
7+
from ..jit.utils.chip_info import get_gfx, get_gfx_runtime
88
from ..ops.enum import ActivationType, QuantType
99
from .aiter_types import aiter_dtypes, aiter_tensor_t
1010

@@ -25,7 +25,12 @@
2525

2626

2727
def get_dtype_fp8():
28-
return defaultDtypes.get(get_gfx_runtime(), {"fp8": _8bit_fallback})["fp8"]
28+
try:
29+
gfx = get_gfx_runtime()
30+
except RuntimeError:
31+
# No GPU visible (e.g. image build): use the GPU_ARCHS build target instead.
32+
gfx = get_gfx()
33+
return defaultDtypes.get(gfx, {"fp8": _8bit_fallback})["fp8"]
2934

3035

3136
i4x2 = getattr(torch, "int4", _8bit_fallback)

0 commit comments

Comments
 (0)