public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] eal/riscv: implement prefetch using __builtin_prefetch
@ 2026-03-10 13:35 dangshiwei
  2026-03-28 11:48 ` sunyuechi
  0 siblings, 1 reply; 3+ messages in thread
From: dangshiwei @ 2026-03-10 13:35 UTC (permalink / raw)
  To: dev; +Cc: stanislaw.kardach, sunyuechi, stephen, david.marchand, dangshiwei

RISC-V currently has no-op implementations of the rte_prefetch*
functions. Use __builtin_prefetch() to allow the compiler to emit
Zicbop prefetch instructions when the target supports them (GCC
13.1+, Clang 17.0.1+ with -march=rv*_zicbop).

The Zicbop extension has no cache-level hints, so rte_prefetch1()
and rte_prefetch2() fall back to rte_prefetch0(). The volatile
qualifier is stripped via uintptr_t cast to satisfy
__builtin_prefetch()'s const void * parameter without triggering
-Wdiscarded-qualifiers.

This replaces the abandoned v1 series by Daniel Gregory
(Message-ID: 20240530171948.19763-1-daniel.gregory@bytedance.com)
addressing reviewer feedback from Kardach and Hemminger.

Signed-off-by: dangshiwei <1138222970gg@gmail.com>
---
 lib/eal/riscv/include/rte_prefetch.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/eal/riscv/include/rte_prefetch.h b/lib/eal/riscv/include/rte_prefetch.h
index 42146491ea..37b4787387 100644
--- a/lib/eal/riscv/include/rte_prefetch.h
+++ b/lib/eal/riscv/include/rte_prefetch.h
@@ -18,22 +18,24 @@ extern "C" {
 
 static inline void rte_prefetch0(const volatile void *p)
 {
-	RTE_SET_USED(p);
+	__builtin_prefetch((const void *)(uintptr_t)p);
 }
 
 static inline void rte_prefetch1(const volatile void *p)
 {
-	RTE_SET_USED(p);
+	/* Zicbop has no cache-level hints, fallback to rte_prefetch0 */
+	rte_prefetch0(p);
 }
 
 static inline void rte_prefetch2(const volatile void *p)
 {
-	RTE_SET_USED(p);
+	/* Zicbop has no cache-level hints, fallback to rte_prefetch0 */
+	rte_prefetch0(p);
 }
 
 static inline void rte_prefetch_non_temporal(const volatile void *p)
 {
-	/* non-temporal version not available, fallback to rte_prefetch0 */
+	/* Zicbop has no non-temporal hint, fallback to rte_prefetch0 */
 	rte_prefetch0(p);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] eal/riscv: implement prefetch using __builtin_prefetch
  2026-03-10 13:35 [PATCH] eal/riscv: implement prefetch using __builtin_prefetch dangshiwei
@ 2026-03-28 11:48 ` sunyuechi
  2026-03-28 16:38   ` shiwei dang
  0 siblings, 1 reply; 3+ messages in thread
From: sunyuechi @ 2026-03-28 11:48 UTC (permalink / raw)
  To: dangshiwei, dev; +Cc: stanislaw.kardach, stephen, david.marchand

Hi,

In the previous prefetch discussion:

"Let's hope you get such hardware by the next release. We will need 
reviews too."

https://inbox.dpdk.org/dev/CAJFAV8zatWiYQoe4kETcM61=OS1k=QaPRsNjYSYDspKC+voiQw@mail.gmail.com/

Could you share your test environment and results?

And DPDK requires a real name in the Signed-off-by line.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] eal/riscv: implement prefetch using __builtin_prefetch
  2026-03-28 11:48 ` sunyuechi
@ 2026-03-28 16:38   ` shiwei dang
  0 siblings, 0 replies; 3+ messages in thread
From: shiwei dang @ 2026-03-28 16:38 UTC (permalink / raw)
  To: sunyuechi; +Cc: dev, stanislaw.kardach, stephen, david.marchand

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Hi ,

Thanks for the review. I'll address both points (real name in Signed-off-by
and test results) together in v2 once I have access to physical RISC-V
hardware.

Best regards, Dang Shiwei

On Sat, Mar 28, 2026 at 7:48 PM sunyuechi <sunyuechi@iscas.ac.cn> wrote:

> Hi,
>
> In the previous prefetch discussion:
>
> "Let's hope you get such hardware by the next release. We will need
> reviews too."
>
>
> https://inbox.dpdk.org/dev/CAJFAV8zatWiYQoe4kETcM61=OS1k=QaPRsNjYSYDspKC+voiQw@mail.gmail.com/
>
> Could you share your test environment and results?
>
> And DPDK requires a real name in the Signed-off-by line.
>
>

[-- Attachment #2: Type: text/html, Size: 1458 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-28 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 13:35 [PATCH] eal/riscv: implement prefetch using __builtin_prefetch dangshiwei
2026-03-28 11:48 ` sunyuechi
2026-03-28 16:38   ` shiwei dang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox