Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
ea45be7ce4
!39 [sync] PR-38: [手工同步PR37]修复rdcycle非法指令错误
From: @openeuler-sync-bot 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2024-12-20 04:17:21 +00:00
laokz
a2b8526d81 riscv: fix 'rdcycle' illegal instruction error
(cherry picked from commit 4bb02aa90cb5fca5c11a4c90d7c0fb520953b5b8)
2024-10-25 15:09:17 +08:00
openeuler-ci-bot
6c5afadc85
!33 [sync] PR-32: add loongarch64 support for papi
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2024-05-22 09:28:49 +00:00
Wenlong Zhang
f646ead3e1 add loongarch64 support for papi
(cherry picked from commit b78ba612024c6c83754b55dc3b60802f89a426ff)
2024-04-23 17:19:10 +08:00
openeuler-ci-bot
9bf7fefa13
!31 Upgrade to version 7.1.0
From: @lyn1001 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2024-01-09 01:32:36 +00:00
lyn1001
066167856b Upgrade to version 7.1.0 2024-01-02 14:29:30 +08:00
openeuler-ci-bot
acf13c113a
!28 [sync] PR-27: remove binaries runpath & rpath
From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-08-28 03:20:22 +00:00
chen-jan
bda4058e7c remove binaries runpath & rpath
(cherry picked from commit 201d81ca5e204fb564eeb3954d8bb6b78e41ad20)
2023-08-28 10:29:54 +08:00
openeuler-ci-bot
b64ba0eec1
!24 Update to version 7.0.1
From: @wang--ge 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-06-20 08:55:48 +00:00
wang--ge
c889e24346 update to version 7.0.1 2023-06-20 16:21:14 +08:00
4 changed files with 132 additions and 25 deletions

View File

@ -0,0 +1,67 @@
From 5caa74b57f4f0bbcdef3a0d764b544f5c6061222 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Tue, 16 Apr 2024 02:24:07 +0000
Subject: [PATCH] add loongarch64 support for papi
---
src/linux-context.h | 2 ++
src/linux-timer.c | 15 +++++++++++++++
src/mb.h | 3 +++
3 files changed, 20 insertions(+)
diff --git a/src/linux-context.h b/src/linux-context.h
index 394a480..00ebf73 100644
--- a/src/linux-context.h
+++ b/src/linux-context.h
@@ -41,6 +41,8 @@ typedef ucontext_t hwd_ucontext_t;
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_iaoq[0]
#elif defined(__riscv)
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.__gregs[REG_PC]
+#elif defined(__loongarch__)
+#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.__pc
#else
#error "OVERFLOW_ADDRESS() undefined!"
#endif
diff --git a/src/linux-timer.c b/src/linux-timer.c
index 46bfe75..666801f 100644
--- a/src/linux-timer.c
+++ b/src/linux-timer.c
@@ -322,6 +322,21 @@ get_cycles( void )
* Timers and Counters
*/
+/****************************/
+/* loongarch64 get_cycles() */
+/****************************/
+#elif defined(__loongarch__)
+static inline long long
+get_cycles(void)
+{
+ register unsigned long ret = 0;
+ int rID = 0;
+ __asm__ __volatile__ ("ibar 0" ::: "memory");
+ __asm__ __volatile__ ("rdtime.d %0, %1" :"=r"(ret),"=r"(rID));
+ return ret;
+}
+
+
#elif !defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_CLOCK_GETTIME)
#error "No get_cycles support for this architecture. "
#endif
diff --git a/src/mb.h b/src/mb.h
index 347436b..03e910b 100644
--- a/src/mb.h
+++ b/src/mb.h
@@ -42,6 +42,9 @@
#elif defined(__riscv)
#define rmb() asm volatile("fence ir, ir" ::: "memory")
+#elif defined(__loongarch__)
+#define rmb() asm volatile("dbar 0" ::: "memory")
+
#elif defined(__mips__)
#define rmb() asm volatile( \
".set mips2\n\t" \
--
2.43.0

View File

