Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2024 16:08:52 -0300
From:      Mitchell Horne <mhorne@freebsd.org>
To:        Robert Clausecker <fuz@freebsd.org>, freebsd-riscv@freebsd.org
Cc:        strajabot@gmail.com
Subject:   Re: Detecting the Zbb extension on riscv64
Message-ID:  <5c8fcee8-61dc-4eec-8ef9-35aba33b8482@freebsd.org>
In-Reply-To: <ZlxZn5IQuQ-zqbwl@fuz.su>
References:  <ZlxZn5IQuQ-zqbwl@fuz.su>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6/2/24 08:38, Robert Clausecker wrote:
> Greetings!
> 
> I'm currently working on two projects that require the Zbb
> instruction set extension on riscv64:
> 
>   - strajabot@ is a gsoc student who is currently porting the
>     SIMD-enhanced libc string functions from amd64 to riscv64.
>     For these, Zbb is immensely useful as it provides the
>     CTZ and ORC.B instructions needed for fast string comparison
> 
>   - I'm trying to write a fast sha1 implementation for libmd,
>     which (you might have guessed it) requires Zbb for rotate
>     instructions.  Not having these is possible here, but there
>     is a significant performance penalty.
> 
> Zbb is supported by the SiFive unmatched board for example.
> 
> I originally wanted to just write an ifunc dispatcher that
> checks for the presence off Zbb and then picks an appropriate
> implementation, but then noticed that AT_HWCAP currently only
> supports the detection of capital letter extensions.
> 

Hi Robert,

It should not be much work to start parsing for Zbb or similar 
extensions, so I can take this on soon. I mainly need to see what Linux 
is doing these days w.r.t. reporting multi-letter extensions to userspace.

> Furthermore, we do not give user space any access to the isa
> string (a sysctl like hw.isa would be nice), so it's not even
> possible to determine the availability manually.
> 
> Please check if you can add a sysctl to get the ISA string and
> possibly add an elf_aux_info extension to allow the user to find
> out which Z extensions are present.

This is good feedback; possible a little more annoying to implement than 
it would seem, but I'll consider this too.

Cheers,
Mitchell

> 
> We are working with 15-CURRENT, so if it's there it'll suffice
> for our needs.
> 
> Yours,
> Robert Clausecker
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5c8fcee8-61dc-4eec-8ef9-35aba33b8482>