Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions onnxruntime/contrib_ops/cpu/quantization/matmul_nbits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ Status MatMulNBits<MLFloat16>::PrePack(const Tensor& tensor, int input_idx, /*ou
OpKernel::Info().TryGetConstantInput(InputIndex::scales, &scales);
if (scales && MlasQNBitGemmScalesPacked(K_, nbits_, block_size_, compute_type_, has_zp_input_)) {
auto sptr = scales->Data<MLFloat16>();
auto tensor_size = static_cast<size_t>(tensor.Shape().Size());
auto ptr = IAllocator::MakeUniquePtr<float>(alloc, tensor_size, true);
MlasConvertHalfToFloatBuffer(sptr, ptr.get(), tensor_size);
auto scales_size = static_cast<size_t>(scales->Shape().Size());
auto ptr = IAllocator::MakeUniquePtr<float>(alloc, scales_size, true);
MlasConvertHalfToFloatBuffer(sptr, ptr.get(), scales_size);
scales_fp32_ = std::move(ptr);
}

Expand Down
5 changes: 5 additions & 0 deletions onnxruntime/test/contrib_ops/matmul_4bits_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ TEST(MatMulNBits, Float16_4b_Accuracy4) {
TestMatMulNBitsTyped<MLFloat16, 100, 288, 93, 32, 4>();
TestMatMulNBitsTyped<MLFloat16, 100, 288, 93, 128, 4>();
TestMatMulNBitsTyped<MLFloat16, 100, 288, 1234, 16, 4>();

// See PR #27412 for details on the following test case,
// which is added to cover a specific failure case in the past.
TestMatMulNBitsTyped<MLFloat16, 369, 6144, 2048, 32, 4>();

Comment thread
hariharans29 marked this conversation as resolved.
}

TEST(MatMulNBits, LegacyShape_4b) {
Expand Down
Loading