Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORT returns incorrect result for UINT8 Matmul on specific CPU #19109

Open
arui-yyz opened this issue Jan 12, 2024 · 1 comment
Open

ORT returns incorrect result for UINT8 Matmul on specific CPU #19109

arui-yyz opened this issue Jan 12, 2024 · 1 comment
Labels
core runtime issues related to core runtime stale issues that have not been addressed in a while; categorized by a bot

Comments

@arui-yyz
Copy link

arui-yyz commented Jan 12, 2024

Describe the issue

CPU Onnxruntime returns incorrect result for UINT8 quantized model (contains just 1 matmul shape(1,4) @ shape(4,1)) with the following env:
onnx==1.14
onnxruntime==1.16
protobuf==4.24.4

Passing on CPU: AMD Ryzen 9 7900X 12-Core Processor ; correct output is 0.22868575
Failing on CPU: AMD Ryzen Threadripper 2950X 16-Core Processor; incorrect output is -0.44277453

To reproduce

Onnx file:
mm_no_bias_uint8.tar.gz

Script to repro:

import onnx
import onnxruntime as ort
import numpy as np

import argparse

# get input path from commandline arguments
parser = argparse.ArgumentParser()
parser.add_argument('--input_model_path', type=str, help='path to the input model')
args = parser.parse_args()

# first import the onnx model
input_model_path = args.input_model_path
ort_session = ort.InferenceSession(input_model_path, providers=["CPUExecutionProvider"])
input_name = ort_session.get_inputs()[0].name
input_shape = ort_session.get_inputs()[0].shape
input_data = np.array([[0.6541, 0.4707, 0.2821, 0.5569]], dtype=np.float32)
quantized_output = ort_session.run(None, {input_name: input_data})
print("output: ", quantized_output)

Urgency

Customer release is blocked by this issue.

Platform

Linux

OS Version

20.04.6 LTS (Focal Fossa)

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.16

ONNX Runtime API

Python

Architecture

X86

Execution Provider

Default CPU

Execution Provider Library Version

No response

@HectorSVC HectorSVC added the core runtime issues related to core runtime label Jan 12, 2024
Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core runtime issues related to core runtime stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

2 participants