dvm updated, version of sapfor updated
This commit is contained in:
@@ -83,11 +83,14 @@ void InitializeACC()
|
||||
type_CudaIndexType = NULL;
|
||||
type_with_len_DvmType = NULL;
|
||||
declaration_cmnt = NULL;
|
||||
indexType_int = indexType_long = indexType_llong = NULL;
|
||||
dvmh_targets = options.isOn(NO_CUDA) ? HOST_DEVICE : HOST_DEVICE | CUDA_DEVICE;
|
||||
|
||||
SpecialSymbols.insert(std::pair<char, const char*>('\n', "\\n\"\n\""));
|
||||
SpecialSymbols.insert(std::pair<char, const char*>('"', "\\\""));
|
||||
SpecialSymbols.insert(std::pair<char, const char*>('\\', "\\\\"));
|
||||
|
||||
InitializeAcrossACC();
|
||||
}
|
||||
|
||||
char *filenameACC()
|
||||
|
||||
@@ -40,15 +40,13 @@ void DeclarationCreateReductionBlocksAcross(int, SgExpression*);
|
||||
AnalyzeReturnGpuO1 analyzeLoopBody(int type);
|
||||
|
||||
// local static variables
|
||||
static SgSymbol *red_first;
|
||||
static bool declaration_include = true;
|
||||
static SgSymbol *red_first = NULL;
|
||||
static bool createBodyKernel = false;
|
||||
static bool createConvert_XY = true;
|
||||
static const int numLoopVars = 16;
|
||||
static bool ifReadLvlMode = false;
|
||||
static vector <stack <SgStatement*> > copyOfBody;
|
||||
static vector<SgSymbol*> allRegNames;
|
||||
static unsigned countOfCopies;
|
||||
static vector<ParamsForAllVariants> allVariants;
|
||||
|
||||
static const char *funcDvmhConvXYfortVer = " attributes(device) subroutine dvmh_convert_XY_int(x,y,Rx,Ry,slash,idx)\n implicit none\n integer ,value:: x\n integer ,value:: y\n integer ,value:: Rx\n integer ,value:: Ry\n integer ,value:: slash\n integer ,device:: idx \n \n if(slash .eq. 0) then\n if(Rx .eq. Ry) then\n if(x + y .lt. Rx) then\n idx = y + (1+x+y)*(x+y)/2\n else\n idx = Rx*(Rx-1)+x-(2*Rx-x-y-1)*(2*Rx-x-y-2)/2\n endif \n elseif(Rx .lt. Ry) then\n if(x + y .lt. Rx) then\n idx = y + ((1+x+y)*(x+y)) / 2\n elseif(x + y .lt. Ry) then\n idx = ((1+Rx)*Rx) / 2 + Rx - x - 1 + Rx * (x+y-Rx)\n else\n idx = Rx*Ry-Ry+y-(((Rx+Ry-y-x-1)*(Rx+Ry-y-x-2))/2)\n endif\n else\n if(x + y .lt. Ry) then\n idx = x + (1+x+y)*(x+y) / 2\n elseif(x + y .lt. Rx) then\n idx = (1+Ry)*Ry/2 + (Ry-y-1) + Ry * (x+y-Ry)\n else\n idx = Rx*Ry-Rx+x-((Rx+Ry-y-x-1)*(Rx+Ry-y-x-2)/2)\n endif\n endif\n else\n if(Rx .eq. Ry) then\n if(x + Rx-1-y .lt. Rx) then\n idx = Rx-1-y + (x+Rx-y)*(x+Rx-1-y)/2\n else\n idx = Rx*(Rx-1) + x - (Rx-x+y)*(Rx-x+y-1)/2\n endif\n elseif(Rx .lt. Ry) then\n if(x + Ry-1-y .lt. Rx) then \n idx = Ry-1-y + ((x+Ry-y)*(x+Ry-1-y)) / 2\n elseif(x + Ry-1-y .lt. Ry) then\n idx = ((1+Rx)*Rx)/2+Rx-x-1+Rx*(x+Ry-1-y-Rx)\n else\n idx = Rx*Ry-1-y-(((Rx+y-x)*(Rx+y-x-1))/2)\n endif\n else\n if(x + Ry-1-y .lt. Ry) then\n idx = x + (1+x+Ry-1-y)*(x+Ry-1-y)/2\n elseif(x + Ry-1-y .lt. Rx) then\n idx = (1+Ry)*Ry/2 + y + Ry * (x-y-1)\n else\n idx = Rx*Ry-Rx+x-((Rx+y-x)*(Rx+y-x-1)/2)\n endif\n endif\n endif\n end subroutine\n";
|
||||
@@ -58,6 +56,17 @@ static const char* fermiPreprocDir = "CUDA_FERMI_ARCH";
|
||||
// local variables
|
||||
SgStatement *kernelScope, *block;
|
||||
|
||||
void InitializeAcrossACC()
|
||||
{
|
||||
red_first = NULL;
|
||||
createBodyKernel = false;
|
||||
createConvert_XY = true;
|
||||
ifReadLvlMode = false;
|
||||
copyOfBody.clear();
|
||||
allRegNames.clear();
|
||||
allVariants.clear();
|
||||
}
|
||||
|
||||
static inline int pow(int n)
|
||||
{
|
||||
int tmp = 1;
|
||||
@@ -716,9 +725,6 @@ ArgsForKernel *Create_C_Adapter_Function_Across(SgSymbol *sadapter)
|
||||
{
|
||||
if (allVariants[i].acrossV != 1)
|
||||
ifOne = false;
|
||||
|
||||
if ((unsigned)allVariants[i].acrossV == countOfCopies + 1)
|
||||
countOfCopies++;
|
||||
}
|
||||
// set global if true
|
||||
if (ifOne)
|
||||
@@ -1787,11 +1793,8 @@ vector<ArgsForKernel> Create_C_Adapter_Function_Across_variants(SgSymbol *sadapt
|
||||
st_end = st_hedr->lexNext();
|
||||
fe = st_hedr->expr(0);
|
||||
first_exec = st_end;
|
||||
if (declaration_include)
|
||||
{
|
||||
if (declaration_cmnt == NULL)
|
||||
declaration_cmnt = "#include <cstdio>\n#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))\n#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))";
|
||||
declaration_include = false;
|
||||
}
|
||||
|
||||
mywarn(" end: create fuction header ");
|
||||
mywarn("start: create dummy argument list ");
|
||||
|
||||
@@ -82,6 +82,7 @@ extern "C" int out_upper_case;
|
||||
extern "C" int out_line_unlimit;
|
||||
extern "C" int out_line_length;
|
||||
extern "C" PTR_SYMB last_file_symbol;
|
||||
extern "C" PTR_SYMB FileLastSymbol(...);
|
||||
|
||||
Options options;
|
||||
|
||||
@@ -99,7 +100,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fout = NULL;
|
||||
FILE *fout_cuf = NULL, *fout_C_cu = NULL, *fout_info = NULL; /*ACC*/
|
||||
const char *fout_name = "out.DVMH.f";
|
||||
const char *fout_name = NULL;
|
||||
char *fout_name_cuf; /*ACC*/
|
||||
char *fout_name_C_cu; /*ACC*/
|
||||
char *fout_name_info_C; /*ACC*/
|
||||
@@ -389,22 +390,22 @@ int main(int argc, char *argv[])
|
||||
ProjectStructure(project);
|
||||
Private_Vars_Project_Analyzer();
|
||||
//----------------------------
|
||||
|
||||
|
||||
initVariantNames(); //for project
|
||||
initIntrinsicFunctionNames(); //for project
|
||||
initSupportedVars(); // for project, acc_f2c.cpp
|
||||
initF2C_FunctionCalls(); // for project, acc_f2c.cpp
|
||||
for(int id=project.numberOfFiles()-1; id >= 0; id--)
|
||||
{
|
||||
{
|
||||
file = &(project.file(id)); //file->unparsestdout();
|
||||
fin_name = new char[strlen(project.fileName(id))+2];
|
||||
sprintf(fin_name, "%s%s", project.fileName(id), " ");
|
||||
sprintf(fin_name, "%s%s", project.fileName(id), " ");
|
||||
//fin_name = strcat(project.fileName(0)," ");
|
||||
// for call of function 'tpoint'
|
||||
//added one symbol to input-file name
|
||||
//printf("%s",fin_name); //!!! debug
|
||||
if(a_mode || project.numberOfFiles()>1)
|
||||
fout_name = doOutFileName(file->filename()); //project.fileName(id);
|
||||
if(!fout_name)
|
||||
fout_name = doOutFileName(file->filename());
|
||||
else if (fout_name && source_name && !strcmp(source_name, fout_name))
|
||||
{
|
||||
(void)fprintf(stderr, "Output file has the same name as source file\n");
|
||||
@@ -417,7 +418,7 @@ int main(int argc, char *argv[])
|
||||
fout_name_info_C = ChangeFto_info_C(fout_name); /*ACC*/
|
||||
|
||||
//set the last symbol of file
|
||||
last_file_symbol = CUR_FILE_CUR_SYMB(); //LastSymbolOfFile(file)->thesymb; //for low_level.c
|
||||
last_file_symbol = FileLastSymbol(file->filename()); //for low_level.c and not only
|
||||
initLibNames(); //for every file
|
||||
InitDVM(file); //for every file
|
||||
current_file = file; // global variable (used in SgTypeComplex)
|
||||
@@ -542,6 +543,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
fout_name = NULL;
|
||||
}
|
||||
|
||||
if (v_print)
|
||||
|
||||
Reference in New Issue
Block a user