Compare commits
10 Commits
88583bcdc1
...
ea45be7ce4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea45be7ce4 | ||
|
|
a2b8526d81 | ||
|
|
6c5afadc85 | ||
|
|
f646ead3e1 | ||
|
|
9bf7fefa13 | ||
|
|
066167856b | ||
|
|
acf13c113a | ||
|
|
bda4058e7c | ||
|
|
b64ba0eec1 | ||
|
|
c889e24346 |
67
add-loongarch64-support-for-papi.patch
Normal file
67
add-loongarch64-support-for-papi.patch
Normal 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
|
||||
|
||||
Binary file not shown.
@ -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
|
||||
|
||||
|
||||
28
papi.spec
28
papi.spec
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user