* [PATCH] eal/riscv: implement prefetch using __builtin_prefetch
@ 2026-03-10 13:35 dangshiwei
2026-03-28 11:48 ` sunyuechi
2026-09-15 13:22 ` Stephen Hemminger
0 siblings, 2 replies; 5+ 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] 5+ 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
2026-09-15 13:22 ` Stephen Hemminger
1 sibling, 1 reply; 5+ 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] 5+ 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
2026-05-26 3:30 ` sunyuechi
0 siblings, 1 reply; 5+ 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] 5+ messages in thread
* Re: [PATCH] eal/riscv: implement prefetch using __builtin_prefetch
2026-03-28 16:38 ` shiwei dang
@ 2026-05-26 3:30 ` sunyuechi
0 siblings, 0 replies; 5+ messages in thread
From: sunyuechi @ 2026-05-26 3:30 UTC (permalink / raw)
To: shiwei dang; +Cc: dev, stanislaw.kardach, stephen, david.marchand
On 3/29/26 12:38 AM, shiwei dang wrote:
> 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
>
>
Hi,
Gentle ping — any update on v2?
^ permalink raw reply [flat|nested] 5+ 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-09-15 13:22 ` Stephen Hemminger
1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2026-09-15 13:22 UTC (permalink / raw)
To: dangshiwei; +Cc: dev, stanislaw.kardach, sunyuechi, david.marchand
On Tue, 10 Mar 2026 21:35:24 +0800
dangshiwei <1138222970gg@gmail.com> wrote:
> 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>
> ---
There is another patch for x86 that does same thing.
https://patchwork.dpdk.org/project/dpdk/patch/20250223125215.358925-2-mattias.ronnblom@ericsson.com/
Would be good to have single common file for all arch.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-15 13:22 UTC | newest]
Thread overview: 5+ 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
2026-05-26 3:30 ` sunyuechi
2026-09-15 13:22 ` Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.