zhuwenxi commented on issue #7596:
URL: https://github.com/apache/tvm/issues/7596#issuecomment-809934150
Thanks @leeexyz , this is the code to reproduce the issue.
<pre>
import tvm
from tvm import te
import numpy as np
#from tvm.contrib import utils
n = 1024
l = 128
m = 235
bias = te.var("bias", dtype="float64")
A = te.placeholder((n, l), name="A", dtype="float64")
B = te.placeholder((l, m), name="B", dtype="float64")
C = te.extern(
(n, m),
[A, B],
lambda ins, outs: tvm.tir.call_packed(
"tvm.contrib.cblas.matmul", ins[0], ins[1], outs[0], False, False
),
name="C",
)
D = te.compute(C.shape, lambda i, j: C[i, j] + bias, name="D")
s = te.create_schedule(D.op)
ctx = tvm.cpu(0)
f = tvm.build(s, [A, B, D, bias], "c", name="test_add")
f.save("gen_c_code.c", "c")
path_dso = "test_add.so"
f.export_library(path_dso)
m = tvm.runtime.load_module(path_dso)
f = m["test_add"]
ctx = tvm.cpu(0)
a = tvm.nd.array(np.random.uniform(size=(n, l)).astype(A.dtype), ctx)
b = tvm.nd.array(np.random.uniform(size=(l, m)).astype(B.dtype), ctx)
d = tvm.nd.array(np.zeros((n, m), dtype=D.dtype), ctx)
bb = 10.0
f(a, b, d, bb)
</pre>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]