-
Notifications
You must be signed in to change notification settings - Fork 70
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
MatMul op results mismatch (NPU/Numpy) #145
Comments
Hi, Also, external AI accelerators (like GPUs and NPUs) are more effective when offloading large operations, you won't see speedups in multiplying a 8x8 matrix with a vector (as explained very nicely here ) Here an example with a medium size matrix matrix operation that have a significative speedup: from intel_npu_acceleration_library.backend import MatMul
import numpy as np
import time
inC = 1024
outC = 1024
batch = 256
X1 = np.random.uniform(-1, 1, (batch, inC)).astype(np.float16)
X2 = np.random.uniform(-1, 1, (outC, inC)).astype(np.float16)
mm = MatMul(inC, outC, batch, profile=False)
start_time = time.perf_counter()
result = mm.run(X1,X2)
end_time = time.perf_counter()
print(f"Intel NPU Acceleration Library Time: {(end_time - start_time) * 1000:.6f} ms")
start_time = time.perf_counter()
np_res = np.dot(X1, X2.T)
end_time = time.perf_counter()
print(f"Numpy Library Time: {(end_time - start_time) * 1000:.6f} ms")
print("NPU Result: ", result)
print("Numpy Result:", np_res) attached some code you can use for reference, it returns the following on an ARL machine
Also, consider that first time you compile results are skewed because of first inference latency |
Thank you will check this and confirm at my end. |
I attempted to measure the performance between NPU and Numpy-based dot product computations using float16 type but I found that results mismatch occurs between NPU/CPU numpy. I am using NPU on ARL.
To Reproduce
Steps to reproduce the behavior:
python <filename.py>
Expected behavior
Output mismatch between numpy/NPU occurs
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: