[Bugfix][Kernel] Fix dangling temporary in AWQ gemm torch::stable::sum dim arg (#46805)
Signed-off-by: wentian-byte <2990624738@qq.com>
xiaolinchen committed
Aug 1, 2026 at 21:56 UTC
ab06486175e833925be065438b067cec488029e8
1 file changed
+5
-1
csrc/libtorch_stable/quantization/awq/gemm_kernels.cu
+5
-1
@@ -528,5 +528,9 @@ torch::stable::Tensor awq_gemm(torch::stable::Tensor _in_feats,
528
group_size, split_k_iters, in_feats, kernel, scaling_factors, zeros,
529
num_in_feats, num_in_channels, num_out_channels, out_feats);
530
}
531
- return torch::stable::sum(_out_feats, 0);
531
+ // Pass the reduction dim via a named, lifetime-stable local rather than a
532
+ // bare `0`.
533
+ constexpr int64_t sum_dim = 0;
534
+ return torch::stable::sum(
535
+ _out_feats, torch::headeronly::IntHeaderOnlyArrayRef(&sum_dim, 1));
536
}