Skip to content

Conversation

@pkubaj
Copy link
Contributor

@pkubaj pkubaj commented Sep 6, 2022

There's no VSX handler on FreeBSD for now.

Motivation and Context

Build issue:

cc  -O2 -pipe  -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/13.0.0/include -fstack-protector-strong -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-error=unused-but-set-variable -Wno-format-zero-length   -Qunused-arguments    -include /wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/include/os/freebsd/spl/sys/ccompile.h -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D__BSD_VISIBLE=1 -DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -DCOMPAT_FREEBSD11 -DNDEBUG -DBITS_PER_LONG=64 -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/include -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/include -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/include/os/freebsd -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/include/os/freebsd/spl -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/include/os/freebsd/zfs -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/module/zstd/include -I/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/module/icp/include -include /wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/module/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -g -fPIC -mlongcall -fno-omit-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/powerpc/include     -MD  -MF.depend.blake3_x86-64.o -MTblake3_x86-64.o -mno-altivec -msoft-float -mabi=elfv2 -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-error=unused-but-set-variable -Wno-format-zero-length   -Qunused-arguments  -std=iso9899:1999 -c /wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/module/icp/algs/blake3/blake3_x86-64.c -o blake3_x86-64.o
/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/module/icp/algs/blake3/blake3_x86-64.c:78:28: error: implicit declaration of function 'zfs_vsx_available' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return (kfpu_allowed() && zfs_vsx_available());
                                  ^
/wrkdirs/usr/ports/sysutils/openzfs-kmod/work/zfs-2d5622f5b/module/icp/algs/blake3/blake3_x86-64.c:144:28: error: implicit declaration of function 'zfs_vsx_available' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return (kfpu_allowed() && zfs_vsx_available());

Description

How Has This Been Tested?

Build-time and run-time.

FreeBSD 14.0-CURRENT on powerpc64, usage of the system.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

There's no VSX handler on FreeBSD for now.

Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
@ryao
Copy link
Contributor

ryao commented Sep 6, 2022

I am confused why this file is even compiled on PPC64. There is nothing in it relevant to other architectures. :/

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Sep 6, 2022
@mcmilk
Copy link
Contributor

mcmilk commented Sep 6, 2022

Blake3 PPC64 little endian should be supported by your system.
You could comment out this call for testing it: /* zfs_vsx_available() */

You can also check it in userspace via this repo: https://github.com/mcmilk/BLAKE3-tests

The only thing which needs some work is the implementation of this function: zfs_vsx_available()

@ghost
Copy link

ghost commented Sep 7, 2022

Indeed, why is blake3_x86-64.c even compiled on PPC? Is it just a badly named file?

@ghost
Copy link

ghost commented Sep 7, 2022

zfs_vsx_available() could be implemented in include/os/freebsd/spl/sys/simd.h but, I wonder if the existing implementation is really specific to Linux?

@mcmilk
Copy link
Contributor

mcmilk commented Sep 7, 2022

Indeed, why is blake3_x86-64.c even compiled on PPC? Is it just a badly named file?

The file blake3_x86-64.c was first the glue for the Intel SSE assembly.
Later this project was found: https://github.com/simd-everywhere/simde ... so I created assembly files based on the Intel SSE intrinsics for BLAKE3 (PPC64 and AARCH64).

The PR #13741 fixes the naming already... the BLAKE3 implementation has then only the files blake3_generic.c and blake3_impl.c. But it's not finished yet, because the PPC Power ISA Version 2.07 checks are not done currently....

The PR #13725 just fixes the module parameter and tuneable handling... and is ready for inclusion.

I have some minutes time today... so I can create some zfs_vsx_available() for FreeBSD ...
@pkubaj - have you tried the userspace blake3 impl on ppc64? On my POWER7 .. POWER9 machines everything was fine.

Edit: I have added a third commit to #13725 ... libspl (userspace) is in progress

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Sep 8, 2022
@behlendorf behlendorf merged commit dff541f into openzfs:master Sep 8, 2022
beren12 pushed a commit to beren12/zfs that referenced this pull request Sep 19, 2022
There's no VSX handler on FreeBSD for now.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
Closes openzfs#13848
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants