added new implimentation of private arrays

This commit is contained in:
ALEXks
2024-10-29 11:53:41 +03:00
parent 1a1705d2e4
commit 5e60b5cd5c
12 changed files with 945 additions and 113 deletions

View File

@@ -261,6 +261,10 @@ const int END_OF_USE_LIST = 1050; /*ACC*/
const int END_OF_USE_LIST = 1050; /*ACC*/
const int ROUTINE_ATTR = 1051; /*ACC*/
const int DATA_REGION_SYMB = 1052; /*ACC*/
const int REMOTE_ACCESS_BUF = 1053; /*ACC*/
const int L_BOUNDS = 1054; /*ACC*/
const int DIM_SIZES = 1055; /*ACC*/
const int PRIVATE_ARRAY = 1056; /*ACC*/
const int PRIVATE_POINTER = 1057; /*ACC*/
const int MAX_LOOP_LEVEL = 20; // 7 - maximal number of loops in parallel loop nest
@@ -1275,6 +1279,7 @@ SgSymbol *isSameRedVar(char *name);
SgSymbol *isSameRedVar(char *name);
SgSymbol *isSameArray(char *name);
SgSymbol *isSameIndexVar(char *name);
SgType * C_LongLongType();
SgType * C_UnsignedLongLongType();
SgType * C_DvmType();
SgType * C_CudaIndexType();
@@ -1434,6 +1439,18 @@ SgSymbol *HeaderSymbolForHandler(SgSymbol *ar);
SgSymbol *HeaderSymbolForHandler(SgSymbol *ar);
void TestRoutineAttribute(SgSymbol *s, SgStatement *routine_interface);
int LookForRoutineDir(SgStatement *interfaceFunc);
SgStatement *Interface(SgSymbol *s);
SgExpression *sizeOfElementInBytes(SgSymbol *symb);
SgExpression *sizeOfPrivateArraysInBytes();
SgExpression *ProductOfDimSizeArgs(SgExpression *esizes);
//void doPrivateArrayList(SgExpression *private_arrays, SgStatement *st_hedr);
void addPrivateArrayList(SgFunctionCallExp *fcall, SgExpression *private_arrays, SgStatement *st_hedr);
int TestArrayShape(SgSymbol *ar);
SgExpression *DimSizeListOfPrivateArrays();
SgExpression *BoundListOfPrivateArrays();
SgExpression * DummyListForPrivateArrays(SgStatement *st_hedr);
SgExpression *CreatePrivateDummyList();
char *PointerNameForPrivateArray(SgSymbol *symb);
void GetMemoryForPrivateArrays(SgSymbol *private_first, SgSymbol *s_loop_ref, int nump, SgStatement *st_end, SgStatement *st_hedr, SgExpression *e_totalThreads);
/* acc_analyzer.cpp */
@@ -1900,6 +1917,10 @@ SgStatement *Consistent_H (int il, SgExpression *hedr, SgExpression *axis_list);
SgStatement *Consistent_H (int il, SgExpression *hedr, SgExpression *axis_list);
SgStatement *LoopRemoteAccess_H (int il, SgExpression *hedr, SgSymbol *ar, SgExpression *axis_list);
SgStatement *RemoteAccess_H2 (SgExpression *buf_hedr, SgSymbol *ar, SgExpression *ar_hedr, SgExpression *axis_list);
SgStatement *GetRemoteBuf (SgSymbol *loop_s, int n, SgSymbol *s_buf_head);
SgExpression *GetDeviceProp(SgSymbol *s_loop_ref, SgExpression *ep);
SgExpression *GetMaxBlocks(SgSymbol *s_loop_ref, SgSymbol *s_max_blocks, SgSymbol *s_needed_bytes);
SgExpression *GetPrivateArray(SgSymbol *s_loop_ref, SgExpression *e_bytes);
SgExpression *DisposePrivateArray(SgSymbol *s_loop_ref, SgSymbol *s_array);
/* io.cpp */
@@ -2089,7 +2110,6 @@ char *Check_Correct_Name(const char *name);
/* acc_f2c.cpp */
void Translate_Fortran_To_C(SgStatement *stat, SgStatement *last, std::vector <std::stack <SgStatement*> > &, int);
SgStatement* Translate_Fortran_To_C(SgStatement* Stmt, bool isSapforConv = false);
SgStatement* Translate_Fortran_To_C(SgStatement* Stmt, bool isSapforConv = false);
SgSymbol* createNewFunctionSymbol(const char *name);
void swapDimentionsInprivateList(void);
@@ -2103,6 +2123,9 @@ void RenamingNewProcedureVariables(SgSymbol *proc_name);
void RenamingNewProcedureVariables(SgSymbol *proc_name);
SgSymbol *hasSameNameAsSource(SgSymbol *symb);
void RenamingCudaFunctionVariables(SgStatement *first, SgSymbol *k_symb, int replace_flag);
void replaceVariableSymbSameNameInStatements(SgStatement *first, SgStatement *last, SgSymbol *symb, SgSymbol *s_new, int replace_flag);
void RenamingCalledProcedureSymbols(SgStatement *header, SgStatement *copy_header);
void RenamingCalledProcedureSymbolsInKernel(SgSymbol *first_symb);
/* acc_across.cpp */
ArgsForKernel *Create_C_Adapter_Function_Across(SgSymbol *sadapter);
@@ -2238,7 +2261,7 @@ void ConvertLoopWithLabelToEnddoLoop (SgStatement *stat); /*OMP*/
// options on FDVM converter
enum OPTIONS {
AUTO_TFM = 0, ONE_THREAD, SPEED_TEST_L0, SPEED_TEST_L1, GPU_O0, GPU_O1, RTC, C_CUDA, OPT_EXP_COMP,
O_HOST, NO_CUDA, NO_BL_INFO, LOOP_ANALYSIS, PRIVATE_ANALYSIS, IO_RTS, READ_ALL, NO_REMOTE, NO_PURE_FUNC,
O_HOST, NO_CUDA, NO_BL_INFO, LOOP_ANALYSIS, PRIVATE_ANALYSIS, IO_RTS, READ_ALL, NO_REMOTE, NO_PURE_FUNC,
GPU_IRR_ACC, O_PL, O_PL2, BIG_P, NUM_OPT};
// ONE_THREAD - compile one thread CUDA-kernels only for across (TODO for all CUDA-kernels)
// SPEED_TEST_L0, SPEED_TEST_L1 - debug options for speed testof CUDA-kernels for across

View File

@@ -62,7 +62,8 @@
#define DVM_CP_WAIT_DIR 638
#define DVM_EXIT_INTERVAL_DIR 639
#define DVM_TEMPLATE_CREATE_DIR 640
#define DVM_TEMPLATE_DELETE_DIR 641
#define DVM_TEMPLATE_DELETE_DIR 641
#define PRIVATE_AR_DECL 642
#define BLOCK_OP 705
#define NEW_SPEC_OP 706
#define REDUCTION_OP 707

View File

@@ -334,3 +334,7 @@ name_dvm[GUESS_INDEX_TYPE] = "loop_guess_index_type_";
name_dvm[GUESS_INDEX_TYPE_2]="dvmh_loop_guess_index_type_C";
name_dvm[RTC_SET_LANG] = "loop_cuda_rtc_set_lang";
name_dvm[GET_REMOTE_BUF_C] = "dvmh_loop_get_remote_buf_C";
name_dvm[GET_DEVICE_PROP] = "loop_cuda_get_device_prop";
name_dvm[GET_MAX_BLOCKS] = "loop_cuda_get_max_blocks";
name_dvm[GET_PRIVATE_ARR] = "loop_cuda_get_private_array";
name_dvm[DISPOSE_PRIVATE_AR]="loop_cuda_dispose_private_array";

View File

@@ -332,5 +332,9 @@ enum {
GUESS_INDEX_TYPE_2,
RTC_SET_LANG,
GET_REMOTE_BUF_C,
GET_DEVICE_PROP,
GET_MAX_BLOCKS,
GET_PRIVATE_ARR,
DISPOSE_PRIVATE_AR,
MAX_LIBFUN_NUM
};