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

Can elaborate more on matrix mul breakdown in //DFT Designs on AI Engine// #457

Open
eerobert opened this issue Sep 26, 2024 · 1 comment

Comments

@eerobert
Copy link

eerobert commented Sep 26, 2024

Maybe my algebra is not good enough. Would like to know more on how to breakdown (1 * 16) * (16* 16) matrix into multiple of (1 * 2) * (2 * 4)

Thanks

@xflorentw
Copy link
Contributor

xflorentw commented Oct 3, 2024

Hi @eerobert
For this type of generic question, the forums would be better (https://adaptivesupport.amd.com/s/?language=en_US). Github issue would be more for issues with the tutorials.

Anyway let me give a quick answer.
Let just think about 2 (12) * (22) and 1 (14) * (42) matrix multiplication (i.e. splitting the operation in 2 matrices)

mat1 = [a b]
mat2 = [c d]
mat3 = [a b c d]
mat4 = [e f]
................[g h]
mat5= [i j]
................[k l]
mat6 = [e f]
................[g h]
................[i j]
................[k l]

mat1 * mat4 = [(ae+bg) (af+bh)]
mat2 * mat4 = [(ci + dk) (cj+dl)]

mat3 * mat6 = [(ae+bg+ci + dk) (af+bh+cj+dl)] = mat1 * mat4 + mat2 * mat4

So you can see that this would be a sum of matrices in that side. This is done in the AIE using the accumulator in the columns.

Now if you add more columns to the second matrices what happens? Do the expression on paper you will see that the columns are independent, so you can just store the matrix multiplication result side by side.
Or do the testing in matlab or python

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