From e40137402ead45ada452cc21a999ceae6aa9ae64 Mon Sep 17 00:00:00 2001 From: Michele Fiorito Date: Sun, 22 Oct 2023 23:46:15 +0200 Subject: [PATCH 1/4] Appimage build script fix --- .devcontainer/library-scripts/appimage-build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/library-scripts/appimage-build.sh b/.devcontainer/library-scripts/appimage-build.sh index 93f6167d8..f8d13db7d 100755 --- a/.devcontainer/library-scripts/appimage-build.sh +++ b/.devcontainer/library-scripts/appimage-build.sh @@ -36,7 +36,8 @@ fi export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LIBRARY_PATH if [ "$(cat ${build_dir}/current_build)" != "${config_args}" ]; then echo "Configuration necessary for ${config_args}" - cd ${build_dir} && ${repo_dir}/configure --prefix=/usr -C ${config_args} && echo "${config_args}" | tee "${build_dir}/current_build" + cd ${build_dir}; ${repo_dir}/configure --prefix=/usr -C ${config_args} + echo "${config_args}" | tee "${build_dir}/current_build" fi echo "Build PandA Bambu HLS" From ec01a54bc5a5d4edee05265929eb93c3d39cc568 Mon Sep 17 00:00:00 2001 From: Michele Fiorito Date: Sun, 22 Oct 2023 23:46:35 +0200 Subject: [PATCH 2/4] Panda version bump --- ChangeLog | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 393505067..aa46772ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -=========== PANDA 2023.09 =========== +=========== PANDA 2023.10 =========== Eleventh public release of PandA framework. New features introduced: diff --git a/configure.ac b/configure.ac index 70ba8084a..d44540b87 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ # # ################################################################################ AC_PREREQ(2.57) -AC_INIT(PandA, 2023.09, panda-info@polimi.it) +AC_INIT(PandA, 2023.10, panda-info@polimi.it) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([-Wno-portability 1.9 tar-pax subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) From d2a227ae91e23b5ae0fb95db851a9d3bd8b34c41 Mon Sep 17 00:00:00 2001 From: Michele Fiorito Date: Wed, 25 Oct 2023 12:34:15 +0200 Subject: [PATCH 3/4] Full regression workflows update --- .github/workflows/full-clang.yml | 2 ++ .github/workflows/full-gcc.yml | 2 ++ .github/workflows/reusable-grs.yml | 13 +++++++++---- .github/workflows/reusable-script_call.yml | 14 ++++++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/full-clang.yml b/.github/workflows/full-clang.yml index dae053e81..d2ce162a3 100644 --- a/.github/workflows/full-clang.yml +++ b/.github/workflows/full-clang.yml @@ -83,6 +83,7 @@ jobs: fail-fast: false matrix: compiler: [I386_CLANG4, I386_CLANG5, I386_CLANG6, I386_CLANG7, I386_CLANG8, I386_CLANG9, I386_CLANG10, I386_CLANG11, I386_CLANG12, I386_CLANG13, I386_CLANG16] + name: "GRS (Compiler: ${{matrix.compiler}})" uses: ./.github/workflows/reusable-grs.yml with: package-name: ${{needs.build.outputs.package-name}} @@ -96,6 +97,7 @@ jobs: fail-fast: false matrix: compiler: [I386_CLANG4, I386_CLANG5, I386_CLANG6, I386_CLANG7, I386_CLANG8, I386_CLANG9, I386_CLANG10, I386_CLANG11, I386_CLANG12, I386_CLANG13, I386_CLANG16] + name: "GRS SDC (Compiler: ${{matrix.compiler}})" uses: ./.github/workflows/reusable-grs.yml with: package-name: ${{needs.build.outputs.package-name}} diff --git a/.github/workflows/full-gcc.yml b/.github/workflows/full-gcc.yml index 7f322d9a8..e02829c70 100644 --- a/.github/workflows/full-gcc.yml +++ b/.github/workflows/full-gcc.yml @@ -84,6 +84,7 @@ jobs: fail-fast: false matrix: compiler: [I386_GCC49, I386_GCC5, I386_GCC6, I386_GCC7, I386_GCC8] + name: "GRS (Compiler: ${{matrix.compiler}})" uses: ./.github/workflows/reusable-grs.yml with: package-name: ${{needs.build.outputs.package-name}} @@ -97,6 +98,7 @@ jobs: fail-fast: false matrix: compiler: [I386_GCC49, I386_GCC5, I386_GCC6, I386_GCC7, I386_GCC8] + name: "GRS SDC (Compiler: ${{matrix.compiler}})" uses: ./.github/workflows/reusable-grs.yml with: package-name: ${{needs.build.outputs.package-name}} diff --git a/.github/workflows/reusable-grs.yml b/.github/workflows/reusable-grs.yml index 10db0518a..b5ba57c23 100644 --- a/.github/workflows/reusable-grs.yml +++ b/.github/workflows/reusable-grs.yml @@ -28,7 +28,8 @@ jobs: grs: uses: ./.github/workflows/reusable-script_call.yml with: - script: generic_gcc_regression_simple_bambu.sh + name: "GCC Regression Simple (Compiler: ${{inputs.compiler}})" + script: ./panda_regressions/hls/generic_gcc_regression_simple_bambu.sh package-name: ${{inputs.package-name}} compiler: ${{inputs.compiler}} args: ${{inputs.additional-args}} @@ -38,7 +39,8 @@ jobs: needs: [grs] uses: ./.github/workflows/reusable-script_call.yml with: - script: generic_gcc_regression_simple_bambu_pretty_print.sh + name: "GRS Pretty Print (Compiler: ${{inputs.compiler}})" + script: ./panda_regressions/hls/generic_gcc_regression_simple_bambu_pretty_print.sh package-name: ${{inputs.package-name}} compiler: ${{inputs.compiler}} args: ${{inputs.additional-args}} --skip_list 20071029-1 @@ -48,7 +50,8 @@ jobs: needs: [grs] uses: ./.github/workflows/reusable-script_call.yml with: - script: generic_gcc_regression_simple_eg_ext_pipelined.sh + name: "GRS Expose Globals (Compiler: ${{inputs.compiler}})" + script: ./panda_regressions/hls/generic_gcc_regression_simple_eg.sh package-name: ${{inputs.package-name}} compiler: ${{inputs.compiler}} args: ${{inputs.additional-args}} @@ -58,7 +61,8 @@ jobs: needs: [grs, grs-eg] uses: ./.github/workflows/reusable-script_call.yml with: - script: generic_gcc_regression_simple_eg.sh + name: "GRS Expose Globals Pipelined Memory (Compiler: ${{inputs.compiler}})" + script: ./panda_regressions/hls/generic_gcc_regression_simple_eg_ext_pipelined.sh package-name: ${{inputs.package-name}} compiler: ${{inputs.compiler}} args: ${{inputs.additional-args}} @@ -67,6 +71,7 @@ jobs: libm: uses: ./.github/workflows/reusable-script_call.yml with: + name: "LibM (Compiler: ${{inputs.compiler}})" script: generic_libm-tests.sh package-name: ${{inputs.package-name}} compiler: ${{inputs.compiler}} diff --git a/.github/workflows/reusable-script_call.yml b/.github/workflows/reusable-script_call.yml index fd56123ef..9f60d9fca 100644 --- a/.github/workflows/reusable-script_call.yml +++ b/.github/workflows/reusable-script_call.yml @@ -1,4 +1,4 @@ -name: Reusable Script Caller +name: Reusable Panda Test Script Caller on: workflow_call: @@ -12,7 +12,7 @@ on: required: true type: string script: - description: "Script name for the test" + description: "Panda test script filename" required: true type: string args: @@ -20,6 +20,11 @@ on: required: false type: string default: "" + name: + description: "Job display name" + required: false + type: string + default: "${{inputs.script}} (Compiler: ${{inputs.compiler}})" secrets: CI_STORAGE_URL: required: true @@ -36,8 +41,9 @@ env: host_jobs: $J jobs: - script_call: + test_panda: runs-on: [self-hosted, long] + name: ${{inputs.name}} steps: - name: Checkout repository uses: actions/checkout@v3 @@ -75,7 +81,7 @@ jobs: mkdir ${{env.report-dir}} out_dir="$PWD/${{env.report-dir}}" echo "test-reports-dir=$out_dir" >> $GITHUB_OUTPUT - ./panda_regressions/hls/${{inputs.script}} \ + ${{inputs.script}} \ --returnfail --junitdir="$out_dir" --csv="$out_dir/perf.csv" \ --table="$out_dir/perf.tex" -c=--compiler=${{inputs.compiler}} ${{inputs.args}} - name: Upload test reports From 540154676921d0dda91cf445c0f8ba2198bf2051 Mon Sep 17 00:00:00 2001 From: Michele Fiorito Date: Fri, 27 Oct 2023 16:56:34 +0200 Subject: [PATCH 4/4] Function versioning update Versioned function naming is now meaningful with respect to versioned arguments and allows to exploit already optimized functions. Also, unwanted recursive versioning is avoided thanks to the new naming. --- .../IR_analysis/FunctionCallOpt.cpp | 36 +++++++++++++++++-- .../IR_analysis/FunctionCallOpt.hpp | 2 -- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/frontend_analysis/IR_analysis/FunctionCallOpt.cpp b/src/frontend_analysis/IR_analysis/FunctionCallOpt.cpp index 6e1fcbda2..fbe35a795 100644 --- a/src/frontend_analysis/IR_analysis/FunctionCallOpt.cpp +++ b/src/frontend_analysis/IR_analysis/FunctionCallOpt.cpp @@ -64,6 +64,8 @@ #include "tree_node.hpp" #include "tree_reindex.hpp" +#include + #define PARAMETER_INLINE_MAX_COST "inline-max-cost" #define DEAFULT_MAX_INLINE_CONST 60 @@ -71,7 +73,6 @@ CustomSet FunctionCallOpt::always_inline; CustomSet FunctionCallOpt::never_inline; CustomMap>> FunctionCallOpt::opt_call; size_t FunctionCallOpt::inline_max_cost = DEAFULT_MAX_INLINE_CONST; -unsigned FunctionCallOpt::version_uid = 1U; static CustomUnorderedMap op_costs = { {call_expr_K, 8}, {mult_expr_K, 3}, {widen_mult_expr_K, 3}, {widen_mult_hi_expr_K, 3}, @@ -81,6 +82,26 @@ static CustomUnorderedMap op_costs = { {nop_expr_K, 0}, {ssa_name_K, 0}, {addr_expr_K, 0}, {bit_ior_concat_expr_K, 0}, {extract_bit_expr_K, 0}}; +static std::string __arg_suffix(const std::vector& tns) +{ + std::stringstream suffix; + for(const auto& tn : tns) + { + if(tree_helper::IsConstant(tn)) + { + suffix << tn; + } + else + { + suffix << "_" << STR(GET_INDEX_CONST_NODE(tn)); + } + } + const auto hash = std::hash{}(suffix.str()); + suffix.str(std::string()); + suffix << "_" << std::hex << hash; + return suffix.str(); +} + FunctionCallOpt::FunctionCallOpt(const ParameterConstRef Param, const application_managerRef _AppM, unsigned int _function_id, const DesignFlowManagerConstRef _design_flow_manager) : FunctionFrontendFlowStep(_AppM, _function_id, FUNCTION_CALL_OPT, _design_flow_manager, Param), caller_bb() @@ -263,11 +284,20 @@ DesignFlowStep_Status FunctionCallOpt::InternalExec() THROW_ASSERT(GET_CONST_NODE(called_fn)->get_kind() == function_decl_K, "Call statement should address a function declaration"); - const auto version_fn = tree_man->CloneFunction(called_fn, "_const" + STR(version_uid++)); + const auto version_suffix = __arg_suffix(*args); + if(ends_with(tree_helper::GetFunctionName(TM, called_fn), version_suffix)) + { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Call already versioned..."); + continue; + } + const auto version_fn = tree_man->CloneFunction(called_fn, version_suffix); INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Call before versioning : " + STR(stmt)); if(ret_val) { - const auto ce = tree_man->CreateCallExpr(version_fn, *args, BUILTIN_SRCP); + const auto has_args = + !GetPointer(GET_CONST_NODE(version_fn))->list_of_args.empty(); + const auto ce = tree_man->CreateCallExpr( + version_fn, has_args ? *args : std::vector(), BUILTIN_SRCP); const auto ga = GetPointerS(call_node); AppM->GetCallGraphManager()->RemoveCallPoint(function_id, called_fn->index, stmt->index); TM->ReplaceTreeNode(stmt, ga->op1, ce); diff --git a/src/frontend_analysis/IR_analysis/FunctionCallOpt.hpp b/src/frontend_analysis/IR_analysis/FunctionCallOpt.hpp index 9074501ae..170c8599e 100644 --- a/src/frontend_analysis/IR_analysis/FunctionCallOpt.hpp +++ b/src/frontend_analysis/IR_analysis/FunctionCallOpt.hpp @@ -67,8 +67,6 @@ class FunctionCallOpt : public FunctionFrontendFlowStep private: static CustomMap>> opt_call; - static unsigned int version_uid; - static size_t inline_max_cost; CustomMap caller_bb;