!33 [sync] PR-32: add loongarch64 support for papi
From: @openeuler-sync-bot Reviewed-by: @lyn1001 Signed-off-by: @lyn1001
This commit is contained in:
commit
6c5afadc85
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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: papi
|
||||
Version: 7.1.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Performance Application Programming Interface
|
||||
License: BSD-3-clause
|
||||
URL: http://icl.cs.utk.edu/papi/
|
||||
@ -13,6 +13,7 @@ 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
|
||||
@ -89,6 +90,9 @@ done
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user