quantizer.py 709 B

123456789101112131415161718192021222324252627
  1. from .builder import CUDAOpBuilder
  2. class QuantizerBuilder(CUDAOpBuilder):
  3. BUILD_VAR = "DS_BUILD_QUANTIZER"
  4. NAME = "quantizer"
  5. def __init__(self, name=None):
  6. name = self.NAME if name is None else name
  7. super().__init__(name=name)
  8. def absolute_name(self):
  9. return f'deepspeed.ops.quantizer.{self.NAME}_op'
  10. def sources(self):
  11. return [
  12. 'csrc/quantization/pt_binding.cpp',
  13. 'csrc/quantization/fake_quantizer.cu',
  14. 'csrc/quantization/quantize.cu',
  15. 'csrc/quantization/dequantize.cu',
  16. ]
  17. def include_paths(self):
  18. return ['csrc/includes']
  19. def extra_ldflags(self):
  20. return ['-lcurand']