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

MatMul LibraryNode expansion failure during codegen #1914

Open
affifboudaoud opened this issue Jan 30, 2025 · 1 comment
Open

MatMul LibraryNode expansion failure during codegen #1914

affifboudaoud opened this issue Jan 30, 2025 · 1 comment

Comments

@affifboudaoud
Copy link
Collaborator

Describe the bug
Matrix-Matrix multiplication of matrices of the type [N, 1] x [1, M] fails because the MatMul LibraryNode is expanded to a dot product instead of a GEMM. This happens because the subsets are squeezed to decide what to expand the Library Node to.

To Reproduce
On the latest commit in main (01c01cf), run the matrix-matrix multiplication code below:

import numpy as np
import dace as dc

NI = 32
NJ = 36
NK = 1


@dc.program
def mmm(A: dc.float64[NI, NK], B: dc.float64[NK, NJ], C: dc.float64[NI, NJ]):

    C[:] = A @ B


alpha = 0.2
beta = 1.2

A = np.ones(shape=[NI, NK])
B = np.ones(shape=[NK, NJ])
C = np.ones(shape=[NI, NJ])

sdfg = mmm.to_sdfg()

sdfg(A, B, C)

This will output a ValueError: Output of dot product must be a single element

Expected behavior
Output a [32, 36] matrix in the example above.

@tbennun
Copy link
Collaborator

tbennun commented Jan 31, 2025

Related to #1884 (and will be resolved by it?) @phschaad let’s add this as a test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants