-
Notifications
You must be signed in to change notification settings - Fork 8
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
[feat] Add support for nonlinear operations #27
base: master
Are you sure you want to change the base?
Conversation
…n specific tiles.
…n a single node. e.g. division
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really appreciate the PR! Can you also provide a param.json
to enable the functionality provided by your PR as an example, and include in the action
(i.e., github testing automation)?
} | ||
// for (int r=0; r<t_rows; ++r) { | ||
// for (int c=0; c<t_columns; ++c) { | ||
// nodes[r][c]->enableCall(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is a bug fix, right? So from now on, call
can only be supported if user specify it in the param.json
or user needs to modify this CGRA.cpp
file?
And is this call
actually how is the lut
is recognized? i.e., instead of support call
, user provide the lut
func that is actually called
in the IR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, call
can only be supported if user specify. For lut
, it should be writed as call-lut
in param.json
after I refactored the code.
// for (int r=0; r<t_rows; ++r) { | ||
// for (int c=0; c<t_columns; ++c) { | ||
// // if(c == 0 || (r%2==1 and c%2 == 1)) | ||
// nodes[r][c]->enableComplex(); | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Means heterogeneity
in the param.json
won't take effect any more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Here I mean complex operations should be manually specified in the param.json rather than we configure it for the default.
Plz also resolve the conflict. Thanks! |
Thanks @HobbitQia, plz also put response for each of my comments and tag them as fixed/solved (if there is such tag). Thanks a lot! |
Can we include at least one .cpp that leverages your nonlinear_param.json for testing the new features? |
I included a For previous comments that I have solved (e.g. issues about comments, codes that should be deleted), I marked them as resolved. For other comments that I think we should discuss about, I responsed to them and didn't mark them. |
Thanks a lot Jiajun~! Let me know when you wanna set up meeting for discussion~ |
One more point: |
You mean empty string for
I really appreciate the contribution!
Sure, but this could be our future work in another PR when you have bandwidth. @cwz920716 Just FYI :-) Jiajun is one of the best students we have worked with :-) |
Yes, and actually there are many cases in I tried to test |
Then let's have |
There was a problem with the test...However, I can run test on my local environment. I am trying to figure out the reason. I think I find the problem! It's due to |
Right, the file name is hardcoded in the .cpp... |
|
||
- name: Test Idiv Feature | ||
working-directory: ${{github.workspace}}/test | ||
run: clang-12 -emit-llvm -O3 -fno-unroll-loops -fno-vectorize -o idiv_test.bc -c idiv_test.cpp && opt-12 -load ../build/src/libmapperPass.so -mapperPass idiv_test.bc | ||
working-directory: ${{github.workspace}}/test/nonlinear_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idiv_test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
A little strange...let me check it carefully |
No worry~ Thanks! |
Based on the error msg, seems failed at |
I found something strange...We used |
Seems some library missing: jupyter-xeus/xeus-cling#234 (comment)? Or you can try to use some C++ standard string write/read/stream functions to replace the LLVM |
I'm so excited to share my updates on the mapper with you. The main changes are listed below:
DFG.cpp
, I added a function callednonlinear_combine()
, which will fuse the common patterns occurring in nonlinear operations.__attribute__((noinline)) DATA_TYPE lut(DATA_TYPE x) { ... }
demangle(newName) == "lut(float)"
. We determine a DFG node which contains a special function throughDFGNode::getOpcodeName()
and compare the operation name with names of predefined special functions. Details can be seen in DFG.cpp:408-432 andDFGNode::isLut()
. l For CGRA mapping I also added special functions so that we can choose to configure a tile to equip with LUT/FP2FX or not. We can specify CGRA's nodes throughadditionalFunc
inparam.json
. Here's an example:DFGNode::isVectorized
. However for divison we cannot vectorize it since it's hard to support efficient vector divisor from the hardware perspective. Thus I chose to split a divison nodes into multiple nodes and reconnect the precursors and successors inDFG::tuneDivPattern()
. Notably, different vectorization factors will lead to different number of node (e.g. if VF=4 we should split a divison into 4 nodes) thus I added a parameter in theparams.json
so that we can specify the VF (default to 1).param.json
. Here's an example:Above are my main changes, along with some bug fixed. (sry that I cannot remember everything...)