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

update OneMKL gemm_batch call inside dpnp.matmul and column_major version of gemm #1793

Merged
merged 13 commits into from
May 8, 2024
9 changes: 8 additions & 1 deletion dpnp/dpnp_utils/dpnp_utils_linearalgebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def _gemm_batch_matmul(exec_q, x1, x2, res, dev_tasks_list):
if res_shape != orig_shape:
res = res.reshape(orig_shape)

res = dpnp.ascontiguousarray(res)
return res


Expand Down Expand Up @@ -2063,7 +2064,9 @@ def dpnp_matmul(
)
host_tasks_list.append(ht_blas_ev)
if not row_major:
result = dpnp.reshape(result.ravel(), result.shape, order="F")
result = dpnp.ascontiguousarray(
dpnp.reshape(result.ravel(), result.shape, order="F")
)
vtavana marked this conversation as resolved.
Show resolved Hide resolved
else:
result = _gemm_batch_matmul(
exec_q,
Expand Down Expand Up @@ -2105,6 +2108,10 @@ def dpnp_matmul(
else:
return result
else:
# TODO: There is oppurtinuty to improve performance when out keyword
# is present. For some cases, out is NOT result but they have the same
# base (They are views of the same data). In this case, we can avoid
# copyign result to out.
result = dpnp.get_result_array(result, out, casting=casting)
if axes is not None and out is result:
# out and out_orig contain the same data but they have different shape
Expand Down
Loading