!540 [SPEC&CSPGO] Fix SPEC and update the gate of cspgo

From: @li-yancheng 
Reviewed-by: @huang-xiaoquan 
Signed-off-by: @huang-xiaoquan
This commit is contained in:
openeuler-ci-bot 2024-12-31 06:55:17 +00:00 committed by Gitee
commit 18dffd876c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
14 changed files with 670 additions and 466 deletions

View File

@ -0,0 +1,88 @@
From 25f3b77d288e26b198c7836c3ed9b4fb0a85a48a Mon Sep 17 00:00:00 2001
From: liyancheng <412998149@qq.com>
Date: Mon, 16 Dec 2024 15:52:22 +0800
Subject: [PATCH] [CSPGO] Update the gate of cspgo
Update gate to allow CSPGO to be enabled after PGO
---
gcc/tree-profile.cc | 59 +++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
index ace1fe31c..3c57a0a75 100644
--- a/gcc/tree-profile.cc
+++ b/gcc/tree-profile.cc
@@ -1108,34 +1108,47 @@ public:
/* opt_pass methods: */
virtual bool gate (function *)
{
- return (flag_csprofile_generate || flag_csprofile_use);
- }
- /* The main process of cspgo is in csprofile_transform, execute does not need
- to do anything. */
- virtual unsigned int execute (function *)
- {
- if (!profile_data_prefix)
- error ("profile_data_prefix must set when using cspgo.");
+ if (flag_csprofile_generate || flag_csprofile_use)
+ {
+ int ret = true;
+ if (!profile_data_prefix)
+ {
+ error ("pgo profile path must set when using cspgo.");
+ ret = false;
+ }
- if (!csprofile_data_prefix)
- error ("csprofile_data_prefix must set when using cspgo.");
+ if (!csprofile_data_prefix)
+ {
+ error ("cspgo profile path must set when using cspgo.");
+ ret = false;
+ }
- if (!flag_cfgo_profile_use)
- error ("cspgo must used with cfgo-pgo.");
+ if (!(flag_cfgo_profile_use || flag_profile_use))
+ {
+ error ("cspgo must used with cfgo-pgo or pgo.");
+ ret = false;
+ }
- /* Just compare canonical pathnames. */
- char* cfgo_pgo_path = lrealpath (profile_data_prefix);
- char* cfgo_cspgo_path = lrealpath (csprofile_data_prefix);
- bool files_differ = filename_cmp (cfgo_pgo_path, cfgo_cspgo_path);
- if (!files_differ)
- {
- error ("pgo and cspgo path must different between %s and %s",
- cfgo_pgo_path, cfgo_cspgo_path);
+ /* pgo and cspgo path must different. */
+ char* cfgo_pgo_path = lrealpath (profile_data_prefix);
+ char* cfgo_cspgo_path = lrealpath (csprofile_data_prefix);
+ bool files_differ = filename_cmp (cfgo_pgo_path, cfgo_cspgo_path);
+ if (!files_differ)
+ {
+ error ("pgo and cspgo path must different between %s and %s",
+ cfgo_pgo_path, cfgo_cspgo_path);
+ ret = false;
+ }
+ free (cfgo_pgo_path);
+ free (cfgo_cspgo_path);
+
+ return ret;
}
- free (cfgo_pgo_path);
- free (cfgo_cspgo_path);
- return 0;
+ return false;
}
+ /* The main process of cspgo is in csprofile_transform, execute does not need
+ to do anything. */
+ virtual unsigned int execute (function *) { return 0; }
}; // class pass_ipa_csprofile
--
2.25.1

View File

@ -0,0 +1,27 @@
From cd708367a6558eca37715f8068f044a55402edab Mon Sep 17 00:00:00 2001
From: YunQiang Su <yunqiang@isrc.iscas.ac.cn>
Date: Wed, 18 Dec 2024 14:22:03 +0800
Subject: [PATCH] Don't use local_detect_cpu when cross build
-march=native makes no sense for cross build.
---
gcc/gcc.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 179d507f255..f2387e0fae2 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -5800,7 +5800,7 @@ do_self_spec (const char *spec)
do_spec_1 (" ", 0, NULL);
const char* tune_native = NULL;
-#if defined (__x86_64__) || defined (__aarch64__)
+#if !defined(CROSS_DIRECTORY_STRUCTURE) && (defined (__x86_64__) || defined (__aarch64__))
tune_native = eval_spec_function ("local_cpu_detect", "cpu", "");
#endif
if (tune_native == NULL)
--
Gitee

View File

@ -0,0 +1,41 @@
From 00cd602772e471a18b3b36abfa3bde382d239b1f Mon Sep 17 00:00:00 2001
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
Date: Thu, 26 Dec 2024 11:11:41 +0800
Subject: [PATCH] [bugfix] fix costs for hip09.
---
gcc/config/aarch64/aarch64.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index e487ba12bad..65b684ef60f 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -749,8 +749,8 @@ static const struct cpu_regmove_cost hip09_regmove_cost =
1, /* GP2GP */
/* Avoid the use of slow int<->fp moves for spilling by setting
their cost higher than memmov_cost. */
- 2, /* GP2FP */
- 3, /* FP2GP */
+ 5, /* GP2FP */
+ 5, /* FP2GP */
2 /* FP2FP */
};
@@ -1923,10 +1923,10 @@ static const struct tune_params hip09_tunings =
4, /* load_pred. */
4 /* store_pred. */
}, /* memmov_cost. */
- 4, /* issue_rate */
+ 2, /* issue_rate */
(AARCH64_FUSE_AES_AESMC | AARCH64_FUSE_ALU_BRANCH
| AARCH64_FUSE_ALU_CBZ), /* fusible_ops */
- "16", /* function_align. */
+ "16:12", /* function_align. */
"4", /* jump_align. */
"8", /* loop_align. */
2, /* int_reassoc_width. */
--
Gitee

View File

@ -2,7 +2,7 @@
%global gcc_major 12
# Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 59
%global gcc_release 66
%global _unpackaged_files_terminate_build 0
%global _performance_build 1
@ -428,16 +428,19 @@ Patch319: 0319-CSPGO-fix-bugs-when-using-cspgo.patch
Patch320: 0320-if-split-fix-bugs.patch
Patch321: 0321-Struct-reorg-Avoid-doing-struct-split-and-reorder_fi.patch
Patch322: 0322-Bugfix-Create-POINTER_PLUS_EXPR-for-REFERENCE_TYPE.patch
Patch323: 0323-fix-function-missing-return-value.patch
Patch324: 0324-Bugfix-replace-tmp-pattern-split.patch
Patch325: 0325-bugfix-fix-vector-costs-for-hip09.patch
Patch326: 0326-gcc-opts-common.cc-Fix-build-with-clang.patch
Patch327: 0327-BUGFIX-Fix-build-error-on-risv_64.patch
Patch328: 0328-Bugfix-Adjust-the-same-gate-to-use-struct-option.patch
Patch329: 0329-Bugfix-if-split-Added-checking-for-ssa_name.patch
Patch330: 0330-Fixed-work-with-loops-in-process_complex_cond.patch
Patch331: 0331-bugfix-fix-typo-error.patch
Patch323: 0323-Bugfix-replace-tmp-pattern-split.patch
Patch324: 0324-bugfix-fix-vector-costs-for-hip09.patch
Patch325: 0325-gcc-opts-common.cc-Fix-build-with-clang.patch
Patch326: 0326-BUGFIX-Fix-build-error-on-risv_64.patch
Patch327: 0327-Bugfix-Adjust-the-same-gate-to-use-struct-option.patch
Patch328: 0328-Bugfix-if-split-Added-checking-for-ssa_name.patch
Patch329: 0329-Fixed-work-with-loops-in-process_complex_cond.patch
Patch330: 0330-bugfix-fix-typo-error.patch
Patch331: 0331-fix-function-missing-return-value.patch
Patch332: 0332-Bugfix-Can-not-find-fdata-file.patch
Patch333: 0333-CSPGO-Update-the-gate-of-cspgo.patch
Patch334: 0334-Dont-use-local_detect_cpu-when-cross-build.patch
Patch335: 0335-fix-costs-for-hip09.patch
# Part 1001-1999
%ifarch sw_64
@ -1556,6 +1559,9 @@ not stable, so plugins must be rebuilt any time GCC is updated.
%patch -P330 -p1
%patch -P331 -p1
%patch -P332 -p1
%patch -P333 -p1
%patch -P334 -p1
%patch -P335 -p1
%ifarch sw_64
%patch -P1001 -p1
@ -4179,18 +4185,60 @@ end
%doc rpm.doc/changelogs/libcc1/ChangeLog*
%changelog
* Mon Dec 30 2024 Zhenyu Zhao <zhaozhenyu17@huawei.com> - 12.3.1-59
* Tue Dec 31 2024 liyancheng <412998149@qq.com> - 12.3.1-66
- Type:Sync
- ID:NA
- SUG:NA
- DESC:Don't use local_detect_cpu when cross build and fix hip09 costs.
* Mon Dec 30 2024 liyancheng <412998149@qq.com> - 12.3.1-65
- Type:Bugfix
- ID:NA
- SUG:NA
- DESC:Update the gate of cspgo.
* Mon Dec 30 2024 Zhenyu Zhao <zhaozhenyu17@huawei.com> - 12.3.1-64
- Type:Bugfix
- ID:NA
- SUG:NA
- DESC:Sync patches from openeuler/gcc.
* Thu Dec 26 2024 rfwang07 <wangrufeng5@huawei.com> - 12.3.1-58
* Thu Dec 26 2024 rfwang07 <wangrufeng5@huawei.com> - 12.3.1-63
- Type:Bugfix
- ID:NA
- SUG:NA
- DESC:Fix function missing return value.
* Wed Dec 18 2024 Mingchuan Wu <wumingchuan1992@foxmail.com> - 12.3.1-62
- Type:Sync
- ID:NA
- SUG:NA
- DESC: Sync patches from openeuler/gcc.
* Mon Dec 16 2024 huzife <634763349@qq.com> - 12.3.1-61
- Type:Bugfix
- ID:NA
- SUG:NA
- DESC:Add checking for ssa_name in if-split
* Mon Dec 16 2024 huang-xiaoquan <huangxiaoquan1@huawei.com> - 12.3.1-60
- Type:Bugfix
- ID:NA
- SUG:NA
- DESC:Adjust the same gate to use struct option.
* Wed Dec 11 2024 Zhenyu Zhao <zhaozhenyu17@huawei.com> - 12.3.1-59
- Type:Sync
- ID:NA
- SUG:NA
- DESC: Sync patches from openeuler/gcc.
* Tue Dec 10 2024 huzife <634763349@qq.com> - 12.3.1-58
- Type:Bugfix
- ID:NA
- SUG:NA
- DESC: Fix bugs in cmlt, replace tmp pattern split.
* Mon Dec 09 2024 liyancheng <412998149@qq.com> - 12.3.1-57
- Type:Bugfix
- ID:NA