From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: <uk7b@foxmail.com>, <dev@dpdk.org>
Cc: sunyuechi <sunyuechi@iscas.ac.cn>,
Thomas Monjalon <thomas@monjalon.net>,
Bruce Richardson <bruce.richardson@intel.com>,
Stanislaw Kardach <stanislaw.kardach@gmail.com>
Subject: Re: [PATCH 2/3] lib/lpm: R-V V rte_lpm_lookupx4
Date: Fri, 30 May 2025 14:13:57 +0100 [thread overview]
Message-ID: <6aa7f332-c9fa-43e4-95f4-66c34f2c63bc@intel.com> (raw)
In-Reply-To: <tencent_A2BD85C9F3B0AA4658640DA91443CDF5630A@qq.com>
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
Hi Sunyuechi,
On 28/05/2025 18:00, uk7b@foxmail.com wrote:
> From: sunyuechi<sunyuechi@iscas.ac.cn>
>
> bpi-f3:
> scalar: 5.7 cycles
> rvv: 2.4 cycles
>
> Maybe runtime detection in LPM should be added for all architectures,
> but this commit is only about the RVV part.
Iwouldadviseyouto lookintothe FIBlibrary,ithasexactlywhatyouare lookingfor.
Also,pleaseconsiderwritinga slightlymoreinformativeandexplanatorycommit
message.
> Signed-off-by: sunyuechi<sunyuechi@iscas.ac.cn>
> ---
> MAINTAINERS | 2 +
> lib/lpm/meson.build | 1 +
> lib/lpm/rte_lpm.h | 2 +
> lib/lpm/rte_lpm_rvv.h | 91 +++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 96 insertions(+)
> create mode 100644 lib/lpm/rte_lpm_rvv.h
>
<snip>
> +static inline void rte_lpm_lookupx4_rvv(
> + const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], uint32_t defv)
> +{
> + size_t vl = 4;
> +
> + const uint32_t *tbl24_p = (const uint32_t *)lpm->tbl24;
> + uint32_t tbl_entries[4] = {
> + tbl24_p[((uint32_t)ip[0]) >> 8],
> + tbl24_p[((uint32_t)ip[1]) >> 8],
> + tbl24_p[((uint32_t)ip[2]) >> 8],
> + tbl24_p[((uint32_t)ip[3]) >> 8],
> + };
I'm notan expertinRISC-V,butwhyis itdonein a
scalarwayinsteadofusing__riscv_vsrl_vx_u32m1()? Iassumeyou're
relyingonthe compilerhere?
Also,have youredefinedthe xmm_t typeforproperindexaddressing?
> + vuint32m1_t vtbl_entry = __riscv_vle32_v_u32m1(tbl_entries, vl);
> +
> + vbool32_t mask = __riscv_vmseq_vx_u32m1_b32(
> + __riscv_vand_vx_u32m1(vtbl_entry, RTE_LPM_VALID_EXT_ENTRY_BITMASK, vl),
> + RTE_LPM_VALID_EXT_ENTRY_BITMASK, vl);
<snip>
> +
> +static inline void rte_lpm_lookupx4(
> + const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], uint32_t defv)
> +{
> + lpm_lookupx4_impl(lpm, ip, hop, defv);
> +}
> +
> +RTE_INIT(rte_lpm_init_alg)
> +{
> + lpm_lookupx4_impl = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RISCV_ISA_V)
> + ? rte_lpm_lookupx4_rvv
> + : rte_lpm_lookupx4_scalar;
> +}
AsImentionedearlier,I'd recommendthat youuseFIBtoselectan
implementationatruntime. All the rest LPM vector x4 implementations are
done this way, and their code is inlined.
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_LPM_RVV_H_ */
--
Regards,
Vladimir
[-- Attachment #2: Type: text/html, Size: 14247 bytes --]
prev parent reply other threads:[~2025-05-30 13:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 17:00 uk7b
2025-05-30 13:13 ` Medvedkin, Vladimir [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6aa7f332-c9fa-43e4-95f4-66c34f2c63bc@intel.com \
--to=vladimir.medvedkin@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stanislaw.kardach@gmail.com \
--cc=sunyuechi@iscas.ac.cn \
--cc=thomas@monjalon.net \
--cc=uk7b@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).