Comments (5)
Hmm, I'm not sure if I understand your question.
Are you trying to multiply MxM matrices with Mx1 vectors? If so, you don't need to pad the Mx1 vector with zeros. You can just move and Mx1 vector into the scratchpad, and then do a matmul with that Mx1 vector. Gemmini will pad it with zeros before feeding it into the systolic array.
There are examples here of matmuls with matrices that have less than DIM
rows/columns.
from gemmini.
For example, if I have 2 256 dimensional vectors, A and B. and I'd like to first, take the dot products of them to get output C which should also be a 256 dimensional vector. And then, elementwise-add this output C to another 256 dimensional vector D to get the final answer E.
A toy example with 2 dimensional vectors is here: A: [1, 3], B: [2, 4] , D: [5, 6]. C = [1x2, 3x4] = [2, 12]. E = [2 + 5, 12 +6] = [ 7, 18 ].
from gemmini.
Hi @hngenc , I tried using matmul to implement dot-product but its not efficient, which is understandable . As I explained above, I want to perform dot product of two 256-dimensional vectors, so theoretically, only 256 multiply operation is needed for this computation . I tried passing them both in the form of matrices so one vector, A's shape is (256 x 1) and the other vector, B's shape is (1x256) and the output is of shape (256x256). And then I only get elements on the diagonal. This is understandably inefficient since there are a lot of redundant operations performed. So i'm wondering if you have any suggestions as to deploying dot product of two vectors on Gemmini. Thanks!
from gemmini.
Well, the spatial array wasn't really built for element-wise operations. It was rather designed for matmuls.
I'm not sure if Gemmini is the right accelerator for your use-case. Another option could be to generate a Hwacha accelerator on the same SoC. You can have both Gemmini and Hwacha on the same SoC.
Hwacha is a vector processor, and will probably do a lot better on element-wise vector multiplications.
If you really want to use Gemmini for this, then I think your diagonal solution might be the best way. Another option would be to create your own Gemmini datatype, and define the +
operator to actually perform a multiplication. Then you could perform element-wise multiplications in the accumulator (but the spatial array would be useless in that case).
We describe how to create your own datatypes in our recent tutorial: https://sites.google.com/berkeley.edu/gemminitutorialiiswc2021/
from gemmini.
Got it. Thanks for the detailed explanation!
from gemmini.
Related Issues (20)
- Compilation stopped when Installing Chipyard and Spike ,What should I do? HOT 1
- Why has it been stopped in this place? [UART] UART0 is here (stdin/stdout).
- How to build a GemminiSoC with multiple clock domains?
- Support for OS Convolution
- iexp function in AccumulatorScale
- Error in running Resnet 50 Inference
- Error in run Transformer test on gemmini 0.7.1
- pipeline stall when the mesh size is set to 2x2 in ConfigsFP.scala
- how to correctly configure a gemmini with a smaller spad, 32Kb, 16kb. HOT 1
- The float32 configuration fails to pass even the simplest test in Verilator
- Changing the value of scratchpad does not change the cycles run by workloads. Why is this? HOT 4
- CHANGE HARDWARE
- Firesim running transformer hangs in Q * K HOT 1
- About RISCV gnu
- Can gemmini reduce the calculation accuracy and increase the calculation speed?
- Question about Gemmini Transposer
- About the mvout instruction HOT 2
- chipyard installation
- Illegal use of tristate value.
- FPGemminiRocketConfig compilation error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gemmini.