Skip to content

Commit

Permalink
Merge pull request #13 from MeowMJ/MeowMJ-patch-1
Browse files Browse the repository at this point in the history
Meow mj patch 1
  • Loading branch information
tancheng committed Aug 27, 2023
2 parents 5e23da4 + 5aaa2ba commit 9cd5280
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/CGRANode.cpp
Expand Up @@ -190,7 +190,15 @@ bool CGRANode::canSupport(DFGNode* t_opt) {
(t_opt->isReturn() and !canReturn()) or
(t_opt->isCall() and !canCall()) or
(t_opt->isVectorized() and !supportVectorization()) or
(t_opt->hasCombined() and !supportComplex() )){
(t_opt->hasCombined() and !supportComplex()) or
(t_opt->isAdd() and !canAdd()) or
(t_opt->isMul() and !canMul()) or
(t_opt->isPhi() and !canPhi()) or
(t_opt->isSel() and !canSel()) or
(t_opt->isMAC() and !canMAC()) or
(t_opt->isLogic() and !canLogic()) or
(t_opt->isBranch() and !canBr()) or
(t_opt->isCmp() and !canCmp()) ){
return false;
}
return true;
Expand Down
24 changes: 24 additions & 0 deletions src/DFGNode.cpp
Expand Up @@ -216,6 +216,30 @@ bool DFGNode::isGetptr() {
return false;
}

bool DFGNode::isSel() {
if (m_opcodeName.compare("select") == 0)
return true;
return false;
}

bool DFGNode::isMAC() {
if ((m_opcodeName.compare("getelementptr") == 0 or
m_opcodeName.compare("add") == 0 or
m_opcodeName.compare("fadd") == 0 or
m_opcodeName.compare("sub") == 0 or
m_opcodeName.compare("fsub") == 0) &&

This comment has been minimized.

Copy link
@tancheng

tancheng Nov 8, 2023

Author Owner

@MeowMJ I just noticed this. Why this is an &&? In your code, isMAC() will never return true. Please fix in another PR.

This comment has been minimized.

Copy link
@MeowMJ

MeowMJ Nov 9, 2023

Collaborator

Because I thought a MAC is consisted of an add and a mult. So I should replace && with or?

This comment has been minimized.

Copy link
@tancheng

tancheng Nov 9, 2023

Author Owner

Hmmm I think this could be a good programming assignment for you.
Please check how MUL and ADD are combined and why one of them is removed in the updated DFG.
To refine the isMAC(), I think you can include another m_combinedOpcodeName in DFGNode. Does that sound good to you? Let me know.

This comment has been minimized.

Copy link
@MeowMJ

MeowMJ Nov 9, 2023

Collaborator

OK. I will finish it when I have time. Thx.

(m_opcodeName.compare("fmul") == 0 or
m_opcodeName.compare("mul") == 0))
return true;
return false;
}

bool DFGNode::isLogic() {
if (m_opcodeName.compare("or") == 0 or m_opcodeName.compare("and") == 0)
return true;
return false;
}

bool DFGNode::hasCombined() {
return m_combined;
}
Expand Down
3 changes: 3 additions & 0 deletions src/DFGNode.h
Expand Up @@ -82,6 +82,9 @@ class DFGNode {
bool isCmp();
bool isBitcast();
bool isGetptr();
bool isSel();
bool isMAC();
bool isLogic();
bool isOpt(string);
bool isVectorized();
bool hasCombined();
Expand Down

0 comments on commit 9cd5280

Please sign in to comment.