@@ -77,7 +77,6 @@ def try_load_lib(name, search_patterns):
7777 return True
7878 return False
7979 except Exception as e :
80- print (f"[ILUVATAR] Failed to load ILUVATAR libs: { e } " )
8180 return False
8281
8382
@@ -88,6 +87,8 @@ def _ensure_iluvatar_libs():
8887 global _iluvatar_libs_loaded
8988 if not _iluvatar_libs_loaded :
9089 _iluvatar_libs_loaded = _load_iluvatar_libs ()
90+ if _iluvatar_libs_loaded :
91+ print (f"[ILUVATAR] Successfully loaded ILUVATAR libs" )
9192 return _iluvatar_libs_loaded
9293
9394
@@ -171,6 +172,13 @@ def quantize(
171172 noop : Optional [torch .Tensor ] = None ,
172173 ) -> Any :
173174 tex = self ._get_tex ()
175+ try :
176+ if quantizer is not None and hasattr (quantizer , "dtype" ) and hasattr (tex , "DType" ):
177+ qdtype = quantizer .dtype
178+ if qdtype is not None :
179+ quantizer .dtype = tex .DType (int (qdtype ))
180+ except Exception :
181+ pass
174182 return tex .quantize (tensor , quantizer , output , noop )
175183
176184 def dequantize (
@@ -188,6 +196,16 @@ def bgrad_quantize(
188196 quantizer : Any ,
189197 ) -> List [Any ]:
190198 tex = self ._get_tex ()
199+
200+ # Normalize quantizer.dtype to this backend's `tex.DType`.
201+ try :
202+ if quantizer is not None and hasattr (quantizer , "dtype" ) and hasattr (tex , "DType" ):
203+ qdtype = quantizer .dtype
204+ if qdtype is not None :
205+ quantizer .dtype = tex .DType (int (qdtype ))
206+ except Exception :
207+ pass
208+
191209 return tex .bgrad_quantize (input , quantizer )
192210
193211 def generic_gemm (
0 commit comments