Kaydet (Commit) bc7c98cf authored tarafından yiming ju's avatar yiming ju Kaydeden (comit) I-Jui (Ray) Sung

GPU Calc: Fix Bug of TBILLYIELD&TBILLEQ

AMLOEXT-376

Change-Id: I067819191f5926cef31ab50f1ad46d64a1e58a5c
Signed-off-by: 's avatarhaochen <haochen@multicorewareinc.com>
Signed-off-by: 's avatarWei Wei <weiwei@multicorewareinc.com>
Signed-off-by: 's avatarI-Jui (Ray) Sung <ray@multicorewareinc.com>
üst 7eafa6f2
......@@ -1685,11 +1685,11 @@ void OpEffective::GenSlidingWindowFunction(std::stringstream& ss,
std::set<std::string>& funs)
{
decls.insert(GetDiffDate360_Decl);decls.insert(GetDiffDate360Decl);
decls.insert(DateToDaysDecl);decls.insert(DaysToDateDecl);
decls.insert(DateToDaysDecl);decls.insert(DaysToDate_LocalBarrierDecl);
decls.insert(DaysInMonthDecl);decls.insert(GetNullDateDecl);
decls.insert(IsLeapYearDecl);
funs.insert(GetDiffDate360_);funs.insert(GetDiffDate360);
funs.insert(DateToDays);funs.insert(DaysToDate);
funs.insert(DateToDays);funs.insert(DaysToDate_LocalBarrier);
funs.insert(DaysInMonth);funs.insert(GetNullDate);
funs.insert(IsLeapYear);
}
......@@ -4845,11 +4845,11 @@ void RATE::GenSlidingWindowFunction(
std::set<std::string>& funs)
{
decls.insert(GetDiffDate360Decl);decls.insert(IsLeapYearDecl);
decls.insert(DateToDaysDecl);decls.insert(DaysToDateDecl);
decls.insert(DateToDaysDecl);decls.insert(DaysToDate_LocalBarrierDecl);
decls.insert(DaysInMonthDecl);decls.insert(GetNullDateDecl);
decls.insert(GetDiffDate360_Decl);
funs.insert(GetDiffDate360);funs.insert(DateToDays);
funs.insert(DaysToDate);funs.insert(IsLeapYear);
funs.insert(DaysToDate_LocalBarrier);funs.insert(IsLeapYear);
funs.insert(DaysInMonth);funs.insert(GetNullDate);
funs.insert(GetDiffDate360_);
......@@ -4930,14 +4930,14 @@ void OpTbillyield::GenSlidingWindowFunction(
ss<<"tmp002 = ";
ss << vSubArguments[2]->GenSlidingWindowDeclRef();
ss<<";\n\t";
ss <<"int nDiff=GetDiffDate360(GetNullDate(),tmp000,tmp001,true);\n";
ss <<"nDiff++;\n";
ss <<"tmp=100.0;\n";
ss <<"tmp /= tmp002;\n";
ss <<"tmp-=1.0;\n";
ss <<"tmp= tmp/( nDiff );\n";
ss <<"tmp *= 360.0;\n";
ss <<"return tmp;\n";
ss <<" int nDiff=GetDiffDate360(GetNullDate(),tmp000,tmp001,true);\n";
ss <<" nDiff++;\n";
ss <<" tmp=100.0;\n";
ss <<" tmp = tmp *pow( tmp002,-1);\n";
ss <<" tmp = tmp - 1.0;\n";
ss <<" tmp = tmp * pow( nDiff,-1.0 );\n";
ss <<" tmp = tmp * 360.0;\n";
ss <<" return tmp;\n";
ss << "}\n";
}
void OpDDB::GenSlidingWindowFunction(std::stringstream& ss,
......
......@@ -1654,6 +1654,52 @@ std::string DaysToDate_new =
" }\n"
"}\n";
std::string DaysToDate_LocalBarrierDecl =
"void DaysToDate( int nDays, int *rDay, int* rMonth, int* rYear );\n";
std::string DaysToDate_LocalBarrier =
"void DaysToDate( int nDays, int *rDay, int* rMonth, int* rYear )\n"
"{\n"
" int nTempDays;\n"
" int i = 0;\n"
" bool bCalc;\n"
" do\n"
" {\n"
" nTempDays = nDays;\n"
" *rYear = (int)((nTempDays / 365) - i);\n"
" nTempDays -= ((int) *rYear -1) * 365;\n"
" nTempDays -= ((*rYear -1) / 4) - ((*rYear -1) / 100) + ((*rYear -1)"
" / 400);\n"
" bCalc = false;\n"
" if ( nTempDays < 1 )\n"
" {\n"
" i++;\n"
" bCalc = true;\n"
" }\n"
" else\n"
" {\n"
" if ( nTempDays > 365 )\n"
" {\n"
" if ( (nTempDays != 366) || !IsLeapYear( *rYear ) )\n"
" {\n"
" i--;\n"
" bCalc = true;\n"
" }\n"
" }\n"
" }\n"
" }\n"
" while ( bCalc );\n"
" barrier(CLK_LOCAL_MEM_FENCE);\n"
" if(nTempDays != 0){\n"
" for (*rMonth = 1; (int)nTempDays > DaysInMonth( *rMonth, *rYear );"
" *rMonth += 1)\n"
" {\n"
" nTempDays -= DaysInMonth( *rMonth, *rYear ); \n"
" }\n"
" *rDay = (int)nTempDays;\n"
" }\n"
"}\n";
std::string GetYearDiff_newDecl=
"double GetYearDiff_new( int nNullDate, int nStartDate, int nEndDate,"
"int nMode);\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment