GPU Calc: implemented DURATION
AMLOEXT-111 FIX Change-Id: I114e5b20326657f7fd3e0de7162a8ae190059b2a Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
This commit is contained in:
committed by
I-Jui (Ray) Sung
parent
d454a57acd
commit
0644c59f1e
@@ -1016,6 +1016,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
|
||||
case ocISPMT:
|
||||
mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpISPMT));
|
||||
break;
|
||||
case ocLaufz:
|
||||
mvSubArguments.push_back(SoPHelper(ts,
|
||||
ft->Children[i], new OpDuration));
|
||||
break;
|
||||
case ocExternal:
|
||||
if ( !(pChild->GetExternal().compareTo(OUString(
|
||||
"com.sun.star.sheet.addin.Analysis.getEffect"))))
|
||||
|
@@ -531,6 +531,48 @@ void OpISPMT::GenSlidingWindowFunction(std::stringstream& ss,
|
||||
ss << "}";
|
||||
}
|
||||
|
||||
void OpDuration::GenSlidingWindowFunction(std::stringstream& ss,
|
||||
const std::string sSymName, SubArguments& vSubArguments)
|
||||
{
|
||||
ss << "\ndouble " << sSymName;
|
||||
ss << "_"<< BinFuncName() <<"(";
|
||||
for (unsigned i = 0; i < vSubArguments.size(); i++)
|
||||
{
|
||||
if (i)
|
||||
ss << ",";
|
||||
vSubArguments[i]->GenSlidingWindowDecl(ss);
|
||||
}
|
||||
ss << ") {\n";
|
||||
ss << " double tmp = " << GetBottom() << ";\n";
|
||||
ss << " int gid0 = get_global_id(0);\n";
|
||||
ss << " double arg0 = " << GetBottom() << ";\n";
|
||||
ss << " double arg1 = " << GetBottom() << ";\n";
|
||||
ss << " double arg2 = " << GetBottom() << ";\n";
|
||||
unsigned i = vSubArguments.size();
|
||||
while (i--)
|
||||
{
|
||||
FormulaToken* pCur = vSubArguments[i]->GetFormulaToken();
|
||||
assert(pCur);
|
||||
if(pCur->GetType() == formula::svSingleVectorRef)
|
||||
{
|
||||
#ifdef ISNAN
|
||||
const formula::SingleVectorRefToken* pSVR =
|
||||
dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
|
||||
ss << " if(gid0 >= " << pSVR->GetArrayLength() << " || isNan(";
|
||||
ss << vSubArguments[i]->GenSlidingWindowDeclRef();
|
||||
ss << "))\n";
|
||||
ss << " arg" << i << " = " <<GetBottom() << ";\n";
|
||||
ss << " else\n";
|
||||
#endif
|
||||
ss << " arg" << i << " = ";
|
||||
ss << vSubArguments[i]->GenSlidingWindowDeclRef();
|
||||
ss << ";\n";
|
||||
}
|
||||
}
|
||||
ss << " tmp = log(arg2 / arg1) / log(arg0 + 1.0);\n";
|
||||
ss << " return tmp;\n";
|
||||
ss << "}";
|
||||
}
|
||||
|
||||
void Fvschedule::GenSlidingWindowFunction(
|
||||
std::stringstream &ss, const std::string sSymName, SubArguments &vSubArguments)
|
||||
|
@@ -97,6 +97,18 @@ public:
|
||||
virtual std::string BinFuncName(void) const { return "ISPMT"; }
|
||||
};
|
||||
|
||||
class OpDuration: public Normal
|
||||
{
|
||||
public:
|
||||
virtual std::string GetBottom(void) { return "0"; }
|
||||
|
||||
virtual void GenSlidingWindowFunction(std::stringstream& ss,
|
||||
const std::string sSymName, SubArguments& vSubArguments);
|
||||
|
||||
virtual std::string BinFuncName(void) const { return "Duration"; }
|
||||
};
|
||||
|
||||
|
||||
class Fvschedule: public Normal
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user