You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
linear with scaling will cause illegal memory access error #296
importbitblasimporttorch# enabling debug outputbitblas.set_log_level("Debug")
model=bitblas.Linear(
in_features=1024,
out_features=1024,
bias=False,
A_dtype="float16", # activation A dtypeW_dtype="uint4", # weight W dtypeaccum_dtype="float32", # accumulation dtypeout_dtype="float16", # output dtype# configs for weight only quantizationgroup_size=None, # setting for grouped quantizationwith_scaling=True, # setting for scaling factorwith_zeros=False, # setting for zeroszeros_mode=None, # setting for how to calculating zeros# Target optimization var for dynamic symbolic.# For detailed information please checkout docs/PythonAPI.md# By default, the optimization var is [1, 16, 32, 64, 128, 256, 512]opt_M=[1, 16, 32, 64, 128],
)
# Create an integer weight tensorintweight=torch.randint(0, 15, (1024, 1024), dtype=torch.int8).cuda()
# Load and transform weights into the BitBLAS linear modulemodel.load_and_transform_weight(intweight)
model.scales.uniform_(0.1, 0.2)
# Set the model to evaluation modemodel.eval()
dummpy_input=torch.randn(1, 1024, dtype=torch.float16).cuda()
print(model.qweight, model.scales, dummpy_input)
output=model(dummpy_input)
print(output)
File ~/anaconda3/envs/profile/lib/python3.10/site-packages/torch/_tensor_str.py:145, in _Formatter.__init__(self, tensor)
142 self.max_width = max(self.max_width, len(value_str))
144 else:
--> 145 nonzero_finite_vals = torch.masked_select(
146 tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0)
147 )
149 if nonzero_finite_vals.numel() == 0:
150 # no valid number, do nothing
151 return
RuntimeError: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
Activity