@ -1,7 +1,19 @@
diff -ruN papi-6.0.0/src/libpfm4/config.mk papi/src/libpfm4/config.mk
--- papi-6.0.0/src/libpfm4/config.mk 2022-10-29 13:04:32.000000000 +0800
+++ papi/src/libpfm4/config.mk 2023-01-15 21:16:16.101680541 +0800
@@ -177,6 +177,9 @@
From 78b4e79c4f51a4cb9244ba1d59840ef8a76518cb Mon Sep 17 00:00:00 2001
Date: Tue, 20 Jun 2023 15:15:04 +0800
Subject: [PATCH] papi add support riscv64
---
src/libpfm4/config.mk | 3 +++
src/linux-context.h | 2 ++
src/linux-timer.c | 20 ++++++++++++++++++++
src/mb.h | 3 +++
4 files changed, 28 insertions(+)
diff --git a/src/libpfm4/config.mk b/src/libpfm4/config.mk
index 2b26947..c12fa45 100644
--- a/src/libpfm4/config.mk
+++ b/src/libpfm4/config.mk
@@ -177,6 +177,9 @@ ifeq ($(ARCH),cell)
CONFIG_PFMLIB_CELL=y
endif
@ -11,10 +23,11 @@ diff -ruN papi-6.0.0/src/libpfm4/config.mk papi/src/libpfm4/config.mk
#
# you shouldn't have to touch anything beyond this point
diff -ruN papi-6.0.0/src/linux-context.h papi/src/linux-context.h
--- papi-6.0.0/src/linux-context.h 2022-10-29 13:04:32.000000000 +0800
+++ papi/src/linux-context.h 2023-01-15 21:16:16.101680541 +0800
@@ -37,6 +37,8 @@
diff --git a/src/linux-context.h b/src/linux-context.h
index f46e557..394a480 100644
--- a/src/linux-context.h
+++ b/src/linux-context.h
@@ -39,6 +39,8 @@ typedef ucontext_t hwd_ucontext_t;
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc
#elif defined(__hppa__)
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_iaoq[0]
@ -23,11 +36,12 @@ diff -ruN papi-6.0.0/src/linux-context.h papi/src/linux-context.h
#else
#error "OVERFLOW_ADDRESS() undefined!"
#endif
diff -ruN papi-6.0.0/src/linux-timer.c papi/src/linux-timer.c
--- papi-6.0.0/src/linux-timer.c 2022-10-29 13:04:32.000000000 +0800
+++ papi/src/linux-timer.c 2023-01-15 21:16:16.101680541 +0800
@@ -288,6 +288,27 @@
return 0;
diff --git a/src/linux-timer.c b/src/linux-timer.c
index 0eaa79c..46bfe75 100644
--- a/src/linux-timer.c
+++ b/src/linux-timer.c
@@ -300,7 +300,27 @@ get_cycles( void )
return ret;
}
+/************************/
@ -36,17 +50,17 @@ diff -ruN papi-6.0.0/src/linux-timer.c papi/src/linux-timer.c
+
+#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
+static inline long long
+get_cycles( void )
+{
+get_cycles( void )
+{
+ register unsigned long ret;
+
+ __asm__ __volatile__ ("rdcycle %0" : "=r" (ret));
+ __asm__ __volatile__ ("rdtime %0" : "=r" (ret));
+
+ return ret;
+}
+}
+
+/*
+ * TODO: riscv32 implementation can be done following example in:
+ * TODO: riscv32 implementation can be done following example in:
+ * Volume I: RISC-V User-Level ISA V2.2
+ * 2.8 Control and Status Register Instructions
+ * Timers and Counters
@ -54,9 +68,10 @@ diff -ruN papi-6.0.0/src/linux-timer.c papi/src/linux-timer.c
#elif !defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_CLOCK_GETTIME)
#error "No get_cycles support for this architecture. "
diff -ruN papi-6.0.0/src/mb.h papi/src/mb.h
--- papi-6.0.0/src/mb.h 2022-10-29 13:04:32.000000000 +0800
+++ papi/src/mb.h 2023-01-15 21:16:16.101680541 +0800
diff --git a/src/mb.h b/src/mb.h
index 81797c5..347436b 100644
--- a/src/mb.h
+++ b/src/mb.h
@@ -39,6 +39,9 @@
#elif defined(__aarch64__)
#define rmb() asm volatile("dmb ld" ::: "memory")
@ -67,3 +82,6 @@ diff -ruN papi-6.0.0/src/mb.h papi/src/mb.h
#elif defined(__mips__)
#define rmb() asm volatile( \
".set mips2\n\t" \
--
2.33.0

View File

@ -1,17 +1,19 @@
Name: papi
Version: 6.0.0
Release: 1
Version: 7.1.0
Release: 3
Summary: Performance Application Programming Interface
License: BSD
License: BSD-3-clause
URL: http://icl.cs.utk.edu/papi/
Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz
BuildRequires: autoconf doxygen ncurses-devel gcc-gfortran kernel-headers >= 2.6.32
BuildRequires: chrpath lm_sensors-devel libpfm-devel >= 4.6.0-1 libpfm-static >= 4.6.0-1
BuildRequires: net-tools rdma-core-devel perl-generators
Requires: python3-unversioned-command
Provides: papi-libs = %{version}-%{release}
Obsoletes: papi-libs < %{version}-%{release}
Patch0001: papi-add-support-riscv64.patch
Patch0002: add-loongarch64-support-for-papi.patch
%description
PAPI provides a programmer interface to monitor the performance of
@ -55,6 +57,10 @@ cd src
make DESTDIR=$RPM_BUILD_ROOT LDCONFIG=/bin/true install-all
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so*
file `find $RPM_BUILD_ROOT%{_bindir} -type f` |grep -w ELF |awk -F":" '{print $1}'|for file in `xargs`
do
chrpath --delete $file
done
%post
/sbin/ldconfig
@ -71,6 +77,7 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so*
%files devel
%{_includedir}/*.h
%{_includedir}/*.hpp
%{_libdir}/*.so
%{_libdir}/pkgconfig/papi*.pc
%{_libdir}/*.a
@ -83,6 +90,21 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so*
%{_mandir}/man3/*
%changelog
* Fri Oct 25 2024 laokz <zhangkai@iscas.ac.cn> - 7.1.0-3
- Riscv64: fix 'rdcycle' instruction to 'rdtime'
* Tue Apr 16 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 7.1.0-2
- add loongarch64 support for papi
* Tue Jan 2 2024 liyanan <liyanan61@h-partners.com> - 7.1.0-1
- Upgrade to version 7.1.0
* Mon Aug 28 2023 chenchen <chen_aka_jan@163.com> - 7.0.1-2
- remove binaries runpath & rpath
* Tue Jun 20 2023 Ge Wang <wang__ge@126.com> - 7.0.1-1
- Upgrade to version 7.0.1
* Wed Oct 26 2022 hua <dchang@zhixundn.com> - 6.0.0-1
- upgrade version to 6.0.0