Merge branch 'master' into analyze_loops_with_IR
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,83 +1,83 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(project FDVM)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libSage++
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
set(SOURCE_LIB
|
||||
${sagepp_sources}/libSage++.cpp
|
||||
${sage_include_1}/libSage++.h)
|
||||
|
||||
|
||||
# if not default ${sagepp_sources} must be set in ../paths.txt
|
||||
set(SOURCE_EXE
|
||||
${fdvm_sources}/acc.cpp
|
||||
${fdvm_sources}/acc_across.cpp
|
||||
${fdvm_sources}/acc_across_analyzer.cpp
|
||||
${fdvm_sources}/acc_analyzer.cpp
|
||||
${fdvm_sources}/acc_data.cpp
|
||||
${fdvm_sources}/acc_f2c.cpp
|
||||
${fdvm_sources}/acc_f2c_handlers.cpp
|
||||
${fdvm_sources}/acc_rtc.cpp
|
||||
${fdvm_sources}/acc_rtc.cpp
|
||||
${fdvm_sources}/acc_utilities.cpp
|
||||
${fdvm_sources}/aks_analyzeLoops.cpp
|
||||
${fdvm_sources}/aks_structs.cpp
|
||||
${fdvm_sources}/checkpoint.cpp
|
||||
${fdvm_sources}/debug.cpp
|
||||
${fdvm_sources}/dvm.cpp
|
||||
${fdvm_sources}/calls.cpp
|
||||
${fdvm_sources}/funcall.cpp
|
||||
${fdvm_sources}/help.cpp
|
||||
${fdvm_sources}/hpf.cpp
|
||||
${fdvm_sources}/io.cpp
|
||||
${fdvm_sources}/omp.cpp
|
||||
${fdvm_sources}/ompdebug.cpp
|
||||
${fdvm_sources}/parloop.cpp
|
||||
${fdvm_sources}/stmt.cpp)
|
||||
|
||||
source_group (SageLib FILES ${SOURCE_LIB})
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_executable(FDVM ${SOURCE_EXE} ${SOURCE_LIB})
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
|
||||
add_definitions("-D _CRT_SECURE_NO_WARNINGS")
|
||||
add_definitions("-D SYS5")
|
||||
add_definitions("-D YYDEBUG")
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
add_subdirectory(../SageNewSrc ${CMAKE_CURRENT_BINARY_DIR}/SageNewSrc)
|
||||
target_link_libraries(FDVM SageOldSrc SageNewSrc)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(project FDVM)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libSage++
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
set(SOURCE_LIB
|
||||
${sagepp_sources}/libSage++.cpp
|
||||
${sage_include_1}/libSage++.h)
|
||||
|
||||
|
||||
# if not default ${sagepp_sources} must be set in ../paths.txt
|
||||
set(SOURCE_EXE
|
||||
${fdvm_sources}/acc.cpp
|
||||
${fdvm_sources}/acc_across.cpp
|
||||
${fdvm_sources}/acc_across_analyzer.cpp
|
||||
${fdvm_sources}/acc_analyzer.cpp
|
||||
${fdvm_sources}/acc_data.cpp
|
||||
${fdvm_sources}/acc_f2c.cpp
|
||||
${fdvm_sources}/acc_f2c_handlers.cpp
|
||||
${fdvm_sources}/acc_rtc.cpp
|
||||
${fdvm_sources}/acc_rtc.cpp
|
||||
${fdvm_sources}/acc_utilities.cpp
|
||||
${fdvm_sources}/aks_analyzeLoops.cpp
|
||||
${fdvm_sources}/aks_structs.cpp
|
||||
${fdvm_sources}/checkpoint.cpp
|
||||
${fdvm_sources}/debug.cpp
|
||||
${fdvm_sources}/dvm.cpp
|
||||
${fdvm_sources}/calls.cpp
|
||||
${fdvm_sources}/funcall.cpp
|
||||
${fdvm_sources}/help.cpp
|
||||
${fdvm_sources}/hpf.cpp
|
||||
${fdvm_sources}/io.cpp
|
||||
${fdvm_sources}/omp.cpp
|
||||
${fdvm_sources}/ompdebug.cpp
|
||||
${fdvm_sources}/parloop.cpp
|
||||
${fdvm_sources}/stmt.cpp)
|
||||
|
||||
source_group (SageLib FILES ${SOURCE_LIB})
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_executable(FDVM ${SOURCE_EXE} ${SOURCE_LIB})
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
|
||||
add_definitions("-D _CRT_SECURE_NO_WARNINGS")
|
||||
add_definitions("-D SYS5")
|
||||
add_definitions("-D YYDEBUG")
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
add_subdirectory(../SageNewSrc ${CMAKE_CURRENT_BINARY_DIR}/SageNewSrc)
|
||||
target_link_libraries(FDVM SageOldSrc SageNewSrc)
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(project Parser)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libSage++
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${sagepp_sources} must be set in ../paths.txt
|
||||
set(SOURCE_EXE
|
||||
${parser_sources}/cftn.c
|
||||
${parser_sources}/errors.c
|
||||
${parser_sources}/gram1.tab.c
|
||||
${parser_sources}/hash.c
|
||||
${parser_sources}/init.c
|
||||
${parser_sources}/lexfdvm.c
|
||||
${parser_sources}/lists.c
|
||||
${parser_sources}/low_hpf.c
|
||||
${parser_sources}/misc.c
|
||||
${parser_sources}/stat.c
|
||||
${parser_sources}/sym.c
|
||||
${parser_sources}/types.c
|
||||
${parser_sources}/unparse_hpf.c
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_executable(Parser ${SOURCE_EXE})
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
|
||||
add_definitions("-D __SPF")
|
||||
add_definitions("-D _CRT_SECURE_NO_WARNINGS")
|
||||
add_definitions("-D SYS5")
|
||||
add_definitions("-D YYDEBUG")
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
target_link_libraries(Parser SageOldSrc)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(project Parser)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libSage++
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${sagepp_sources} must be set in ../paths.txt
|
||||
set(SOURCE_EXE
|
||||
${parser_sources}/cftn.c
|
||||
${parser_sources}/errors.c
|
||||
${parser_sources}/gram1.tab.c
|
||||
${parser_sources}/hash.c
|
||||
${parser_sources}/init.c
|
||||
${parser_sources}/lexfdvm.c
|
||||
${parser_sources}/lists.c
|
||||
${parser_sources}/low_hpf.c
|
||||
${parser_sources}/misc.c
|
||||
${parser_sources}/stat.c
|
||||
${parser_sources}/sym.c
|
||||
${parser_sources}/types.c
|
||||
${parser_sources}/unparse_hpf.c
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_executable(Parser ${SOURCE_EXE})
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
|
||||
add_definitions("-D __SPF")
|
||||
add_definitions("-D _CRT_SECURE_NO_WARNINGS")
|
||||
add_definitions("-D SYS5")
|
||||
add_definitions("-D YYDEBUG")
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
target_link_libraries(Parser SageOldSrc)
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(project SageLib)
|
||||
#also named as libSage++
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${sagepp_sources} must be set in ../paths.txt
|
||||
set(SOURCE_LIB
|
||||
${sagepp_sources}/libSage++.cpp
|
||||
${sage_include_1}/libSage++.h
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_library(SageLib STATIC ${SOURCE_LIB})
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
target_link_libraries(SageLib SageOldSrc)
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(project SageLib)
|
||||
#also named as libSage++
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${sagepp_sources} must be set in ../paths.txt
|
||||
set(SOURCE_LIB
|
||||
${sagepp_sources}/libSage++.cpp
|
||||
${sage_include_1}/libSage++.h
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_library(SageLib STATIC ${SOURCE_LIB})
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
target_link_libraries(SageLib SageOldSrc)
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
|
||||
@@ -1,53 +1,52 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(project SageNewSrc)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libSage
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${sage_sources} must be set in ../paths.txt
|
||||
set(SOURCE_LIB
|
||||
${sage_sources}/annotate.tab.c
|
||||
${sage_sources}/comments.c
|
||||
${sage_sources}/low_level.c
|
||||
${sage_sources}/toolsann.c
|
||||
${sage_sources}/unparse.c
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_library(SageNewSrc STATIC ${SOURCE_LIB})
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
target_link_libraries(SageNewSrc SageOldSrc)
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(project SageNewSrc)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libSage
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${sage_sources} must be set in ../paths.txt
|
||||
set(SOURCE_LIB
|
||||
${sage_sources}/annotate.tab.c
|
||||
${sage_sources}/comments.c
|
||||
${sage_sources}/low_level.c
|
||||
${sage_sources}/toolsann.c
|
||||
${sage_sources}/unparse.c
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_library(SageNewSrc STATIC ${SOURCE_LIB})
|
||||
|
||||
add_subdirectory(../SageOldSrc ${CMAKE_CURRENT_BINARY_DIR}/SageOldSrc)
|
||||
target_link_libraries(SageNewSrc SageOldSrc)
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3")
|
||||
endif()
|
||||
@@ -1,63 +1,63 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
set(project SageOldSrc)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libDB
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${libdb_sources} must be set in ../paths.txt
|
||||
set(SOURCE_LIB
|
||||
${libdb_sources}/anal_ind.c
|
||||
${libdb_sources}/db.c
|
||||
${libdb_sources}/dbutils.c
|
||||
${libdb_sources}/db_unp.c
|
||||
${libdb_sources}/db_unp_comm.c
|
||||
${libdb_sources}/db_unp_vpc.c
|
||||
${libdb_sources}/garb_coll.c
|
||||
${libdb_sources}/glob_anal.c
|
||||
${libdb_sources}/ker_fun.c
|
||||
${libdb_sources}/list.c
|
||||
${libdb_sources}/make_nodes.c
|
||||
${libdb_sources}/mod_ref.c
|
||||
${libdb_sources}/ndeps.c
|
||||
${libdb_sources}/readnodes.c
|
||||
${libdb_sources}/sets.c
|
||||
${libdb_sources}/setutils.c
|
||||
${libdb_sources}/symb_alg.c
|
||||
${libdb_sources}/writenodes.c
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_library(SageOldSrc STATIC ${SOURCE_LIB})
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(project SageOldSrc)
|
||||
#set(CMAKE_C_STANDARD 11)
|
||||
#also named as libDB
|
||||
if (TARGET ${project})
|
||||
return()
|
||||
endif ()
|
||||
project(${project})
|
||||
message("processing ${project}")
|
||||
|
||||
# Read pathes to external sapfor directories
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../paths.txt")
|
||||
message("Found paths.txt, using custom paths.")
|
||||
FILE(STRINGS ../paths.txt SAPFOR_PATHS)
|
||||
else ()
|
||||
message("Not found paths.txt, using default paths.")
|
||||
FILE(STRINGS ../paths.default.txt SAPFOR_PATHS)
|
||||
endif ()
|
||||
foreach (NameAndValue ${SAPFOR_PATHS})
|
||||
# Strip leading spaces
|
||||
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
|
||||
# Find variable name
|
||||
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
|
||||
# Find the value
|
||||
string(REPLACE "${Name}=" "" Value ${NameAndValue})
|
||||
# Set the variable, note the ../ because we are deeper than the file
|
||||
set(${Name} "../${Value}")
|
||||
endforeach ()
|
||||
|
||||
# if not default ${libdb_sources} must be set in ../paths.txt
|
||||
set(SOURCE_LIB
|
||||
${libdb_sources}/anal_ind.c
|
||||
${libdb_sources}/db.c
|
||||
${libdb_sources}/dbutils.c
|
||||
${libdb_sources}/db_unp.c
|
||||
${libdb_sources}/db_unp_comm.c
|
||||
${libdb_sources}/db_unp_vpc.c
|
||||
${libdb_sources}/garb_coll.c
|
||||
${libdb_sources}/glob_anal.c
|
||||
${libdb_sources}/ker_fun.c
|
||||
${libdb_sources}/list.c
|
||||
${libdb_sources}/make_nodes.c
|
||||
${libdb_sources}/mod_ref.c
|
||||
${libdb_sources}/ndeps.c
|
||||
${libdb_sources}/readnodes.c
|
||||
${libdb_sources}/sets.c
|
||||
${libdb_sources}/setutils.c
|
||||
${libdb_sources}/symb_alg.c
|
||||
${libdb_sources}/writenodes.c
|
||||
)
|
||||
|
||||
# if not default ${fdvm_include}, ${sage_include_1}, ${sage_include_2} must be set in ../paths.txt
|
||||
include_directories(${fdvm_include} ${sage_include_1} ${sage_include_2})
|
||||
add_library(SageOldSrc STATIC ${SOURCE_LIB})
|
||||
|
||||
if (MSVC_IDE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
endif()
|
||||
|
||||
@@ -162,6 +162,35 @@ namespace SAPFOR
|
||||
|
||||
SgExpression* getExpression() const { return ex; }
|
||||
|
||||
int getLine() const { return st ? st->lineNumber() : -1; }
|
||||
|
||||
bool isAccess() const
|
||||
{
|
||||
std::set<CFG_OP> accessOps = { CFG_OP::LOAD , CFG_OP::STORE, CFG_OP::REC_REF_LOAD, CFG_OP::REC_REF_STORE };
|
||||
return accessOps.find(operation) != accessOps.end();
|
||||
}
|
||||
|
||||
bool isArith() const
|
||||
{
|
||||
std::set<CFG_OP> arithOps = { CFG_OP::ADD, CFG_OP::MULT, CFG_OP::DIV, CFG_OP::SUBT, CFG_OP::UN_ADD, CFG_OP::UN_MINUS, CFG_OP::POW, CFG_OP::CONCAT };
|
||||
//CFG_OP::CAST, CFG_OP::GE, CFG_OP::LE, CFG_OP::GT, CFG_OP::LT, CFG_OP::EQ, CFG_OP::NEQV, CFG_OP::EQV, CFG_OP::OR, CFG_OP::AND, CFG_OP::NOT };
|
||||
|
||||
return (arithOps.find(operation) != arithOps.end()) || isIntirinsicCall();
|
||||
}
|
||||
|
||||
bool isIntirinsicCall() const
|
||||
{
|
||||
if (operation == CFG_OP::F_CALL)
|
||||
{
|
||||
if (ex)
|
||||
{
|
||||
if (isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int getNextInstrNum() { return lastNumInstr; }
|
||||
static void shiftNextInstrNum(int byNum) { lastNumInstr += byNum; }
|
||||
|
||||
@@ -296,6 +325,8 @@ namespace SAPFOR
|
||||
void setHeader() { header = true; }
|
||||
bool isHeader() const { return header; }
|
||||
|
||||
int getLine() const { return current->getLine(); }
|
||||
|
||||
~IR_Block() { delete current; }
|
||||
};
|
||||
|
||||
|
||||
@@ -122,15 +122,20 @@ extern map<string, vector<Messages>> SPF_messages;
|
||||
|
||||
//for simple reduction
|
||||
template<typename fillType>
|
||||
void fillReductionsFromComment(Statement *stIn, map<string, set<fillType>> &reduction, bool moduleNameAdd)
|
||||
void fillReductionsFromComment(Statement *stIn, map<string, set<fillType>> &reduction, bool moduleNameAdd, int type)
|
||||
{
|
||||
bool error = false;
|
||||
if (stIn)
|
||||
{
|
||||
SgStatement *st = stIn->GetOriginal();
|
||||
if (st->variant() == SPF_ANALYSIS_DIR)
|
||||
if (st->variant() == type)
|
||||
{
|
||||
SgExpression *exprList = st->expr(0);
|
||||
SgExpression* exprList = NULL;
|
||||
if (type == SPF_ANALYSIS_DIR)
|
||||
exprList = st->expr(0);
|
||||
else if (type == DVM_PARALLEL_ON_DIR)
|
||||
exprList = st->expr(1);
|
||||
|
||||
while (exprList)
|
||||
{
|
||||
if (exprList->lhs()->variant() == REDUCTION_OP)
|
||||
@@ -188,19 +193,24 @@ void fillReductionsFromComment(Statement *stIn, map<string, set<fillType>> &redu
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<string>> &reduction, bool);
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<Symbol*>> &reduction, bool);
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<string>> &reduction, bool, int);
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<Symbol*>> &reduction, bool, int);
|
||||
|
||||
//for min/max loc reduction
|
||||
template<typename fillType>
|
||||
void fillReductionsFromComment(Statement *stIn, map<string, set<tuple<fillType, fillType, int>>> &reduction, bool moduleNameAdd)
|
||||
void fillReductionsFromComment(Statement *stIn, map<string, set<tuple<fillType, fillType, int>>> &reduction, bool moduleNameAdd, int type)
|
||||
{
|
||||
if (stIn)
|
||||
{
|
||||
SgStatement *st = stIn->GetOriginal();
|
||||
if (st->variant() == SPF_ANALYSIS_DIR)
|
||||
if (st->variant() == type)
|
||||
{
|
||||
SgExpression *exprList = st->expr(0);
|
||||
SgExpression* exprList = NULL;
|
||||
if (type == SPF_ANALYSIS_DIR)
|
||||
exprList = st->expr(0);
|
||||
else if (type == DVM_PARALLEL_ON_DIR)
|
||||
exprList = st->expr(1);
|
||||
|
||||
while (exprList)
|
||||
{
|
||||
if (exprList->lhs()->variant() == REDUCTION_OP)
|
||||
@@ -241,8 +251,8 @@ void fillReductionsFromComment(Statement *stIn, map<string, set<tuple<fillType,
|
||||
}
|
||||
}
|
||||
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<tuple<string, string, int>>> &reduction, bool);
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<tuple<Symbol*, Symbol*, int>>> &reduction, bool);
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<tuple<string, string, int>>> &reduction, bool, int);
|
||||
template void fillReductionsFromComment(Statement *st, map<string, set<tuple<Symbol*, Symbol*, int>>> &reduction, bool, int);
|
||||
|
||||
void fillParameterFromComment(Statement *stIn, vector<pair<Expression*, Expression*>> &assigns)
|
||||
{
|
||||
@@ -598,6 +608,28 @@ void fillInfoFromDirectives(const LoopGraph *loopInfo, ParallelDirective *direct
|
||||
}
|
||||
}
|
||||
|
||||
void fillInfoFromDirective(Statement* parallel_on, DvmDirective& directive)
|
||||
{
|
||||
Statement* sData = parallel_on;
|
||||
|
||||
fillReductionsFromComment(sData, directive.reduction, true, DVM_PARALLEL_ON_DIR);
|
||||
fillReductionsFromComment(sData, directive.reductionLoc, true, DVM_PARALLEL_ON_DIR);
|
||||
|
||||
fillShadowAcrossFromParallel(SHADOW_RENEW_OP, sData, directive.shadowRenew, directive.corners);
|
||||
fillShadowAcrossFromParallel(ACROSS_OP, sData, directive.across, directive.corners);
|
||||
|
||||
//TODO:
|
||||
/*map<pair<Symbol*, string>, Expression*> remotes;
|
||||
fillRemoteFromComment(sData, remotes, false, DVM_PARALLEL_ON_DIR);
|
||||
for (auto& elem : remotes)
|
||||
{
|
||||
SgSymbol* symb = OriginalSymbol(elem.first.first->GetOriginal());
|
||||
auto uniqKey = getFromUniqTable(symb);
|
||||
|
||||
directive.remoteAccess[make_pair(make_pair(elem.first.first->GetOriginal()->identifier(), getShortName(uniqKey)), elem.first.second)] = new Expression(elem.second->GetOriginal());
|
||||
}*/
|
||||
}
|
||||
|
||||
int getCoverPropertyFromComment(Statement* stIn)
|
||||
{
|
||||
if (stIn)
|
||||
|
||||
@@ -8,16 +8,26 @@
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../Distribution/DvmhDirective.h"
|
||||
|
||||
struct DvmDirective
|
||||
{
|
||||
std::set<Symbol*> corners;
|
||||
std::vector<std::pair<std::pair<Symbol*, std::string>, std::vector<std::pair<int, int>>>> shadowRenew, across;
|
||||
std::map<std::pair<std::pair<std::string, std::string>, std::string>, Expression*> remoteAccess;
|
||||
|
||||
std::map<std::string, std::set<Symbol*>> reduction;
|
||||
std::map<std::string, std::set<std::tuple<Symbol*, Symbol*, int>>> reductionLoc;
|
||||
};
|
||||
|
||||
bool isSPF_NoInline(Statement *stPrev);
|
||||
|
||||
template<typename fillType>
|
||||
void fillPrivatesFromComment(Statement *st, std::set<fillType> &privates, int type = -1);
|
||||
|
||||
template<typename fillType>
|
||||
void fillReductionsFromComment(Statement *st, std::map<std::string, std::set<fillType>> &reduction, bool moduleNameAdd = false);
|
||||
void fillReductionsFromComment(Statement *st, std::map<std::string, std::set<fillType>> &reduction, bool moduleNameAdd = false, int type = SPF_ANALYSIS_DIR);
|
||||
|
||||
template<typename fillType>
|
||||
void fillReductionsFromComment(Statement *st, std::map<std::string, std::set<std::tuple<fillType, fillType, int>>> &reduction, bool moduleNameAdd = false);
|
||||
void fillReductionsFromComment(Statement *st, std::map<std::string, std::set<std::tuple<fillType, fillType, int>>> &reduction, bool moduleNameAdd = false, int type = SPF_ANALYSIS_DIR);
|
||||
|
||||
void fillParameterFromComment(Statement *st, std::vector<std::pair<Expression*, Expression*>> &assigns);
|
||||
|
||||
@@ -32,6 +42,7 @@ void fillRemoteFromComment(Statement *st, std::map<std::pair<fillType, std::stri
|
||||
|
||||
void fillAcrossInfoFromDirectives(const LoopGraph *loopInfo, std::vector<std::pair<std::pair<std::string, std::string>, std::vector<std::pair<int, int>>>> &acrossInfo);
|
||||
void fillInfoFromDirectives(const LoopGraph *loopInfo, ParallelDirective *directive);
|
||||
void fillInfoFromDirective(Statement* parallel_on, DvmDirective& directive);
|
||||
|
||||
void fillFissionPrivatesExpansionFromComment(Statement *stIn, std::vector<std::string> &vars);
|
||||
|
||||
|
||||
@@ -837,9 +837,9 @@ static pair<string, string> getModuleRename(const map<string, set<SgSymbol*>>& b
|
||||
{
|
||||
auto declS = array->GetDeclSymbol(filename, lineRange, getAllFilesInProject())->GetOriginal();
|
||||
for (auto& elem : byUse)
|
||||
for (auto& localS : elem.second)
|
||||
if (OriginalSymbol(localS) == declS)
|
||||
return make_pair(elem.first, localS->identifier());
|
||||
for (auto& localS : setToMapWithSortByStr(elem.second))
|
||||
if (OriginalSymbol(localS.second) == declS)
|
||||
return make_pair(elem.first, localS.second->identifier());
|
||||
return make_pair("", "");
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ static void replaceShadowByRemote(SgExpression *specInDir, SgStatement *stat,
|
||||
|
||||
void devourShadowByRemote(void *file_, const map<string, FuncInfo*>& funcMap, const vector<LoopGraph*>& loops,
|
||||
const map<DIST::Array*, set<DIST::Array*>> &arrayLinksByFuncCalls)
|
||||
{
|
||||
{
|
||||
SgFile* file = static_cast<SgFile*>(file_);
|
||||
map<int, LoopGraph*> loopByLine;
|
||||
createMapLoopGraph(loops, loopByLine);
|
||||
|
||||
@@ -172,14 +172,6 @@ static SgExpression* genSgExpr(SgFile *file, const string &letter, const pair<in
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static std::multimap<string, Symbol*> setToMapWithSortByStr(const set<Symbol*> &setIn)
|
||||
{
|
||||
std::multimap<string, Symbol*> retMap;
|
||||
for (auto& elem : setIn)
|
||||
retMap.insert(make_pair(elem->identifier(), elem));
|
||||
return retMap;
|
||||
}
|
||||
|
||||
static void fillUsedSymbols(SgExpression* ex, set<SgSymbol*>& used)
|
||||
{
|
||||
if (ex)
|
||||
|
||||
@@ -297,7 +297,7 @@ static bool hasLoopsWithDir(LoopGraph* loop)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static void analyzeFunctionParameter(SgExpression* ex, set<string>& except, ArraySet& arrays)
|
||||
static void analyzeFunctionParameter(SgExpression* ex, set<string>& except, ArraySet& arrays, bool isIntrinsicCall)
|
||||
{
|
||||
if (ex)
|
||||
{
|
||||
@@ -313,45 +313,50 @@ static void analyzeFunctionParameter(SgExpression* ex, set<string>& except, Arra
|
||||
if (ex->lhs() || ex->rhs())
|
||||
arrays.insert(currArray);
|
||||
else if (!ex->lhs() && !ex->rhs())
|
||||
except.insert(ex->symbol()->identifier());
|
||||
{
|
||||
if (isIntrinsicCall)
|
||||
arrays.insert(currArray);
|
||||
else
|
||||
except.insert(ex->symbol()->identifier());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
analyzeFunctionParameter(ex->lhs(), except, arrays);
|
||||
analyzeFunctionParameter(ex->rhs(), except, arrays);
|
||||
analyzeFunctionParameter(ex->lhs(), except, arrays, isIntrinsicCall);
|
||||
analyzeFunctionParameter(ex->rhs(), except, arrays, isIntrinsicCall);
|
||||
}
|
||||
}
|
||||
|
||||
static void analyzeFunctionParameters(SgExpression* paramList, set<string>& except, ArraySet& arrays)
|
||||
static void analyzeFunctionParameters(SgExpression* paramList, set<string>& except, ArraySet& arrays, bool isIntrinsicCall)
|
||||
{
|
||||
while (paramList)
|
||||
{
|
||||
SgExpression* ex = paramList->lhs();
|
||||
if (ex->variant() == FUNC_CALL)
|
||||
{
|
||||
if (!isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||
bool isIntrinsic = isIntrinsicFunctionName(ex->symbol()->identifier());
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays, isIntrinsic);
|
||||
}
|
||||
else
|
||||
analyzeFunctionParameter(ex, except, arrays);
|
||||
|
||||
analyzeFunctionParameter(ex, except, arrays, isIntrinsicCall);
|
||||
|
||||
paramList = paramList->rhs();
|
||||
}
|
||||
}
|
||||
|
||||
static void createExceptList(SgExpression* ex, set<string>& except, ArraySet& arrays)
|
||||
static void createExceptListFromFunctionParameters(SgExpression* ex, set<string>& except, ArraySet& arrays, bool forGetActual)
|
||||
{
|
||||
if (ex)
|
||||
{
|
||||
if (ex->variant() == FUNC_CALL)
|
||||
{
|
||||
if (!isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||
bool isIntrinsic = isIntrinsicFunctionName(ex->symbol()->identifier()) && forGetActual;
|
||||
analyzeFunctionParameters(ex->lhs(), except, arrays, isIntrinsic);
|
||||
}
|
||||
else
|
||||
{
|
||||
createExceptList(ex->lhs(), except, arrays);
|
||||
createExceptList(ex->rhs(), except, arrays);
|
||||
createExceptListFromFunctionParameters(ex->lhs(), except, arrays, forGetActual);
|
||||
createExceptListFromFunctionParameters(ex->rhs(), except, arrays, forGetActual);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,7 +387,6 @@ ArraySet DvmhRegionInserter::excludeRemotes(const ArraySet& block, SgStatement*
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
SgStatement* next = remoteDir->lexNext();
|
||||
const string leftS = "";
|
||||
|
||||
//TODO: record ref!
|
||||
if (next->variant() == ASSIGN_STAT)
|
||||
@@ -402,9 +406,6 @@ ArraySet DvmhRegionInserter::excludeRemotes(const ArraySet& block, SgStatement*
|
||||
|
||||
for (auto& remArray : remotes)
|
||||
{
|
||||
if (leftS == OriginalSymbol(remArray->symbol())->identifier())
|
||||
continue;
|
||||
|
||||
auto arrayR = OriginalSymbol(remArray->symbol());
|
||||
SgStatement* decl = declaratedInStmt(arrayR);
|
||||
DIST::Array* currArray = getArrayFromDeclarated(decl, arrayR->identifier());
|
||||
@@ -441,7 +442,7 @@ void DvmhRegionInserter::insertForProcCall(SgStatement* st, bool& skipGetActualI
|
||||
|
||||
ArraySet arraysToGetActual, arraysToActual;
|
||||
set<string> exceptSymbs;
|
||||
analyzeFunctionParameters(st->expr(0), exceptSymbs, arraysToGetActual);
|
||||
analyzeFunctionParameters(st->expr(0), exceptSymbs, arraysToGetActual, false);
|
||||
|
||||
auto writeArrays = get_used_arrs(st, DVMH_REG_WT);
|
||||
writeArrays = excludePrivates(writeArrays);
|
||||
@@ -526,18 +527,24 @@ SgStatement* DvmhRegionInserter::processSt(SgStatement *st, const vector<Paralle
|
||||
auto writeBlocks = get_used_arrs_for_block(st, DVMH_REG_WT);
|
||||
|
||||
readBlocks = excludePrivates(readBlocks);
|
||||
readBlocks = applyUseFilter(readBlocks, usedArraysInParallelLoops);
|
||||
if (raDir)
|
||||
readBlocks = excludeRemotes(readBlocks, raDir);
|
||||
|
||||
readBlocks = applyUseFilter(readBlocks, writesToArraysInParallelLoops);
|
||||
//TODO: need to exclude remotes when the analysis will be clarified
|
||||
/*if (raDir)
|
||||
readBlocks = excludeRemotes(readBlocks, raDir);*/
|
||||
|
||||
writeBlocks = excludePrivates(writeBlocks);
|
||||
writeBlocks = applyUseFilter(writeBlocks, usedArraysInParallelLoops);
|
||||
writeBlocks = applyUseFilter(writeBlocks, writesToArraysInParallelLoops);
|
||||
|
||||
ArraySet unite;
|
||||
std::merge(readBlocks.begin(), readBlocks.end(), writeBlocks.begin(), writeBlocks.end(), std::inserter(unite, unite.end()));
|
||||
|
||||
if (!(block_dir->variant() == DVM_REMOTE_ACCESS_DIR && st->variant() == ASSIGN_STAT && readBlocks.size() == 0))
|
||||
insertActualDirective(block_dir, unite, ACC_GET_ACTUAL_DIR, true);
|
||||
|
||||
writeBlocks = get_used_arrs_for_block(st, DVMH_REG_WT);
|
||||
writeBlocks = excludePrivates(writeBlocks);
|
||||
writeBlocks = applyUseFilter(writeBlocks, usedArraysInParallelLoops);
|
||||
|
||||
insertActualDirective(st->lastNodeOfStmt()->lexNext(), writeBlocks, ACC_ACTUAL_DIR, false);
|
||||
}
|
||||
return st->lastNodeOfStmt()->lexNext();
|
||||
@@ -570,7 +577,7 @@ SgStatement* DvmhRegionInserter::processSt(SgStatement *st, const vector<Paralle
|
||||
|
||||
if (var != WRITE_STAT)
|
||||
for (int z = 0; z < 3; ++z)
|
||||
createExceptList(st->expr(z), exceptSymbsForGetActual, forGetActual);
|
||||
createExceptListFromFunctionParameters(st->expr(z), exceptSymbsForGetActual, forGetActual, true);
|
||||
|
||||
auto readArrays = get_used_arrs(st, DVMH_REG_RD);
|
||||
readArrays = excludePrivates(readArrays);
|
||||
@@ -588,7 +595,7 @@ SgStatement* DvmhRegionInserter::processSt(SgStatement *st, const vector<Paralle
|
||||
|
||||
if (var != READ_STAT)
|
||||
for (int z = 0; z < 3; ++z)
|
||||
createExceptList(st->expr(z), exceptSymbsForActual, forActual);
|
||||
createExceptListFromFunctionParameters(st->expr(z), exceptSymbsForActual, forActual, false);
|
||||
|
||||
auto writeArrays = get_used_arrs(st, DVMH_REG_WT);
|
||||
writeArrays = excludePrivates(writeArrays);
|
||||
|
||||
@@ -62,10 +62,13 @@ VarUsages ReadWriteAnalyzer::findUsagesInAssignment(SgStatement* st) const
|
||||
// load usages from array indexes
|
||||
VarUsages usages_in_arr_indexing = findUsagesInExpr(st->expr(1)->lhs());
|
||||
usages.extend(usages_in_arr_indexing);
|
||||
|
||||
usages_in_arr_indexing = findUsagesInExpr(st->expr(1)->rhs());
|
||||
usages.extend(usages_in_arr_indexing);
|
||||
|
||||
usages_in_arr_indexing = findUsagesInExpr(st->expr(0)->lhs());
|
||||
usages.extend(usages_in_arr_indexing);
|
||||
|
||||
usages_in_arr_indexing = findUsagesInExpr(st->expr(0)->rhs());
|
||||
usages.extend(usages_in_arr_indexing);
|
||||
|
||||
@@ -124,7 +127,8 @@ VarUsages ReadWriteAnalyzer::findUsagesInFuncCall(SgExpression* params_tree, con
|
||||
VarUsages usages;
|
||||
|
||||
vector<int> inOutTypes;
|
||||
if (!isIntrinsicFunctionName(func_key.c_str()))
|
||||
bool isIntrinsic = isIntrinsicFunctionName(func_key.c_str());
|
||||
if (!isIntrinsic)
|
||||
{
|
||||
auto it = modified_pars.find(func_key);
|
||||
if (it != modified_pars.end())
|
||||
@@ -216,7 +220,8 @@ VarUsages ReadWriteAnalyzer::findUsagesInFuncCall(SgExpression* params_tree, con
|
||||
else
|
||||
{
|
||||
usages.insert_read(param);
|
||||
usages.insert_write(param);
|
||||
if (!isIntrinsic)
|
||||
usages.insert_write(param);
|
||||
}
|
||||
|
||||
findReadUsagesInExpression(param->lhs(), usages);
|
||||
|
||||
@@ -2513,7 +2513,7 @@ void fillInterfaceBlock(map<string, vector<FuncInfo*>>& allFuncInfo)
|
||||
for (auto& byFile : allFuncInfo)
|
||||
{
|
||||
for (auto& func : byFile.second)
|
||||
{
|
||||
{
|
||||
for (auto& interface : func->interfaceBlocks)
|
||||
{
|
||||
auto itF = mapOfFunc.find(interface.first);
|
||||
@@ -2534,6 +2534,13 @@ void fillInterfaceBlock(map<string, vector<FuncInfo*>>& allFuncInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//filted interfaces
|
||||
map<string, FuncInfo*> copy = func->interfaceBlocks;
|
||||
func->interfaceBlocks.clear();
|
||||
for (auto& interface : func->interfaceBlocks)
|
||||
if (interface.second)
|
||||
func->interfaceBlocks[interface.first] = interface.second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,44 @@ struct FuncInfo
|
||||
if (names.size() == 1)
|
||||
return *names.begin();
|
||||
|
||||
//try to find in next lvl calls
|
||||
for (auto& call : callsFromDetailed)
|
||||
{
|
||||
if (call.detailCallsFrom.second == line)
|
||||
{
|
||||
std::string name_next = call.detailCallsFrom.first;
|
||||
std::set<FuncInfo*> next, done;
|
||||
|
||||
for (auto& callFrom : callsFromV)
|
||||
if (callFrom->funcName == name_next)
|
||||
next.insert(callFrom);
|
||||
|
||||
done = next;
|
||||
while (next.size())
|
||||
{
|
||||
auto curr = next;
|
||||
next.clear();
|
||||
|
||||
for (auto& callFrom : curr)
|
||||
{
|
||||
for (auto& call : callFrom->callsFromDetailed)
|
||||
{
|
||||
if (call.detailCallsFrom.first == name)
|
||||
return call.detailCallsFrom.first;
|
||||
}
|
||||
|
||||
for (auto& callFromNext : callFrom->callsFromV)
|
||||
{
|
||||
if (done.find(callFromNext) == done.end())
|
||||
{
|
||||
next.insert(callFromNext);
|
||||
done.insert(callFromNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1483,9 +1483,8 @@ static bool run_inliner(const map<string, FuncInfo*>& funcMap, set<SgStatement*>
|
||||
{
|
||||
wstring messageE, messageR;
|
||||
__spf_printToLongBuf(messageE, L"It is allowed to inline function only at execution code section.");
|
||||
#ifdef _WIN32
|
||||
__spf_printToLongBuf(messageR, R177);
|
||||
#endif
|
||||
|
||||
getObjectForFileFromMap(fileName.c_str(), SPF_messages).push_back(Messages(ERROR, insertPlace->lineNumber(), messageR, messageE, 2011));
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
@@ -1689,6 +1688,18 @@ static map<FuncInfo*, set<SgStatement*>> fillNextDeep(const set<SgStatement*>& i
|
||||
return nextInfo;
|
||||
}
|
||||
|
||||
static void addMessage(bool status, map<string, vector<Messages>>& SPF_messages, const string& fileName, const int line)
|
||||
{
|
||||
if (status == true)
|
||||
return;
|
||||
|
||||
wstring messageE, messageR;
|
||||
__spf_printToLongBuf(messageE, L"Function inlining failed with an error.");
|
||||
__spf_printToLongBuf(messageR, R193);
|
||||
|
||||
getObjectForFileFromMap(fileName.c_str(), SPF_messages).push_back(Messages(ERROR, line, messageR, messageE, 2020));
|
||||
}
|
||||
|
||||
static bool inliner(const string& fileName_in, const string& funcName, const int lineNumber,
|
||||
const map<string, vector<FuncInfo*>>& allFuncInfo, map<string, vector<Messages>>& SPF_messages,
|
||||
map<SgStatement*, set<SgSymbol*>>& newSymbsToDeclare, const map<string, CommonBlock*>& commonBlocks,
|
||||
@@ -1773,6 +1784,7 @@ static bool inliner(const string& fileName_in, const string& funcName, const int
|
||||
//1 level
|
||||
bool isInlined = run_inliner(funcMap, toInsert, SPF_messages, fileName, func, newSymbsToDeclare, point, commonBlocks);
|
||||
__spf_print(1, "%s\n", isInlined ? "done" : "fault");
|
||||
addMessage(isInlined, SPF_messages, fileName, lineNumber);
|
||||
|
||||
if (isInlined == false)
|
||||
{
|
||||
@@ -1807,6 +1819,8 @@ static bool inliner(const string& fileName_in, const string& funcName, const int
|
||||
__spf_print(1, " INLINE %s - ", next.first->funcName.c_str());
|
||||
bool isInlined = run_inliner(funcMap, next.second, SPF_messages, fileName, next.first, newSymbsToDeclare, point, commonBlocks);
|
||||
__spf_print(1, "%s\n", isInlined ? "done" : "fault");
|
||||
addMessage(isInlined, SPF_messages, fileName, lineNumber);
|
||||
|
||||
changed |= isInlined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,13 +958,13 @@ static bool replaceCommonArray(const string &fileName,
|
||||
return false;
|
||||
}
|
||||
|
||||
static pair<SgSymbol*, SgSymbol*> copyArray(const pair<string, int> &place,
|
||||
const DIST::Array *array,
|
||||
const vector<ParallelRegionLines>& lines,
|
||||
const string &suffix,
|
||||
string& filename,
|
||||
map<string, map<int, set<string>>>& newDeclsToInclude,
|
||||
map<string, map<int, set<string>>>& copied)
|
||||
pair<SgSymbol*, SgSymbol*> copyArray(const pair<string, int> &place,
|
||||
const DIST::Array *array,
|
||||
const vector<ParallelRegionLines>& lines,
|
||||
const string &suffix,
|
||||
string& filename,
|
||||
map<string, map<int, set<string>>>& newDeclsToInclude,
|
||||
map<string, map<int, set<string>>>& copied)
|
||||
{
|
||||
string fileName = place.first;
|
||||
int switchRes = SgFile::switchToFile(fileName);
|
||||
|
||||
@@ -13,4 +13,12 @@ int printCheckRegions(const char *fileName, const std::vector<ParallelRegion*> &
|
||||
|
||||
bool checkRegionsResolving(const std::vector<ParallelRegion*> ®ions, const std::map<std::string, std::vector<FuncInfo*>> &allFuncInfo, const std::map<std::string, CommonBlock*> &commonBlocks, std::map<std::string, std::vector<Messages>> &SPF_messages, bool sharedMemoryParallelization);
|
||||
int resolveParRegions(std::vector<ParallelRegion*>& regions, const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, std::map<std::string, std::vector<Messages>>& SPF_messages, bool sharedMemoryParallelization, std::map<std::string, std::map<int, std::set<std::string>>>& copyDecls);
|
||||
void insertRealignsBeforeFragments(ParallelRegion* reg, SgFile* file, const std::set<DIST::Array*>& distrArrays, const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls);
|
||||
void insertRealignsBeforeFragments(ParallelRegion* reg, SgFile* file, const std::set<DIST::Array*>& distrArrays, const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls);
|
||||
|
||||
std::pair<SgSymbol*, SgSymbol*> copyArray(const std::pair<std::string, int>& place,
|
||||
const DIST::Array* array,
|
||||
const std::vector<ParallelRegionLines>& lines,
|
||||
const std::string& suffix,
|
||||
std::string& filename,
|
||||
std::map<std::string, std::map<int, std::set<std::string>>>& newDeclsToInclude,
|
||||
std::map<std::string, std::map<int, std::set<std::string>>>& copied);
|
||||
@@ -16,12 +16,25 @@
|
||||
#include "../DynamicAnalysis/gcov_info.h"
|
||||
#include "PredictScheme.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
#include "../Distribution/DvmhDirective.h"
|
||||
#include "../GraphLoop/graph_loops_func.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../CFGraph/CFGraph.h"
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::set;
|
||||
using std::ofstream;
|
||||
using std::pair;
|
||||
using std::tuple;
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
static void fillParallel(SgExpression *exp, ParallelStats &parStats, int &totalScoreComm)
|
||||
{
|
||||
@@ -125,7 +138,7 @@ void processFileToPredict(SgFile *file, PredictorStats &predictorCounts)
|
||||
predictorCounts.TotalScorePar += predictorCounts.ParallelCount;
|
||||
}
|
||||
|
||||
static void calculate_for_parallel_loop(SgStatement* loop, const map<int, Gcov_info>& gcov,
|
||||
static void calculateForParallelLoop(SgStatement* loop, const map<int, Gcov_info>& gcov,
|
||||
uint64_t& paralle_exec_count, uint64_t& count_of_parallel_lines) {
|
||||
for (auto st = loop; st != loop->lastNodeOfStmt(); st = st->lexNext()) {
|
||||
int line = st->lineNumber();
|
||||
@@ -150,51 +163,506 @@ static void calculate_for_parallel_loop(SgStatement* loop, const map<int, Gcov_i
|
||||
}
|
||||
}
|
||||
|
||||
void calculate_stats_for_predictor(const map<string, vector<FuncInfo*>>& allFuncInfo,
|
||||
const map<string, map<int, Gcov_info>>& gCovInfo) {
|
||||
uint64_t paralle_exec_count = 0;
|
||||
static json info;
|
||||
|
||||
void calculateStatsForPredictor(const map<string, vector<FuncInfo*>>& allFuncInfo,
|
||||
const map<string, map<int, Gcov_info>>& gCovInfo) {
|
||||
|
||||
json cluster;
|
||||
json program;
|
||||
|
||||
cluster["cluster_info"] = { {"num_nodes", 0},
|
||||
{"cores_per_node", 0},
|
||||
{"threads_per_node", 0},
|
||||
{"memory_per_node_gb", 0},
|
||||
{"network_bandwidth_gbps", 0},
|
||||
{"network_latency_ms", 0}
|
||||
};
|
||||
|
||||
program["program_info"]["sequential_execution_time_sec"] = 0.0;
|
||||
program["program_info"]["launch_grid"] = { {"dimensions", {0, 0, 0} }, {"total_processes", 0} };
|
||||
|
||||
uint64_t total_exec_count = 0;
|
||||
uint64_t parallel_exec_count = 0;
|
||||
uint64_t count_of_parallel_lines = 0;
|
||||
|
||||
for (auto& byFile : allFuncInfo) {
|
||||
for (auto& byFile : allFuncInfo)
|
||||
{
|
||||
int ok = SgFile::switchToFile(byFile.first);
|
||||
if (ok == -1)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
auto it = gCovInfo.find(byFile.first);
|
||||
if (it == gCovInfo.end()) {
|
||||
if (it == gCovInfo.end())
|
||||
{
|
||||
__spf_print(1, "bad gcov info\n");
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
auto& gcov = it->second;
|
||||
for (auto& func : byFile.second) {
|
||||
for (auto& func : byFile.second)
|
||||
{
|
||||
SgStatement* stat = func->funcPointer->GetOriginal();
|
||||
|
||||
for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext()) {
|
||||
for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext())
|
||||
{
|
||||
uint64_t paralle_exec = 0;
|
||||
uint64_t lines_count = 0;
|
||||
|
||||
if (st->variant() == DVM_PARALLEL_ON_DIR) {
|
||||
if (st->variant() == DVM_PARALLEL_ON_DIR)
|
||||
{
|
||||
auto loop = st->lexNext();
|
||||
checkNull(loop, convertFileName(__FILE__).c_str(), __LINE__);
|
||||
if (loop->variant() != FOR_NODE)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
calculate_for_parallel_loop(loop, gcov, paralle_exec, lines_count);
|
||||
calculateForParallelLoop(loop, gcov, paralle_exec, lines_count);
|
||||
st = loop->lastNodeOfStmt();
|
||||
|
||||
paralle_exec_count += paralle_exec;
|
||||
parallel_exec_count += paralle_exec;
|
||||
count_of_parallel_lines += lines_count;
|
||||
|
||||
__spf_print(1, " PAR LOOP [%d %s] total exec %llu, total exec lines %llu, avg %.16e\n",
|
||||
loop->lineNumber(), byFile.first.c_str(), paralle_exec, lines_count, paralle_exec / (double)lines_count);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext())
|
||||
{
|
||||
if (!isSgExecutableStatement(st) || isDVM_stat(st) || isSPF_stat(st))
|
||||
continue;
|
||||
|
||||
int line = st->lineNumber();
|
||||
if (line <= 0)
|
||||
continue;
|
||||
|
||||
auto it = gcov.find(line);
|
||||
if (it == gcov.end())
|
||||
continue;
|
||||
|
||||
auto& info = it->second;
|
||||
if (info.getNumLine() != line)
|
||||
{
|
||||
__spf_print(1, "bad gcov info\n");
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
total_exec_count += info.getExecutedCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__spf_print(1, " coverage_average %.16e\n", paralle_exec_count / (double)count_of_parallel_lines);
|
||||
ofstream stats("stats.csv");
|
||||
stats << "coverage_average;" << paralle_exec_count / (double)count_of_parallel_lines << std::endl;
|
||||
stats.close();
|
||||
__spf_print(1, " average_parallel_exec %.16e\n", parallel_exec_count / (double)count_of_parallel_lines);
|
||||
__spf_print(1, " parallel_rate %.16e\n", parallel_exec_count / (double)total_exec_count);
|
||||
|
||||
program["program_info"]["average_parallel_line_executions"] = parallel_exec_count / (double)count_of_parallel_lines;
|
||||
program["program_info"]["parallel_execution_fraction"] = parallel_exec_count / (double)total_exec_count;
|
||||
|
||||
info = { cluster, program };
|
||||
}
|
||||
|
||||
static const Gcov_info& getInfo(SgStatement* st, const map<int, Gcov_info> &gcov)
|
||||
{
|
||||
auto stat = st;
|
||||
while (isDVM_stat(stat))
|
||||
stat = stat->lexPrev();
|
||||
int line = stat->lineNumber(); // XXX
|
||||
|
||||
auto list = st->expr(1);
|
||||
auto it = gcov.find(line);
|
||||
auto& info = it->second;
|
||||
if (info.getNumLine() != line)
|
||||
{
|
||||
__spf_print(1, "bad gcov info\n");
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static json parseDistribution(const map<DIST::Array*, int>& byPos, SgSymbol* arr, SgExpression* list, int line)
|
||||
{
|
||||
json dist;
|
||||
auto array = getArrayFromDeclarated(declaratedInStmt(arr), arr->identifier());
|
||||
if (array == NULL || byPos.find(array) == byPos.end())
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
dist["line"] = line;
|
||||
dist["array_id"] = byPos.at(array);
|
||||
|
||||
while (list)
|
||||
{
|
||||
dist["distribution_spec"].push_back(list->lhs()->unparse());
|
||||
list = list->rhs();
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
||||
static json parseAlign(const map<DIST::Array*, int>& byPos, SgSymbol* srcArr, SgSymbol* tgtArr,
|
||||
SgExpression *listSrc, SgExpression* listTgt, int line)
|
||||
{
|
||||
json align;
|
||||
|
||||
auto arraySrc = getArrayFromDeclarated(declaratedInStmt(srcArr), srcArr->identifier());
|
||||
if (arraySrc == NULL || byPos.find(arraySrc) == byPos.end())
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
auto arrayTgt = getArrayFromDeclarated(declaratedInStmt(tgtArr), tgtArr->identifier());
|
||||
if (arrayTgt == NULL || byPos.find(arrayTgt) == byPos.end())
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
align["line"] = line;
|
||||
align["source_array_id"] = byPos.at(arraySrc);
|
||||
align["target_array_id"] = byPos.at(arrayTgt);
|
||||
|
||||
vector<pair<string, SgSymbol*>> srcSymbs;
|
||||
auto list = listSrc;
|
||||
while (list)
|
||||
{
|
||||
srcSymbs.push_back({ list->lhs()->unparse(), list->lhs()->symbol() });
|
||||
list = list->rhs();
|
||||
}
|
||||
|
||||
vector<pair<int, int>> coefs(srcSymbs.size());
|
||||
list = listTgt;
|
||||
while (list)
|
||||
{
|
||||
auto exp = list->lhs();
|
||||
bool has = false;
|
||||
for (int z = 0; z < srcSymbs.size(); ++z)
|
||||
{
|
||||
has = recSymbolFind(exp, srcSymbs[z].first, VAR_REF);
|
||||
if (has)
|
||||
{
|
||||
getCoefsOfSubscript(coefs[z], exp, srcSymbs[z].second);
|
||||
if (coefs[z].first == 0)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
list = list->rhs();
|
||||
}
|
||||
|
||||
for (int z = 0; z < coefs.size(); ++z)
|
||||
{
|
||||
if (coefs[z].first == 0)
|
||||
continue;
|
||||
if (coefs[z].second)
|
||||
align["rules"].push_back({ z, coefs[z].first });
|
||||
else
|
||||
align["rules"].push_back({ z, coefs[z].first, coefs[z].second });
|
||||
}
|
||||
return align;
|
||||
}
|
||||
|
||||
static SgStatement* findBefore(SgStatement* st)
|
||||
{
|
||||
while (st)
|
||||
{
|
||||
st = st->lexPrev();
|
||||
|
||||
if (isSgProgHedrStmt(st))
|
||||
break;
|
||||
if (isDVM_stat(st) || isSPF_stat(st))
|
||||
continue;
|
||||
if (isSgExecutableStatement(st))
|
||||
break;
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
static void fillAcrossShadow(vector<pair<pair<Symbol*, string>, vector<pair<int, int>>>>& dirs, SgStatement *st,
|
||||
const map<DIST::Array*, int>& byPos, const string& type, json& typed, json& parallel)
|
||||
{
|
||||
for (auto& dir : dirs)
|
||||
{
|
||||
auto& symb = dir.first;
|
||||
auto& access = dir.second;
|
||||
|
||||
DIST::Array* arr = getArrayFromDeclarated(declaratedInStmt(symb.first), symb.first->identifier());
|
||||
if (arr == NULL || byPos.find(arr) == byPos.end())
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
json item;
|
||||
item["line"] = st->lineNumber();
|
||||
item["array_id"] = byPos.at(arr);
|
||||
item["communication_pattern"] = "NEAREST_NEIGHBOR";
|
||||
|
||||
if (access.size())
|
||||
{
|
||||
for (int z = 0; z < access.size(); ++z)
|
||||
item["width"].push_back({ z, access[z].first, access[z].second });
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& spec = arr->GetShadowSpec();
|
||||
//TODO: analyze spec of array for shadow
|
||||
for (int z = 0; z < spec.size(); ++z)
|
||||
item["width"].push_back({ z, 1, 1 });
|
||||
}
|
||||
|
||||
typed.push_back(item);
|
||||
parallel["shadow_renews"].push_back(typed.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void parallelDir(const map<DIST::Array*, int>& byPos, SgExpression* spec, SgSymbol* arr, SgExpression* arrSpec,
|
||||
SgStatement* st, SgExpression* clauses, const map<int, Gcov_info>& gcov, json& directives,
|
||||
const map<string, CommonBlock*>& commonBlocks, const map<string, vector<FuncInfo*>>& allFuncInfo)
|
||||
{
|
||||
json parallel;
|
||||
|
||||
json& shadow_renew = directives["shadow_renew"];
|
||||
json& reduction = directives["reduction"];
|
||||
json& remote_access = directives["remote_access"];
|
||||
json& across = directives["across"];
|
||||
|
||||
vector<pair<string, SgSymbol*>> loopSymbs;
|
||||
auto list = spec;
|
||||
while (list)
|
||||
{
|
||||
loopSymbs.push_back({ list->lhs()->unparse(), list->lhs()->symbol() });
|
||||
list = list->rhs();
|
||||
}
|
||||
|
||||
parallel["line"] = st->lineNumber();
|
||||
parallel["loops_count"] = loopSymbs.size();
|
||||
|
||||
SgStatement* loop = isSgForStmt(st->lexNext());
|
||||
if (loop == NULL)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
SgStatement* lastNode = loop->lastNodeOfStmt();
|
||||
|
||||
SgStatement* before = findBefore(loop);
|
||||
if (before == NULL)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
vector<int64_t> execs;
|
||||
for (int z = 0; z < loopSymbs.size(); ++z)
|
||||
{
|
||||
auto& info = getInfo(loop, gcov);
|
||||
execs.push_back(info.getExecutedCount());
|
||||
loop = loop->lexNext();
|
||||
}
|
||||
|
||||
for (int z = execs.size() - 1; z > 0; --z)
|
||||
execs[z] /= execs[z - 1];
|
||||
|
||||
auto& info = getInfo(before, gcov);
|
||||
execs[0] /= info.getExecutedCount();
|
||||
|
||||
parallel["iterations_count"] = execs;
|
||||
|
||||
DvmDirective directive;
|
||||
fillInfoFromDirective(new Statement(st), directive);
|
||||
|
||||
vector<int> empty;
|
||||
parallel["shadow_renews"] = empty;
|
||||
parallel["reductions"] = empty;
|
||||
parallel["remote_accesses"] = empty;
|
||||
parallel["acrosses"] = empty;
|
||||
|
||||
for (auto& op : directive.reduction)
|
||||
{
|
||||
for (auto& var : op.second)
|
||||
{
|
||||
json item;
|
||||
item["line"] = st->lineNumber();
|
||||
item["operation"] = op.first;
|
||||
if (!isSgArrayType(var->type()))
|
||||
{
|
||||
item["reduction_type"] = "SCALAR";
|
||||
item["size_bytes"] = getSizeOfType(var->type());
|
||||
item["elements_count"] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
item["reduction_type"] = "ARRAY";
|
||||
auto type = isSgArrayType(var->type());
|
||||
item["size_bytes"] = getSizeOfType(type->baseType());
|
||||
item["elements_count"] = type->dimension();
|
||||
}
|
||||
|
||||
reduction.push_back(item);
|
||||
parallel["reductions"].push_back(reduction.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
fillAcrossShadow(directive.shadowRenew, st, byPos, "shadow_renews", shadow_renew, parallel);
|
||||
fillAcrossShadow(directive.across, st, byPos, "acrosses", across, parallel);
|
||||
|
||||
auto func = getFuncStat(st);
|
||||
auto& funcInFile = allFuncInfo.at(st->fileName());
|
||||
FuncInfo* currF = NULL;
|
||||
for (auto& elem : funcInFile)
|
||||
if (elem->funcName == func->symbol()->identifier())
|
||||
currF = elem;
|
||||
|
||||
if (currF == NULL)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
auto cfg = buildCFGforCurrentFunc(func, SAPFOR::CFG_Settings(true, false, false, true, false, false, true), commonBlocks, allFuncInfo);
|
||||
if (cfg.size() != 1)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
//TODO IP analysis
|
||||
|
||||
unsigned countOfAccess = 0;
|
||||
unsigned countOfOps = 0;
|
||||
|
||||
if (cfg.find(currF) == cfg.end())
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
//skip all parallel loops
|
||||
loop = st->lexNext();
|
||||
for (int z = 0; z < loopSymbs.size(); ++z)
|
||||
loop = loop->lexNext();
|
||||
|
||||
int lineStart = loop->lineNumber();
|
||||
int lineEnd = lastNode->lexNext()->lineNumber();
|
||||
|
||||
//dumpCFG(cfg, false);
|
||||
//TODO: calculate access in bytes
|
||||
for (auto& block : cfg[currF])
|
||||
{
|
||||
for (auto& ir : block->getInstructions())
|
||||
{
|
||||
auto line = ir->getLine();
|
||||
if (line < lineStart || line >= lineEnd)
|
||||
continue;
|
||||
|
||||
auto inst = ir->getInstruction();
|
||||
if (inst->isAccess())
|
||||
countOfAccess++;
|
||||
if (inst->isArith())
|
||||
countOfOps++;
|
||||
//printf("%s %d %d\n", inst->dump().c_str(), inst->isAccess(), inst->isArith());
|
||||
}
|
||||
}
|
||||
deleteCFG(cfg);
|
||||
|
||||
parallel["computational_intensity"] = countOfOps > 0 ? ((double)countOfOps / (double)countOfAccess) : 0;
|
||||
|
||||
directives["parallel"].push_back(parallel);
|
||||
}
|
||||
|
||||
void parseDvmDirForPredictor(const map<tuple<int, string, string>, pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays,
|
||||
const map<string, CommonBlock*>& commonBlocks,
|
||||
const map<string, vector<FuncInfo*>>& allFuncInfo,
|
||||
const map<string, map<int, Gcov_info>>& gCovInfo)
|
||||
{
|
||||
auto& program = info[1]["program_info"];
|
||||
|
||||
map<DIST::Array*, int> byPos;
|
||||
int pos = 0;
|
||||
for (auto& arrayElem : declaredArrays)
|
||||
{
|
||||
json jArray;
|
||||
auto& array = arrayElem.second.first;
|
||||
auto sizes = array->GetSizes();
|
||||
for (int z = 0; z < array->GetDimSize(); ++z)
|
||||
jArray["dimensions"].push_back(sizes[z].second - sizes[z].first + 1);
|
||||
|
||||
jArray["name"] = array->GetName();
|
||||
jArray["element_size_bytes"] = array->GetTypeSize();
|
||||
|
||||
program["arrays_info"].push_back(jArray);
|
||||
byPos[array] = pos++;
|
||||
}
|
||||
|
||||
auto& directives = program["directives"];
|
||||
for (auto& byFile : allFuncInfo)
|
||||
{
|
||||
int ok = SgFile::switchToFile(byFile.first);
|
||||
if (ok == -1)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
auto it = gCovInfo.find(byFile.first);
|
||||
if (it == gCovInfo.end())
|
||||
{
|
||||
__spf_print(1, "bad gcov info\n");
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
auto& gcov = it->second;
|
||||
for (auto& func : byFile.second)
|
||||
{
|
||||
SgStatement* stat = func->funcPointer->GetOriginal();
|
||||
|
||||
for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext())
|
||||
{
|
||||
SgExpression* list;
|
||||
SgExpression* dup;
|
||||
auto line = 0;
|
||||
|
||||
switch (st->variant())
|
||||
{
|
||||
case DVM_PARALLEL_ON_DIR:
|
||||
parallelDir(byPos, st->expr(2), st->expr(0)->symbol(), st->expr(0)->lhs(), st, st->expr(1), gcov, directives, commonBlocks, allFuncInfo);
|
||||
break;
|
||||
case DVM_VAR_DECL: // TODO
|
||||
{
|
||||
auto type = st->expr(2)->lhs();
|
||||
if (type->variant() == DISTRIBUTE_OP)
|
||||
{
|
||||
list = st->expr(0);
|
||||
while (list)
|
||||
{
|
||||
directives["distribute"].push_back(parseDistribution(byPos, list->lhs()->symbol(), type->lhs(), st->lineNumber()));
|
||||
list = list->rhs();
|
||||
}
|
||||
}
|
||||
else if (type->variant() == ALIGN_OP)
|
||||
{
|
||||
list = st->expr(0);
|
||||
while (list)
|
||||
{
|
||||
directives["align"].push_back(parseAlign(byPos, list->lhs()->symbol(), type->rhs()->symbol(), type->lhs(), type->rhs()->lhs(), st->lineNumber()));
|
||||
list = list->rhs();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DVM_DISTRIBUTE_DIR:
|
||||
directives["distribute"].push_back(parseDistribution(byPos, st->expr(0)->lhs()->symbol(), st->expr(1), st->lineNumber()));
|
||||
break;
|
||||
case DVM_ALIGN_DIR:
|
||||
directives["align"].push_back(parseAlign(byPos, st->expr(0)->lhs()->symbol(), st->expr(2)->symbol(), st->expr(1), st->expr(2)->lhs(), st->lineNumber()));
|
||||
break;
|
||||
case DVM_SHADOW_DIR:
|
||||
//dirs << "1;" << "SHADOW;" << st->expr(0)->unparse() << "(" << st->expr(1)->unparse() << ");\n";
|
||||
break;
|
||||
case DVM_REMOTE_ACCESS_DIR:
|
||||
{
|
||||
line = st->lexNext()->lineNumber();
|
||||
auto it = gcov.find(line);
|
||||
auto& info = it->second;
|
||||
if (info.getNumLine() != line)
|
||||
{
|
||||
__spf_print(1, "bad gcov info\n");
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
|
||||
//dirs << info.getExecutedCount() << ";" << "REMOTE_ACCESS;";
|
||||
list = st->expr(0);
|
||||
while (list)
|
||||
{
|
||||
//dirs << list->lhs()->unparse() << ";";
|
||||
list = list->rhs();
|
||||
}
|
||||
//dirs << "\n";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//printf("var = %d line %d\n", st->variant(), st->lineNumber());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//printf("%s\n", info.dump(2).c_str());
|
||||
|
||||
ofstream dump("info.json");
|
||||
dump << info.dump(2) << std::endl;
|
||||
dump.flush();
|
||||
dump.close();
|
||||
}
|
||||
@@ -54,4 +54,5 @@ public:
|
||||
|
||||
void processFileToPredict(SgFile *file, PredictorStats &predictorCounts);
|
||||
|
||||
void calculate_stats_for_predictor(const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, const std::map<std::string, std::map<int, Gcov_info>>& gCovInfo);
|
||||
void calculateStatsForPredictor(const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, const std::map<std::string, std::map<int, Gcov_info>>& gCovInfo);
|
||||
void parseDvmDirForPredictor(const std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays, const std::map<std::string, CommonBlock*>& commonBlocks, const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, const std::map<std::string, std::map<int, Gcov_info>>& gCovInfo);
|
||||
@@ -66,7 +66,11 @@ class StdCapture
|
||||
ret = pipe(pipes, 1024 * 1024 * 20, O_BINARY); // 20 MB
|
||||
#else
|
||||
ret = pipe(pipes) == -1;
|
||||
#ifdef __APPLE__
|
||||
fcntl(*pipes, F_PREALLOCATE, 1024 * 1024 * 20);
|
||||
#else
|
||||
fcntl(*pipes, F_SETPIPE_SZ, 1024 * 1024 * 20);
|
||||
#endif
|
||||
#endif
|
||||
fd_blocked = (errno == EINTR || errno == EBUSY);
|
||||
if (fd_blocked)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,8 @@
|
||||
#include "ParallelizationRegions/resolve_par_reg_conflicts.h"
|
||||
#include "ParallelizationRegions/expand_extract_reg.h"
|
||||
|
||||
#include "Transformations/replace_dist_arrays_in_io.h"
|
||||
|
||||
#include "Distribution/Distribution.h"
|
||||
#include "Distribution/GraphCSR.h"
|
||||
#include "Distribution/Arrays.h"
|
||||
@@ -1572,6 +1574,8 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
if (error)
|
||||
internalExit = 1;
|
||||
}
|
||||
else if (curr_regime == REMOVE_DIST_ARRAYS_FROM_IO)
|
||||
replaceDistributedArraysInIO(parallelRegions, allFuncInfo, SPF_messages, newCopyDeclToIncl);
|
||||
else if (curr_regime == LOOP_GRAPH)
|
||||
{
|
||||
if (keepFiles)
|
||||
@@ -1899,7 +1903,10 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
else if (curr_regime == GET_MIN_MAX_BLOCK_DIST)
|
||||
__spf_print(1, "GET_MIN_MAX_BLOCK_DIST: %d %d\n", min_max_block.first, min_max_block.second);
|
||||
else if (curr_regime == GET_STATS_FOR_PREDICTOR)
|
||||
calculate_stats_for_predictor(allFuncInfo, gCovInfo);
|
||||
{
|
||||
calculateStatsForPredictor(allFuncInfo, gCovInfo);
|
||||
parseDvmDirForPredictor(declaredArrays, commonBlocks, allFuncInfo, gCovInfo);
|
||||
}
|
||||
|
||||
const float elapsed = duration_cast<milliseconds>(high_resolution_clock::now() - timeForPass).count() / 1000.;
|
||||
const float elapsedGlobal = duration_cast<milliseconds>(high_resolution_clock::now() - globalTime).count() / 1000.;
|
||||
@@ -1913,7 +1920,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
}
|
||||
|
||||
static int countMaxValuesForParallelVariants(int &maxDims, int &maxDimsIdx, int &maxDimsIdxReg, vector<vector<int>> ¤tVariants)
|
||||
{
|
||||
{
|
||||
int lastI;
|
||||
if (consoleMode)
|
||||
{
|
||||
@@ -2335,6 +2342,7 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam
|
||||
findFunctionsToInclude(true);
|
||||
break;
|
||||
// all these cases run UNPARSE_FILE after
|
||||
case REMOVE_DIST_ARRAYS_FROM_IO:
|
||||
case RENAME_SYMBOLS:
|
||||
case RESOLVE_PAR_REGIONS:
|
||||
case CREATE_PARALLEL_REGIONS:
|
||||
|
||||
@@ -87,6 +87,8 @@ enum passes {
|
||||
REMOVE_DVM_INTERVALS,
|
||||
VERIFY_DVM_DIRS,
|
||||
|
||||
REMOVE_DIST_ARRAYS_FROM_IO,
|
||||
|
||||
SUBST_EXPR,
|
||||
SUBST_EXPR_RD,
|
||||
REVERT_SUBST_EXPR,
|
||||
@@ -262,6 +264,7 @@ static void setPassValues()
|
||||
passNames[INSERT_INCLUDES] = "INSERT_INCLUDES";
|
||||
passNames[REMOVE_DVM_DIRS] = "REMOVE_DVM_DIRS";
|
||||
passNames[VERIFY_DVM_DIRS] = "VERIFY_DVM_DIRS";
|
||||
passNames[REMOVE_DIST_ARRAYS_FROM_IO] = "REMOVE_DIST_ARRAYS_FROM_IO";
|
||||
passNames[SUBST_EXPR] = "SUBST_EXPR";
|
||||
passNames[SUBST_EXPR_RD] = "SUBST_EXPR_RD";
|
||||
passNames[CALL_GRAPH2] = "CALL_GRAPH2";
|
||||
|
||||
@@ -92,8 +92,18 @@ void insertIntrinsicStat(const vector<FuncInfo*>& allFuncInfo)
|
||||
|
||||
SgStatement* intr = new SgStatement(INTRIN_STAT);
|
||||
intr->setExpression(0, makeExprList(list));
|
||||
intr->setlineNumber(st->lineNumber());
|
||||
|
||||
auto prev = (st->variant() == FOR_NODE) ? st->lexPrev() : st;
|
||||
int line = prev->lineNumber();
|
||||
while (line <= 0 && !isSgProgHedrStmt(prev)) {
|
||||
prev = prev->lexPrev();
|
||||
line = prev->lineNumber();
|
||||
}
|
||||
|
||||
if (line <= 0)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
intr->setlineNumber(line);
|
||||
st->insertStmtBefore(*intr, *func->funcPointer);
|
||||
}
|
||||
else
|
||||
@@ -449,6 +459,8 @@ static void insertIntents(set<string>& identificators, SgStatement* header, cons
|
||||
if (args.size())
|
||||
{
|
||||
SgIntentStmt* intent = new SgIntentStmt(*makeExprList(args), *attr);
|
||||
intent->setlineNumber(lastDecl->lineNumber());
|
||||
|
||||
lastDecl->insertStmtAfter(*intent, (header == lastDecl) ? *header : *lastDecl->controlParent());
|
||||
}
|
||||
}
|
||||
@@ -477,6 +489,9 @@ static SgSymbol* getParameter(SgStatement* stat, int n)
|
||||
|
||||
static void intentInsert(const FuncInfo* func, SgStatement* headerSt)
|
||||
{
|
||||
if (func == NULL)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
|
||||
if (func->funcPointer->variant() == ENTRY_STAT)
|
||||
return;
|
||||
|
||||
|
||||
@@ -0,0 +1,478 @@
|
||||
#include "replace_dist_arrays_in_io.h"
|
||||
|
||||
#include "../ParallelizationRegions/resolve_par_reg_conflicts.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
using std::map;
|
||||
using std::set;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::to_string;
|
||||
using std::make_pair;
|
||||
|
||||
#define DEBUG_TRACE 0
|
||||
|
||||
static void findArrays(SgExpression* exp, set<SgSymbol*>& arrays)
|
||||
{
|
||||
if (exp)
|
||||
{
|
||||
if (isArrayRef(exp))
|
||||
arrays.insert(exp->symbol());
|
||||
|
||||
findArrays(exp->lhs(), arrays);
|
||||
findArrays(exp->rhs(), arrays);
|
||||
}
|
||||
}
|
||||
|
||||
static void populateDistributedIoArrays(map<DIST::Array*, set<SgStatement*>>& arrays, SgStatement* stat)
|
||||
{
|
||||
auto var = stat->variant();
|
||||
|
||||
if (var != READ_STAT && var != PRINT_STAT && var != WRITE_STAT)
|
||||
return;
|
||||
|
||||
// check if such IO allowed in dvm:
|
||||
// list should consist only of single array and format string should be *
|
||||
|
||||
bool need_replace = false;
|
||||
|
||||
SgExpression* ioList = stat->expr(0);
|
||||
|
||||
if (!ioList)
|
||||
return;
|
||||
|
||||
if (ioList->variant() != EXPR_LIST)
|
||||
return;
|
||||
|
||||
if (ioList->rhs() == NULL)
|
||||
{
|
||||
SgExpression* arg = ioList->lhs();
|
||||
if (!arg)
|
||||
return;
|
||||
|
||||
if (!isArrayRef(arg))
|
||||
return;
|
||||
|
||||
if (arg->lhs())
|
||||
need_replace = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
need_replace = true;
|
||||
}
|
||||
|
||||
if (!need_replace)
|
||||
{
|
||||
switch (var)
|
||||
{
|
||||
case PRINT_STAT:
|
||||
{
|
||||
SgExpression* fmt = stat->expr(1);
|
||||
if (!fmt || fmt->variant() != SPEC_PAIR || fmt->lhs()->variant() != KEYWORD_VAL)
|
||||
{
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fmt->rhs()->variant() != KEYWORD_VAL || fmt->rhs()->sunparse() != "*")
|
||||
need_replace = true;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case READ_STAT:
|
||||
case WRITE_STAT:
|
||||
{
|
||||
|
||||
SgExpression* spec = stat->expr(1);
|
||||
__spf_print(DEBUG_TRACE, "[%d: %s (%d)]\n", 2000, spec->rhs()->unparse(), spec->rhs()->variant());
|
||||
if (!spec || spec->variant() != EXPR_LIST ||
|
||||
spec->lhs()->variant() != SPEC_PAIR ||
|
||||
!spec->rhs() || !spec->rhs()->lhs() || spec->rhs()->lhs()->variant() != SPEC_PAIR)
|
||||
{
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
SgExpression* unit_val = spec->lhs()->rhs(), * fmt_val = spec->rhs()->lhs()->rhs();
|
||||
|
||||
if (unit_val->variant() != KEYWORD_VAL || unit_val->sunparse() != "*" ||
|
||||
fmt_val->variant() != KEYWORD_VAL || fmt_val->sunparse() != "*")
|
||||
need_replace = true;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!need_replace)
|
||||
return;
|
||||
|
||||
set<SgSymbol*> found_arrays;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
findArrays(stat->expr(i), found_arrays);
|
||||
|
||||
for (auto* by_symb : found_arrays)
|
||||
{
|
||||
string array_name = string(by_symb->identifier());
|
||||
DIST::Array* array_p = getArrayFromDeclarated(declaratedInStmt(by_symb), array_name);
|
||||
if (array_p && array_p->GetDistributeFlagVal() == Distribution::distFlag::IO_PRIV && arrays[array_p].insert(stat).second)
|
||||
__spf_print(DEBUG_TRACE, "[%d]: add array %s\n", stat->lineNumber(), array_p->GetName().c_str());
|
||||
}
|
||||
|
||||
__spf_print(DEBUG_TRACE, "[replace]\n");
|
||||
}
|
||||
|
||||
static void replaceArrayRec(SgSymbol* arr, SgSymbol* replace_by, SgExpression* exp, bool& has_read, bool& has_write, bool from_read, bool from_write)
|
||||
{
|
||||
if (!exp)
|
||||
return;
|
||||
|
||||
if (exp->symbol() && strcmp(exp->symbol()->identifier(), arr->identifier()) == 0)
|
||||
{
|
||||
has_read |= from_read;
|
||||
has_write |= from_write;
|
||||
exp->setSymbol(replace_by);
|
||||
}
|
||||
|
||||
switch (exp->variant())
|
||||
{
|
||||
case FUNC_CALL:
|
||||
{
|
||||
replaceArrayRec(arr, replace_by, exp->rhs(), has_read, has_write, true, false);
|
||||
replaceArrayRec(arr, replace_by, exp->lhs(), has_read, has_write, true, true);
|
||||
break;
|
||||
}
|
||||
case EXPR_LIST:
|
||||
{
|
||||
replaceArrayRec(arr, replace_by, exp->lhs(), has_read, has_write, from_read, from_write);
|
||||
replaceArrayRec(arr, replace_by, exp->rhs(), has_read, has_write, from_read, from_write);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
replaceArrayRec(arr, replace_by, exp->lhs(), has_read, has_write, true, false);
|
||||
replaceArrayRec(arr, replace_by, exp->rhs(), has_read, has_write, true, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void replaceArrayRec(SgSymbol* arr, SgSymbol* replace_by, SgStatement* st, bool& has_read, bool& has_write)
|
||||
{
|
||||
if (!st)
|
||||
return;
|
||||
|
||||
switch (st->variant())
|
||||
{
|
||||
case ASSIGN_STAT:
|
||||
case READ_STAT:
|
||||
{
|
||||
replaceArrayRec(arr, replace_by, st->expr(0), has_read, has_write, false, true);
|
||||
replaceArrayRec(arr, replace_by, st->expr(1), has_read, has_write, true, false);
|
||||
break;
|
||||
}
|
||||
case PROC_STAT:
|
||||
case FUNC_STAT:
|
||||
{
|
||||
replaceArrayRec(arr, replace_by, st->expr(0), has_read, has_write, true, false);
|
||||
replaceArrayRec(arr, replace_by, st->expr(1), has_read, has_write, true, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
replaceArrayRec(arr, replace_by, st->expr(i), has_read, has_write, true, false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void copyArrayBetweenStatements(SgSymbol* replace_symb, SgSymbol* replace_by, SgStatement* start, SgStatement* last)
|
||||
{
|
||||
while (start->lexNext() && !isSgExecutableStatement(start->lexNext()))
|
||||
start = start->lexNext();
|
||||
|
||||
auto* stop = last->lexNext();
|
||||
|
||||
bool has_read = false, has_write = false;
|
||||
|
||||
for (auto* st = start; st != stop; st = st->lexNext())
|
||||
replaceArrayRec(replace_symb, replace_by, st, has_read, has_write);
|
||||
|
||||
|
||||
if (has_read)
|
||||
{
|
||||
// A_copy = A
|
||||
SgAssignStmt* assign = new SgAssignStmt(*new SgArrayRefExp(*replace_by), *new SgArrayRefExp(*replace_symb));
|
||||
assign->setlineNumber(getNextNegativeLineNumber()); // before region
|
||||
auto* parent = start->controlParent();
|
||||
if (parent && parent->lastNodeOfStmt() == start)
|
||||
parent = parent->controlParent();
|
||||
|
||||
start->insertStmtAfter(*assign, *parent);
|
||||
}
|
||||
|
||||
if (has_write)
|
||||
{
|
||||
// A = A_reg
|
||||
SgAssignStmt* assign = new SgAssignStmt(*new SgArrayRefExp(*replace_symb), *new SgArrayRefExp(*replace_by));
|
||||
//TODO: bug with insertion
|
||||
//assign->setlineNumber(getNextNegativeLineNumber()); // after region
|
||||
last->insertStmtBefore(*assign, *(last->controlParent()));
|
||||
}
|
||||
}
|
||||
|
||||
static void replaceArrayInFragment(DIST::Array* arr, const set<SgStatement*> usages, SgSymbol* replace_by, SgStatement* start, SgStatement* last, const string& filename)
|
||||
{
|
||||
while (start->lexNext() && !isSgExecutableStatement(start->lexNext()))
|
||||
start = start->lexNext();
|
||||
|
||||
auto* replace_symb = arr->GetDeclSymbol();
|
||||
|
||||
set<SgStatement*> not_opened, not_closed, copied;
|
||||
|
||||
for (auto* it = start; it; it = it->controlParent())
|
||||
not_opened.insert(it);
|
||||
|
||||
for (auto* it = last; it; it = it->controlParent())
|
||||
not_closed.insert(it);
|
||||
|
||||
for (auto* io_stmt : usages)
|
||||
{
|
||||
bool already_copied = false;
|
||||
SgStatement* copy_scope = NULL;
|
||||
|
||||
for (auto* par = io_stmt; par; par = par->controlParent())
|
||||
{
|
||||
if (copied.find(par) != copied.end())
|
||||
{
|
||||
already_copied = true;
|
||||
break;
|
||||
}
|
||||
else if (not_opened.find(par) != not_opened.end() || not_closed.find(par) != not_closed.end())
|
||||
{
|
||||
copy_scope = par;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (already_copied)
|
||||
continue;
|
||||
|
||||
auto* scope_start = copy_scope, * scope_end = copy_scope->lastNodeOfStmt();
|
||||
__spf_print(DEBUG_TRACE, "[scope to copy] %d\n", copy_scope->lineNumber());
|
||||
|
||||
if (not_opened.find(copy_scope) != not_opened.end())
|
||||
{
|
||||
auto* from = start->lastNodeOfStmt() ? start->lastNodeOfStmt() : start;
|
||||
for (auto* st = from; st; st = st->controlParent())
|
||||
{
|
||||
__spf_print(DEBUG_TRACE, "[find start of parent %d] %d\n", copy_scope->lineNumber(), st->lineNumber());
|
||||
|
||||
if (st->controlParent() == copy_scope)
|
||||
{
|
||||
scope_start = st->lastNodeOfStmt() ? st->lastNodeOfStmt() : st;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (not_closed.find(copy_scope) != not_closed.end())
|
||||
{
|
||||
for (auto* st = last; st; st = st->controlParent())
|
||||
{
|
||||
__spf_print(DEBUG_TRACE, "[find end of parent %d] %d\n", copy_scope->lineNumber(), st->lineNumber());
|
||||
|
||||
if (st->controlParent() == copy_scope)
|
||||
{
|
||||
scope_end = st;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copyArrayBetweenStatements(replace_symb, replace_by, scope_start, scope_end);
|
||||
__spf_print(DEBUG_TRACE, "[copy %s] [%d, %d]\n", arr->GetName().c_str(), scope_start->lineNumber(), scope_end->lineNumber());
|
||||
copied.insert(copy_scope);
|
||||
}
|
||||
}
|
||||
|
||||
static bool ioReginBound(SgStatement* stat, SgStatement* last_io_bound)
|
||||
{
|
||||
auto var = stat->variant();
|
||||
|
||||
if (var == PROC_STAT || var == FUNC_STAT || var == PROG_HEDR || var == FUNC_HEDR || var == PROC_HEDR || var == FUNC_STAT || var == FOR_NODE || var == LOOP_NODE)
|
||||
return true;
|
||||
|
||||
if (last_io_bound && last_io_bound->lastNodeOfStmt() && last_io_bound->lastNodeOfStmt() == stat)
|
||||
return true;
|
||||
|
||||
int parent_var;
|
||||
|
||||
if (var == CONTROL_END &&
|
||||
((parent_var = stat->controlParent()->variant()) == PROG_HEDR ||
|
||||
parent_var == PROC_HEDR || parent_var == FUNC_HEDR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
|
||||
const map<string, vector<FuncInfo*>>& allFuncInfo,
|
||||
map<string, vector<Messages>>& SPF_messages,
|
||||
map<string, map<int, set<string>>>& newDeclsToInclude)
|
||||
{
|
||||
map<DIST::Array*, SgSymbol*> created_copies;
|
||||
map<string, map<int, set<string>>> copied;
|
||||
|
||||
for (auto& region : regions)
|
||||
{
|
||||
__spf_print(DEBUG_TRACE, "[%s]: enter region\n", region->GetName().c_str());
|
||||
|
||||
for (auto& linesByFile : region->GetAllLinesToModify())
|
||||
{
|
||||
const auto& filename = linesByFile.first;
|
||||
|
||||
if (SgFile::switchToFile(filename) < 0) {
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& lines : linesByFile.second) {
|
||||
__spf_print(DEBUG_TRACE, "[fragment] %s: %d:%d %d\n", filename.c_str(), lines.lines.first,
|
||||
lines.lines.second, lines.isImplicit());
|
||||
|
||||
SgStatement* curr_stmt, * end;
|
||||
|
||||
if (lines.isImplicit())
|
||||
{
|
||||
|
||||
curr_stmt = current_file->SgStatementAtLine(lines.lines.first);
|
||||
end = current_file->SgStatementAtLine(lines.lines.second);
|
||||
|
||||
if (end)
|
||||
end = end->lexNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
curr_stmt = lines.stats.first->GetOriginal();
|
||||
end = lines.stats.second->GetOriginal()->lexNext();
|
||||
}
|
||||
|
||||
map<DIST::Array*, set<SgStatement*>> need_replace;
|
||||
SgStatement* last_io_bound = NULL;
|
||||
|
||||
|
||||
while (curr_stmt != end)
|
||||
{
|
||||
if (!curr_stmt)
|
||||
break;
|
||||
|
||||
auto var = curr_stmt->variant();
|
||||
|
||||
|
||||
if (var == PROC_HEDR || var == PROG_HEDR || var == FUNC_HEDR)
|
||||
{
|
||||
curr_stmt = curr_stmt->lexNext();
|
||||
while (curr_stmt && !isSgExecutableStatement(curr_stmt))
|
||||
{
|
||||
last_io_bound = curr_stmt;
|
||||
curr_stmt = curr_stmt->lexNext();
|
||||
}
|
||||
|
||||
if (!curr_stmt)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ioReginBound(curr_stmt, last_io_bound))
|
||||
{
|
||||
if (last_io_bound)
|
||||
{
|
||||
__spf_print(DEBUG_TRACE, "[io region] [%d, %d]\n", last_io_bound->lineNumber(), curr_stmt->lineNumber());
|
||||
|
||||
for (const auto& p : need_replace)
|
||||
{
|
||||
auto it = created_copies.find(p.first);
|
||||
if (it != created_copies.end())
|
||||
replaceArrayInFragment(p.first, p.second, it->second, last_io_bound, curr_stmt, filename);
|
||||
else
|
||||
{
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
need_replace.clear();
|
||||
last_io_bound = curr_stmt;
|
||||
}
|
||||
|
||||
__spf_print(DEBUG_TRACE, "[line] %d (%d)\n", curr_stmt->lineNumber(), curr_stmt->variant());
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (curr_stmt->expr(i))
|
||||
{
|
||||
__spf_print(DEBUG_TRACE, "[%d: %s (%d)]\n", i, curr_stmt->expr(i)->unparse(), curr_stmt->expr(i)->variant());
|
||||
}
|
||||
}
|
||||
|
||||
populateDistributedIoArrays(need_replace, curr_stmt);
|
||||
|
||||
for (const auto& by_array_to_copy : need_replace)
|
||||
{
|
||||
auto* array_to_copy = by_array_to_copy.first;
|
||||
auto it = created_copies.find(array_to_copy);
|
||||
|
||||
if (it == created_copies.end())
|
||||
{
|
||||
bool fromModule = (array_to_copy->GetLocation().first == DIST::l_MODULE);
|
||||
const string locationName = array_to_copy->GetLocation().second;
|
||||
|
||||
auto place = *array_to_copy->GetDeclInfo().begin();
|
||||
string fileName = place.first;
|
||||
string suffix = "_io_l";
|
||||
|
||||
if (fromModule)
|
||||
suffix = "_io_m";
|
||||
|
||||
auto origCopy = copyArray(place, array_to_copy, linesByFile.second, suffix + to_string(region->GetId()), fileName, newDeclsToInclude, copied);
|
||||
SgStatement* decl = SgStatement::getStatementByFileAndLine(place.first, place.second);
|
||||
|
||||
if(decl)
|
||||
decl = decl->lexNext();
|
||||
|
||||
if(decl)
|
||||
{
|
||||
string dir_str;
|
||||
if (decl->comments())
|
||||
{
|
||||
string str_comment = string(decl->comments());
|
||||
if(str_comment.size() && str_comment.back() != '\n')
|
||||
dir_str += "\n";
|
||||
}
|
||||
|
||||
dir_str += "!$SPF ANALYSIS(PROCESS_PRIVATE(" + string(origCopy.second->identifier()) + "))\n";
|
||||
decl->addComment(dir_str.c_str());
|
||||
}
|
||||
created_copies.insert({ array_to_copy, origCopy.second });
|
||||
}
|
||||
}
|
||||
|
||||
curr_stmt = curr_stmt->lexNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
|
||||
void replaceDistributedArraysInIO(std::vector<ParallelRegion*>& regions,
|
||||
const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo,
|
||||
std::map<std::string, std::vector<Messages>>& SPF_messages,
|
||||
std::map<std::string, std::map<int, std::set<std::string>>>& newDeclsToInclude);
|
||||
@@ -257,6 +257,8 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
|
||||
|
||||
list({ REVERT_SUBST_EXPR_RD, CONVERT_LOOP_TO_ASSIGN }) <= Pass(RESOLVE_PAR_REGIONS);
|
||||
|
||||
list({ REVERT_SUBST_EXPR_RD, CONVERT_LOOP_TO_ASSIGN, FILL_PAR_REGIONS}) <= Pass(REMOVE_DIST_ARRAYS_FROM_IO);
|
||||
|
||||
Pass(REVERT_SUBST_EXPR_RD) <= Pass(EXPAND_EXTRACT_PAR_REGION);
|
||||
|
||||
Pass(FILL_PAR_REGIONS) <= Pass(PRINT_PAR_REGIONS_ERRORS);
|
||||
|
||||
@@ -2306,10 +2306,12 @@ SgSymbol* getFromModule(const map<string, set<SgSymbol*>> &byUse, SgSymbol *orig
|
||||
|
||||
if (byUse.size())
|
||||
{
|
||||
for (auto& elem : byUse)
|
||||
for (auto& localS : elem.second)
|
||||
if (OriginalSymbol(localS)->thesymb == orig->thesymb)
|
||||
return localS;
|
||||
for (auto& elem : byUse)
|
||||
{
|
||||
for (auto& localS : setToMapWithSortByStr(elem.second))
|
||||
if (OriginalSymbol(localS.second)->thesymb == orig->thesymb)
|
||||
return localS.second;
|
||||
}
|
||||
}
|
||||
return orig;
|
||||
}
|
||||
|
||||
@@ -108,4 +108,13 @@ void getMaxMinBlockDistribution(SgFile* file, std::pair<int, int>& min_max);
|
||||
|
||||
void addPrivatesToArraysFromGUI(SgFile* file, const std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays, const std::map<std::string, int>& distrStateFromGUI);
|
||||
|
||||
void shiftLines(SgProject* project, bool print = true);
|
||||
void shiftLines(SgProject* project, bool print = true);
|
||||
|
||||
template<typename T>
|
||||
static inline std::multimap<std::string, T> setToMapWithSortByStr(const std::set<T>& setIn)
|
||||
{
|
||||
std::multimap<std::string, T> retMap;
|
||||
for (auto& elem : setIn)
|
||||
retMap.insert(make_pair(elem->identifier(), elem));
|
||||
return retMap;
|
||||
}
|
||||
@@ -86,8 +86,8 @@ enum typeMessage { WARR, ERROR, NOTE };
|
||||
// 07 "Internal error during unparsing process has occurred"
|
||||
// 08 "Can not do PRIVATE EXPANSION for this loop - privates not found"
|
||||
// 09 "Can not split this loop because of dependecy: %s"
|
||||
// 10 "This loop has indirect child loops and can not be splitted\n"
|
||||
// 11
|
||||
// 10 "This loop has indirect child loops and can not be splitted"
|
||||
// 11 "It is allowed to inline function only at execution code section"
|
||||
// 12 "for function duplication"
|
||||
// 13 "for function duplication"
|
||||
// 14 inlining errors - dims mismatch
|
||||
@@ -96,7 +96,7 @@ enum typeMessage { WARR, ERROR, NOTE };
|
||||
// 17 cannot remove private var '%s' - it has recursive dependency or it depends on non-invariant var '%s'
|
||||
// 18 "private variable '%s' was removed" or "private variable '%s' was partially removed"
|
||||
// 19 "Removing of private var '%s' was made with assumption that references '%s' and '%s' are different"
|
||||
// 20 --- FREE POSITION
|
||||
// 20 "Function inlining failed with an error"
|
||||
// 21 "cannot remove private var '%s' - cannot find reaching definition for the statement"
|
||||
// 22 "cannot transform ..."
|
||||
// 23 "cannot transform ..."
|
||||
@@ -276,7 +276,7 @@ static void printStackTrace() { };
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Свободный - R193 и далее R205
|
||||
// Свободный - R205
|
||||
// Гайд по русификации сообщений: При добавлении нового сообщения, меняется последний сводобный идентификатор.
|
||||
// В этом файле остаются только спецификаторы, для которых будет заполнен текст. Полный текст пишется в файле
|
||||
// russian_errors_text.txt. Спецификаторы там тоже сохраняются, по ним в визуализаторе будет восстановлен
|
||||
@@ -523,7 +523,7 @@ static const wchar_t *R201 = L"R201:%s";
|
||||
//2019
|
||||
static const wchar_t *R192 = L"R192:%s#%s#%s";
|
||||
//2020
|
||||
// static const wchar_t *R193 = L"R193:%s";
|
||||
static const wchar_t *R193 = L"R193:";
|
||||
//2021
|
||||
static const wchar_t *R194 = L"R194:%s";
|
||||
//2022
|
||||
|
||||
@@ -233,7 +233,7 @@ R201 = "Приватная переменная '%s' была частично
|
||||
//2019
|
||||
R192 = "Удаление приватной переменной '%s' было выполнено в предположении, что выражения '%s' и '%s' различны"
|
||||
//2020
|
||||
R193 = "--FREE POSITION"
|
||||
R193 = "Подстановка функций выполнилась с ошибкой"
|
||||
//2021
|
||||
R194 = "Нельзя удалить приватную переменную '%s' - не удалось найти достигающее определение для оператора"
|
||||
//2022
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_SPF "2362"
|
||||
#define VERSION_SPF "2368"
|
||||
|
||||
@@ -555,6 +555,7 @@ bool OperatorChecker(SgFile* file, map<string, vector<Messages>>& currMessages)
|
||||
SgStatement* st = file->firstStatement();
|
||||
string currF = file->filename();
|
||||
|
||||
const set<int> cpOnSameLine = { ARITHIF_NODE, LOGIF_NODE, GOTO_NODE , IF_NODE, FORALL_STAT };
|
||||
while (st)
|
||||
{
|
||||
int line = st->lineNumber();
|
||||
@@ -562,9 +563,8 @@ bool OperatorChecker(SgFile* file, map<string, vector<Messages>>& currMessages)
|
||||
; // skip
|
||||
else if (line > 0 && st->fileName() == currF)
|
||||
{
|
||||
;
|
||||
int var = st->controlParent()->variant();
|
||||
bool cpWasAdded = (var == ARITHIF_NODE || var == LOGIF_NODE || var == GOTO_NODE || var == IF_NODE) && (usedLines.find(line) != usedLines.end());
|
||||
bool cpWasAdded = cpOnSameLine.find(var) != cpOnSameLine.end() && (usedLines.find(line) != usedLines.end());
|
||||
|
||||
if (usedLines.find(line) != usedLines.end() && !cpWasAdded)
|
||||
{
|
||||
|
||||
@@ -1732,6 +1732,14 @@ int SPF_ResolveParallelRegionConflicts(void*& context, int winHandler, short *op
|
||||
return simpleTransformPass(RESOLVE_PAR_REGIONS, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize);
|
||||
}
|
||||
|
||||
int SPF_RemoveDistArraysFromIO(void*& context, int winHandler, short* options, short* projName, short* folderName, short*& output,
|
||||
int*& outputSize, short*& outputMessage, int*& outputMessageSize)
|
||||
{
|
||||
MessageManager::clearCache();
|
||||
MessageManager::setWinHandler(winHandler);
|
||||
return simpleTransformPass(REMOVE_DIST_ARRAYS_FROM_IO, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize);
|
||||
|
||||
}
|
||||
int SPF_PrivateExpansion(void*& context, int winHandler, short *options, short *projName, short *folderName, short *&output,
|
||||
int *&outputSize, short *&outputMessage, int *&outputMessageSize)
|
||||
{
|
||||
@@ -2583,6 +2591,8 @@ const wstring Sapfor_RunTransformation(const char* transformName_c, const char*
|
||||
retCode = SPF_InsertIncludesPass(context, winHandler, optSh, projSh, fold, (char*)addOpt_c, output, outputSize, outputMessage, outputMessageSize);
|
||||
else if (whichRun == "SPF_ResolveParallelRegionConflicts")
|
||||
retCode = SPF_ResolveParallelRegionConflicts(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
||||
else if (whichRun == "SPF_RemoveDistArraysFromIO")
|
||||
retCode = SPF_RemoveDistArraysFromIO(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
||||
else if (whichRun == "SPF_LoopEndDoConverterPass")
|
||||
retCode = SPF_LoopEndDoConverterPass(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize);
|
||||
else if (whichRun == "SPF_CreateParallelVariant")
|
||||
|
||||
Reference in New Issue
Block a user