Projects
Mega:24.03:SP1:Everything
clang
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 9
View file
_service:tar_scm:clang.spec
Changed
@@ -1,7 +1,8 @@ %bcond_without sys_llvm %bcond_without check %bcond_with classic_flang -%bcond_without toolchain_clang +%bcond_with toolchain_clang +%bcond_without bisheng_autotuner %if %{with toolchain_clang} %global toolchain clang @@ -42,7 +43,7 @@ Name: %{pkg_name} Version: %{clang_version} -Release: 18 +Release: 20 Summary: A C language family front-end for LLVM License: NCSA @@ -66,6 +67,7 @@ Patch13: 0013-Ignored-option-Wa-generate-missing-build-notes.patch Patch14: 0014-Update-llvm-lit-config-to-support-build_for_openeule.patch Patch15: 0015-Backport-Defer-the-instantiation-of-explicit-specifier-until-.patch +Patch16: 0016-Add-BiSheng-Autotuner-support-for-LLVM-compiler.patch # Patches for clang-tools-extra # See https://reviews.llvm.org/D120301 @@ -276,6 +278,9 @@ %if %{with classic_flang} -DLLVM_ENABLE_CLASSIC_FLANG=ON \ %endif +%if %{with bisheng_autotuner} + -DLLVM_ENABLE_AUTOTUNER=ON \ +%endif -DBUILD_FOR_OPENEULER=ON \ %if "%{toolchain}" == "clang" -DCMAKE_C_COMPILER=clang \ @@ -407,6 +412,12 @@ %{install_bindir}/git-clang-format %changelog +* Tue Jul 30 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-20 +- Disable toolchain_clang build for BiSheng Autotuner support temporary. + +* Tue Jul 16 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-19 +- Add BiSheng Autotuner support. + * Fri Jul 5 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-18 - Add toolchain_clang build support
View file
_service:tar_scm:0016-Add-BiSheng-Autotuner-support-for-LLVM-compiler.patch
Added
@@ -0,0 +1,739 @@ +From a9863e2b6e6783aa9be0b9d1d187084fd4b32a3a Mon Sep 17 00:00:00 2001 +From: Muhammad Asif Manzoor <muhammad.asif.manzoor1@huawei.com> +Date: Thu, 21 Mar 2024 12:50:38 -0400 +Subject: Add BiSheng Autotuner support for LLVM compiler + +Automatic tuning is an automatic iterative process that optimizes a given +program by manipulating compilation options for optimal performance. +BiSheng Autotuner provides a resumable interface for tuning process. BiSheng +Autotuner can tune 1) individual code segments/blocks (fine grain turning) like +loops, callsites, instructions, etc. and 2) entire modules/programs (coarse +grain tuning) for compiler flags, pass ordering, etc. +This patch enables LLVM compiler to extract tuneable code regions and then apply +suggested configuration (by Autotuner) to find out the optimal configurations. +--- + clang/include/clang/Basic/CMakeLists.txt | 15 ++ + .../clang/Basic/DiagnosticDriverKinds.td | 9 ++ + .../clang/Basic/DiagnosticFrontendKinds.td | 8 + + clang/include/clang/Driver/CMakeLists.txt | 6 +- + clang/include/clang/Driver/Driver.h | 36 +++++ + clang/include/clang/Driver/Options.td | 13 ++ + clang/lib/CodeGen/BackendUtil.cpp | 58 +++++++ + clang/lib/Driver/Driver.cpp | 82 ++++++++++ + clang/lib/Driver/ToolChains/Clang.cpp | 21 +++ + clang/lib/Driver/ToolChains/CommonArgs.cpp | 113 ++++++++++++++ + clang/lib/Driver/ToolChains/CommonArgs.h | 8 + + clang/lib/Driver/ToolChains/Gnu.cpp | 34 ++++ + .../ExecuteCompilerInvocation.cpp | 27 ++++ + .../autotune_datadir/baseline-config.yaml | 9 ++ + .../autotune_datadir/random-config.yaml | 9 ++ + .../BaselineConfig/apply-baseline-config.c | 32 ++++ + .../test/Autotuning/Driver/Inputs/config.yaml | 3 + + .../Autotuning/Driver/Inputs/template.yaml | 9 ++ + .../Driver/autotune-generate-pipeline.c | 146 ++++++++++++++++++ + .../Driver/autotune-pipeline-thin-lto.c | 42 +++++ + .../Autotuning/Driver/autotune-pipeline.c | 131 ++++++++++++++++ + .../test/Autotuning/GenerateOpp/generate.cpp | 25 +++ + .../Inputs/template.yaml | 9 ++ + .../IncrementalCompilation/Inputs/test1.c | 3 + + .../IncrementalCompilation/Inputs/test2.c | 17 ++ + .../IncrementalCompilation/Inputs/test3.c | 6 + + .../inc-compile-generate-input.cpp | 44 ++++++ + .../Inputs/datadir/corse_grain_config.yaml | 1 + + .../LTO/Inputs/datadir/fine_grain_a.out.yaml | 4 + + .../LTO/Inputs/datadir/fine_grain_output.yaml | 1 + + .../LTO/apply_config_coarse_grain.cpp | 41 +++++ + .../LTO/apply_config_fine_grain.cpp | 58 +++++++ + .../Autotuning/LTO/generate_opportunity.cpp | 56 +++++++ + .../PhaseOrdering/Inputs/template.yaml | 8 + + .../Autotuning/PhaseOrdering/pass-order.cpp | 48 ++++++ + 42 files changed, 1170 insertions(+), 1 deletion(-) + +diff --git a/clang/include/clang/Basic/CMakeLists.txt b/clang/include/clang/Basic/CMakeLists.txt +index f010e04f62cd..e449d2790597 100644 +--- a/clang/include/clang/Basic/CMakeLists.txt ++++ b/clang/include/clang/Basic/CMakeLists.txt +@@ -1,6 +1,12 @@ ++set(CLANG_BASIC_OPTIONS) ++if(LLVM_ENABLE_AUTOTUNER) ++ list(APPEND CLANG_BASIC_OPTIONS "-DENABLE_AUTOTUNER") ++endif() ++ + macro(clang_diag_gen component) + clang_tablegen(Diagnostic${component}Kinds.inc + -gen-clang-diags-defs -clang-component=${component} ++ ${CLANG_BASIC_OPTIONS} + SOURCE Diagnostic.td + TARGET ClangDiagnostic${component}) + endmacro(clang_diag_gen) +@@ -18,20 +24,24 @@ clang_diag_gen(Refactoring) + clang_diag_gen(Sema) + clang_diag_gen(Serialization) + clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups ++ ${CLANG_BASIC_OPTIONS} + SOURCE Diagnostic.td + TARGET ClangDiagnosticGroups) + + clang_tablegen(DiagnosticIndexName.inc -gen-clang-diags-index-name ++ ${CLANG_BASIC_OPTIONS} + SOURCE Diagnostic.td + TARGET ClangDiagnosticIndexName) + + clang_tablegen(AttrList.inc -gen-clang-attr-list + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ ++ ${CLANG_BASIC_OPTIONS} + SOURCE Attr.td + TARGET ClangAttrList) + + clang_tablegen(AttrSubMatchRulesList.inc -gen-clang-attr-subject-match-rule-list + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ ++ ${CLANG_BASIC_OPTIONS} + SOURCE Attr.td + TARGET ClangAttrSubjectMatchRuleList) + +@@ -43,6 +53,7 @@ clang_tablegen(AttrTokenKinds.inc -gen-clang-attr-token-kinds + + clang_tablegen(AttrHasAttributeImpl.inc -gen-clang-attr-has-attribute-impl + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ ++ ${CLANG_BASIC_OPTIONS} + SOURCE Attr.td + TARGET ClangAttrHasAttributeImpl + ) +@@ -67,15 +78,19 @@ clang_tablegen(arm_mve_builtin_aliases.inc -gen-arm-mve-builtin-aliases + SOURCE arm_mve.td + TARGET ClangARMMveBuiltinAliases) + clang_tablegen(arm_sve_builtins.inc -gen-arm-sve-builtins ++ ${CLANG_BASIC_OPTIONS} + SOURCE arm_sve.td + TARGET ClangARMSveBuiltins) + clang_tablegen(arm_sve_builtin_cg.inc -gen-arm-sve-builtin-codegen ++ ${CLANG_BASIC_OPTIONS} + SOURCE arm_sve.td + TARGET ClangARMSveBuiltinCG) + clang_tablegen(arm_sve_typeflags.inc -gen-arm-sve-typeflags ++ ${CLANG_BASIC_OPTIONS} + SOURCE arm_sve.td + TARGET ClangARMSveTypeFlags) + clang_tablegen(arm_sve_sema_rangechecks.inc -gen-arm-sve-sema-rangechecks ++ ${CLANG_BASIC_OPTIONS} + SOURCE arm_sve.td + TARGET ClangARMSveSemaRangeChecks) + clang_tablegen(arm_sme_builtins.inc -gen-arm-sme-builtins +diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td +index 37586242953f..6b68bc458b93 100644 +--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td ++++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td +@@ -248,6 +248,15 @@ def err_drv_cannot_read_config_file : Error< + "cannot read configuration file '%0': %1">; + def err_drv_arg_requires_bitcode_input: Error< + "option '%0' requires input to be LLVM bitcode">; ++#ifdef ENABLE_AUTOTUNER ++def err_drv_autotune_generic : Error<"%0">; ++def err_drv_autotune_disabled_O0 : Error< ++ "-fautotune/-fautotune-generate should not be enabled at -O0">; ++def err_drv_autotune_incorrect_env : Error< ++ "incorrect argument '%0' in environment variable used">; ++def err_drv_autotune_no_filter_types : Error< ++ "no types added for filtering with %0">; ++#endif + + def err_target_unsupported_arch + : Error<"the target architecture '%0' is not supported by the target '%1'">; +diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td +index 9ed9a88fa3d6..11022962ae9e 100644 +--- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td ++++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td +@@ -346,4 +346,12 @@ def warn_profile_data_misexpect : Warning< + def err_extract_api_ignores_file_not_found : + Error<"file '%0' specified by '--extract-api-ignores=' not found">, DefaultFatal; + ++#ifdef ENABLE_AUTOTUNER ++let CategoryName = "AutoTuning Issues" in { ++def err_auto_tuning_error_reading : Error<"'%0'">; ++def err_auto_tuning_error_dumping : Error<"'%0'">; ++def err_unable_to_create_pass : Error< ++ "cannot create pass '%0' from AutoTuning input file">; ++} // end of autoTuning issue category ++#endif + } +diff --git a/clang/include/clang/Driver/CMakeLists.txt b/clang/include/clang/Driver/CMakeLists.txt +index 8c0af1528a96..56fff6a2504e 100644 +--- a/clang/include/clang/Driver/CMakeLists.txt ++++ b/clang/include/clang/Driver/CMakeLists.txt +@@ -8,7 +8,11 @@ endif() + if (LLVM_ENABLE_CLASSIC_FLANG) + list(APPEND CLANG_DRIVER_OPTIONS -DENABLE_CLASSIC_FLANG ) + endif() +- ++ ++if (LLVM_ENABLE_AUTOTUNER) ++ list(APPEND CLANG_DRIVER_OPTIONS "-DENABLE_AUTOTUNER" ) ++endif() ++ + tablegen(LLVM Options.inc ${CLANG_DRIVER_OPTIONS} -gen-opt-parser-defs ) + + add_public_tablegen_target(ClangDriverOptions) +diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h +index e3e98bad9912..dcecb473b516 100644 +--- a/clang/include/clang/Driver/Driver.h ++++ b/clang/include/clang/Driver/Driver.h +@@ -72,6 +72,14 @@ enum ModuleHeaderMode { + HeaderMode_System + }; + ++#if defined(ENABLE_AUTOTUNER) ++enum AutoTuneKind { ++ AutoTuneNone, ++ AutoTuneGenerate, ++ AutoTuneNext, ++}; ++#endif ++ + /// Driver - Encapsulate logic for constructing compilation processes + /// from a set of gcc-driver-like command line arguments. + class Driver { +@@ -119,6 +127,11 @@ class Driver { + /// LTO mode selected via -f(no-offload-)?lto(=.*)? options. + LTOKind OffloadLTOMode; + ++#if defined(ENABLE_AUTOTUNER)
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/clang.git</param> - <param name="revision">d67aec17c6e9d84982123bcb16d7f27e44748c9f</param> + <param name="revision">89eaf3689c6542da3f30fc9f56dc5bd3840de94a</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2