mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: 张飞 <zhangfei@nj.iscas.ac.cn>
Cc: musl@lists.openwall.com
Subject: Re: Re: [musl] [PATCH]Implementation of strlen function in riscv64 architecture
Date: Tue, 11 Apr 2023 14:48:22 +0200	[thread overview]
Message-ID: <20230411124822.GK3630668@port70.net> (raw)
In-Reply-To: <27cfcd14.778c.18769bf603d.Coremail.zhangfei@nj.iscas.ac.cn>

* 张飞 <zhangfei@nj.iscas.ac.cn> [2023-04-10 13:59:22 +0800]:
> I have made modifications to the assembly implementation of the riscv64 strlen function, mainly 
> focusing on address alignment processing to avoid the problem of data crossing 
> pages during vector instruction memory access.
> 
> I think the assembly implementation of strlen is necessary. In glibc, 

if the c definition is not correct then you have to explain why.
if it's very slow then please tell us so.

> X86_64, aarch64, alpha, and others all have assembly implementations of this function, 
> while for riscv64, it is blank.
> I have also analyzed the test sets of Spec2006 and Spec2017, and the strlen function is also a hot topic.

an asm implementation has significant maintenance cost so you should
provide some benchmark data or other evidence/reasoning for us to
decide if it's worth the cost.

it seems you replaced the c strlen code with a slower one except when
musl is built for "#ifdef __riscv_vector" isa extension. what cpus
does this affect? are linux distros expected to use this as baseline?
do different riscv cpus have similar simd performance properties? who
will tweak the asm if not?

in principle what you did can be done by the compiler auto vectorizer
so maybe contributing to the compiler is more useful.

note that glibc has cpu specific implementations that it can select
at runtime, but musl uses one generic implementation for all cpus.

  reply	other threads:[~2023-04-11 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  6:21 张飞
2023-03-22  6:27 ` A. Wilcox
2023-03-22 12:15   ` Rich Felker
2023-04-11 12:57     ` Szabolcs Nagy
2023-04-10  5:59   ` 张飞
2023-04-11 12:48     ` Szabolcs Nagy [this message]
2023-04-19  7:22       ` 张飞
2023-04-19 22:39         ` enh

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=20230411124822.GK3630668@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    --cc=zhangfei@nj.iscas.ac.cn \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).