forked from deepspeedai/DeepSpeed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquantizer.py
35 lines (26 loc) · 958 Bytes
/
quantizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0
# DeepSpeed Team
from .builder import CUDAOpBuilder
class QuantizerBuilder(CUDAOpBuilder):
BUILD_VAR = "DS_BUILD_QUANTIZER"
NAME = "quantizer"
def __init__(self, name=None):
name = self.NAME if name is None else name
super().__init__(name=name)
def absolute_name(self):
return f'deepspeed.ops.quantizer.{self.NAME}_op'
def sources(self):
return [
'csrc/quantization/pt_binding.cpp',
'csrc/quantization/fake_quantizer.cu',
'csrc/quantization/quantize.cu',
'csrc/quantization/quantize_int4.cu',
'csrc/quantization/dequantize.cu',
'csrc/quantization/swizzled_quantize.cu',
'csrc/quantization/quant_reduce.cu',
]
def include_paths(self):
return ['csrc/includes']
def extra_ldflags(self):
return ['-lcurand']