dvm updated, version of sapfor updated
This commit is contained in:
@@ -54,6 +54,7 @@ int getLastLabelId();
|
||||
int isItInSection();
|
||||
int Init_Tool_Box();
|
||||
void Message();
|
||||
|
||||
PTR_BFND rec_num_near_search();
|
||||
PTR_BFND Redo_Bif_Next_Chain_Internal();
|
||||
PTR_SYMB duplicateSymbol();
|
||||
@@ -82,6 +83,12 @@ int out_upper_case;
|
||||
int out_line_unlimit;
|
||||
int out_line_length; // out_line_length = 132 for -ffo mode; out_line_length = 72 for -uniForm mode
|
||||
PTR_SYMB last_file_symbol;
|
||||
struct file_symbol {
|
||||
char *fname;
|
||||
PTR_SYMB last_symb;
|
||||
struct file_symbol *next;
|
||||
} ;
|
||||
struct file_symbol *file_last_symbol = NULL;
|
||||
|
||||
static int CountNullBifNext = 0; /* for internal debugging */
|
||||
|
||||
@@ -94,7 +101,6 @@ enum typenode node_code_kind[LAST_CODE];
|
||||
char info_type[LAST_CODE][MAXFIELDTYPE];
|
||||
char info_symb[LAST_CODE][MAXFIELDSYMB];
|
||||
char general_info[LAST_CODE][MAXFIELDSYMB];
|
||||
|
||||
/*static struct bif_stack_level *stack_level = NULL;*/
|
||||
/*static struct bif_stack_level *current_level = NULL;*/
|
||||
|
||||
@@ -247,6 +253,24 @@ char* mymalloc(int size)
|
||||
return pt1;
|
||||
}
|
||||
|
||||
PTR_SYMB FileLastSymbol(char *file_name)
|
||||
{
|
||||
struct file_symbol *fsl;
|
||||
for(fsl=file_last_symbol; fsl; fsl=fsl->next)
|
||||
if(!strcmp(file_name, fsl->fname))
|
||||
return fsl->last_symb;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void addFileSymbolList(char *file_name, PTR_SYMB symb)
|
||||
{
|
||||
struct file_symbol *fsl;
|
||||
fsl = (struct file_symbol *) xmalloc(sizeof (struct file_symbol));
|
||||
fsl->last_symb = symb;
|
||||
fsl->fname = file_name;
|
||||
fsl->next = file_last_symbol;
|
||||
file_last_symbol = fsl;
|
||||
}
|
||||
/***************** Provides infos on nodes ********************************
|
||||
* *
|
||||
* based on the table info in include dir *.def *
|
||||
@@ -549,6 +573,7 @@ void Message(char *s, int l)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* A set of functions for dealing with a free list for low_level node */
|
||||
/***************************************************************************/
|
||||
@@ -1203,14 +1228,13 @@ int Init_Tool_Box()
|
||||
number_of_ll_node = CUR_FILE_NUM_LLNDS() + 1;
|
||||
number_of_bif_node = CUR_FILE_NUM_BIFS() + 1;
|
||||
number_of_symb_node = CUR_FILE_NUM_SYMBS() + 1;
|
||||
last_file_symbol = CUR_FILE_CUR_SYMB(); /* podd 23.06.15 */
|
||||
|
||||
addFileSymbolList(CUR_FILE_NAME(), CUR_FILE_CUR_SYMB()); /* podd 01.03.24 */
|
||||
if (CUR_FILE_NAME()) strcpy(Current_File_name, CUR_FILE_NAME());
|
||||
if (ToolBOX_INIT)
|
||||
return 0;
|
||||
|
||||
ToolBOX_INIT = 1;
|
||||
|
||||
|
||||
make_a_malloc_stack();
|
||||
|
||||
/* initialisation des noeuds */
|
||||
|
||||
@@ -736,10 +736,11 @@ void Init_Unparser()
|
||||
/* set the first tabulation */
|
||||
TabNumber = 1;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (Parser_Initiated != C_Initialized)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Parser_Initiated != C_Initialized)
|
||||
{
|
||||
#define DEFNODECODE(SYM, NAME, TYPE, LENGTH, NT) Unparse_Def[SYM].str = create_unp_str( NAME);
|
||||
#include"unparseC++.def"
|
||||
#undef DEFNODECODE
|
||||
@@ -747,12 +748,15 @@ void Init_Unparser()
|
||||
#define DEFNODECODE(SYM, NAME, TYPE, LENGTH, NT) Unparse_Def[SYM].fct = NULL;
|
||||
#include"unparseC++.def"
|
||||
#undef DEFNODECODE
|
||||
Parser_Initiated = C_Initialized;
|
||||
/* init precedence table of operators for C++ */
|
||||
for(i=BIT_COMPLEMENT_OP - EQ_OP; i<=RSHIFT_ASSGN_OP-EQ_OP;i++)
|
||||
precedence_C[i] = precedence2_C[i-BIT_COMPLEMENT_OP+EQ_OP];
|
||||
}
|
||||
}
|
||||
Parser_Initiated = C_Initialized;
|
||||
/* set the first tabulation */
|
||||
TabNumber = 0;
|
||||
|
||||
/* init precedence table of operators for C++ */
|
||||
for(i=BIT_COMPLEMENT_OP - EQ_OP; i<=RSHIFT_ASSGN_OP-EQ_OP;i++)
|
||||
precedence_C[i] = precedence2_C[i-BIT_COMPLEMENT_OP+EQ_OP];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* initialize the number of flag */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1004,6 +1004,7 @@ SgStatement *doIfThenConstrForLoop_GPU(SgExpression *ref,SgStatement *endhost,Sg
|
||||
SgStatement *doIfThenConstrForLoop_GPU(SgExpression *ref,SgStatement *endhost,SgStatement *dowhile);
|
||||
SgSymbol *KernelSymbol(SgStatement *st_do);
|
||||
void Blocks_Off_Symbol();
|
||||
void InitializeACC();
|
||||
void InitializeAcrossACC();
|
||||
void InitializeInFuncACC();
|
||||
SgSymbol *GPUModuleSymb(SgStatement *global_st);
|
||||
|
||||
Reference in New Issue
Block a user