Compare commits

..

No commits in common. "ea45be7ce401e81f1a5907acc4037afcf35dd723" and "88583bcdc16aa351ea2be97c9784574e78b9ad92" have entirely different histories.

4 changed files with 25 additions and 132 deletions

View File

@ -1,67 +0,0 @@
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,19 +1,7 @@
From 78b4e79c4f51a4cb9244ba1d59840ef8a76518cb Mon Sep 17 00:00:00 2001 diff -ruN papi-6.0.0/src/libpfm4/config.mk papi/src/libpfm4/config.mk
Date: Tue, 20 Jun 2023 15:15:04 +0800 --- papi-6.0.0/src/libpfm4/config.mk 2022-10-29 13:04:32.000000000 +0800
Subject: [PATCH] papi add support riscv64 +++ papi/src/libpfm4/config.mk 2023-01-15 21:16:16.101680541 +0800
@@ -177,6 +177,9 @@
---
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 CONFIG_PFMLIB_CELL=y
endif endif
@ -23,11 +11,10 @@ index 2b26947..c12fa45 100644
# #
# you shouldn't have to touch anything beyond this point # you shouldn't have to touch anything beyond this point
diff --git a/src/linux-context.h b/src/linux-context.h diff -ruN papi-6.0.0/src/linux-context.h papi/src/linux-context.h
index f46e557..394a480 100644 --- papi-6.0.0/src/linux-context.h 2022-10-29 13:04:32.000000000 +0800
--- a/src/linux-context.h +++ papi/src/linux-context.h 2023-01-15 21:16:16.101680541 +0800
+++ b/src/linux-context.h @@ -37,6 +37,8 @@
@@ -39,6 +39,8 @@ typedef ucontext_t hwd_ucontext_t;
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc
#elif defined(__hppa__) #elif defined(__hppa__)
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_iaoq[0] #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_iaoq[0]
@ -36,12 +23,11 @@ index f46e557..394a480 100644
#else #else
#error "OVERFLOW_ADDRESS() undefined!" #error "OVERFLOW_ADDRESS() undefined!"
#endif #endif
diff --git a/src/linux-timer.c b/src/linux-timer.c diff -ruN papi-6.0.0/src/linux-timer.c papi/src/linux-timer.c
index 0eaa79c..46bfe75 100644 --- papi-6.0.0/src/linux-timer.c 2022-10-29 13:04:32.000000000 +0800
--- a/src/linux-timer.c +++ papi/src/linux-timer.c 2023-01-15 21:16:16.101680541 +0800
+++ b/src/linux-timer.c @@ -288,6 +288,27 @@
@@ -300,7 +300,27 @@ get_cycles( void ) return 0;
return ret;
} }
+/************************/ +/************************/
@ -53,8 +39,8 @@ index 0eaa79c..46bfe75 100644
+get_cycles( void ) +get_cycles( void )
+{ +{
+ register unsigned long ret; + register unsigned long ret;
+
+ __asm__ __volatile__ ("rdtime %0" : "=r" (ret)); + __asm__ __volatile__ ("rdcycle %0" : "=r" (ret));
+ +
+ return ret; + return ret;
+} +}
@ -68,10 +54,9 @@ index 0eaa79c..46bfe75 100644
#elif !defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_CLOCK_GETTIME) #elif !defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_CLOCK_GETTIME)
#error "No get_cycles support for this architecture. " #error "No get_cycles support for this architecture. "
diff --git a/src/mb.h b/src/mb.h diff -ruN papi-6.0.0/src/mb.h papi/src/mb.h
index 81797c5..347436b 100644 --- papi-6.0.0/src/mb.h 2022-10-29 13:04:32.000000000 +0800
--- a/src/mb.h +++ papi/src/mb.h 2023-01-15 21:16:16.101680541 +0800
+++ b/src/mb.h
@@ -39,6 +39,9 @@ @@ -39,6 +39,9 @@
#elif defined(__aarch64__) #elif defined(__aarch64__)
#define rmb() asm volatile("dmb ld" ::: "memory") #define rmb() asm volatile("dmb ld" ::: "memory")
@ -82,6 +67,3 @@ index 81797c5..347436b 100644
#elif defined(__mips__) #elif defined(__mips__)
#define rmb() asm volatile( \ #define rmb() asm volatile( \
".set mips2\n\t" \ ".set mips2\n\t" \
--
2.33.0

View File

@ -1,19 +1,17 @@
Name: papi Name: papi
Version: 7.1.0 Version: 6.0.0
Release: 3 Release: 1
Summary: Performance Application Programming Interface Summary: Performance Application Programming Interface
License: BSD-3-clause License: BSD
URL: http://icl.cs.utk.edu/papi/ URL: http://icl.cs.utk.edu/papi/
Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz 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: 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: chrpath lm_sensors-devel libpfm-devel >= 4.6.0-1 libpfm-static >= 4.6.0-1
BuildRequires: net-tools rdma-core-devel perl-generators BuildRequires: net-tools rdma-core-devel perl-generators
Requires: python3-unversioned-command
Provides: papi-libs = %{version}-%{release} Provides: papi-libs = %{version}-%{release}
Obsoletes: papi-libs < %{version}-%{release} Obsoletes: papi-libs < %{version}-%{release}
Patch0001: papi-add-support-riscv64.patch Patch0001: papi-add-support-riscv64.patch
Patch0002: add-loongarch64-support-for-papi.patch
%description %description
PAPI provides a programmer interface to monitor the performance of PAPI provides a programmer interface to monitor the performance of
@ -57,10 +55,6 @@ cd src
make DESTDIR=$RPM_BUILD_ROOT LDCONFIG=/bin/true install-all make DESTDIR=$RPM_BUILD_ROOT LDCONFIG=/bin/true install-all
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so* 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 %post
/sbin/ldconfig /sbin/ldconfig
@ -77,7 +71,6 @@ done
%files devel %files devel
%{_includedir}/*.h %{_includedir}/*.h
%{_includedir}/*.hpp
%{_libdir}/*.so %{_libdir}/*.so
%{_libdir}/pkgconfig/papi*.pc %{_libdir}/pkgconfig/papi*.pc
%{_libdir}/*.a %{_libdir}/*.a
@ -90,21 +83,6 @@ done
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %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 * Wed Oct 26 2022 hua <dchang@zhixundn.com> - 6.0.0-1
- upgrade version to 6.0.0 - upgrade version to 6.0.0