Bug 251173

Summary: graphics/png: add SIMD option
Product: Ports & Packages Reporter: Piotr Kubaj <pkubaj>
Component: Individual Port(s)Assignee: Piotr Kubaj <pkubaj>
Status: Closed FIXED    
Severity: Affects Only Me CC: portmgr
Priority: --- Keywords: buildisok
Version: LatestFlags: antoine: maintainer-feedback+
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch
none
v2 pkubaj: maintainer-approval? (portmgr)

Description Piotr Kubaj freebsd_committer freebsd_triage 2020-11-16 02:16:14 UTC
Created attachment 219720 [details]
patch

This patch adds SIMD option and enables it by default on aarch64, amd64 and powerpc64le, since the instructions it enables are the baseline for those architectures.

This will probably also require an exp-run, but waiting for maintainer feedback first.
Comment 1 Automation User 2020-12-01 00:16:07 UTC
Build and package info is available at https://gitlab.com/swills/freebsd-ports/pipelines/223426026
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2020-12-01 08:13:22 UTC
(In reply to Piotr Kubaj from comment #0)
It seems that on amd64,  --enable-hardware-optimizations is not enough, you have to add --enable-intel-sse too?
Comment 3 Piotr Kubaj freebsd_committer freebsd_triage 2021-01-11 00:04:20 UTC
(In reply to Antoine Brodin from comment #2)
My understanding is that --enable-hardware-optimizations enables NEON on arm* / aarch64, MSA on mipsel* / mips64el*, SSE on i386 / amd64 and VSX on powerpc*. There's the following code in configure.ac:
AC_ARG_ENABLE([hardware-optimizations],
   AS_HELP_STRING([[[--enable-hardware-optimizations]]],
      [Enable hardware optimizations: =no/off, yes/on:]),
   [case "$enableval" in
      no|off)
         # disable hardware optimization on all systems:
         enable_arm_neon=no
         AC_DEFINE([PNG_ARM_NEON_OPT], [0],
           [Disable ARM_NEON optimizations])
         enable_mips_msa=no
         AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
           [Disable MIPS_MSA optimizations])
         enable_powerpc_vsx=no
         AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
           [Disable POWERPC VSX optimizations])
         enable_intel_sse=no
         AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
           [Disable INTEL_SSE optimizations])
         ;;
      *)
         # allow enabling hardware optimization on any system:
         case "$host_cpu" in
            arm*|aarch64*)
              enable_arm_neon=yes
              AC_DEFINE([PNG_ARM_NEON_OPT], [0],
                [Enable ARM_NEON optimizations])
              ;;
            mipsel*|mips64el*)
              enable_mips_msa=yes
              AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
                [Enable MIPS_MSA optimizations])
              ;;
            i?86|x86_64)
              enable_intel_sse=yes
              AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
                [Enable Intel SSE optimizations])
              ;;
            powerpc*|ppc64*)
              enable_powerpc_vsx=yes
              AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
                [Enable POWERPC VSX optimizations])
              ;;
         esac
         ;;
   esac])
Comment 4 Antoine Brodin freebsd_committer freebsd_triage 2021-01-11 08:38:27 UTC
(In reply to Piotr Kubaj from comment #3)
The problem is that amd64 does not match i?86|x86_64
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2021-01-21 14:37:33 UTC
Created attachment 221786 [details]
v2

Corrected patch.
Comment 6 Antoine Brodin freebsd_committer freebsd_triage 2021-01-30 09:06:06 UTC
This looks fine.  Please bump PORTREVISION.
Comment 7 Piotr Kubaj freebsd_committer freebsd_triage 2021-01-30 11:54:03 UTC
Thanks!
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-01-30 11:55:41 UTC
A commit references this bug:

Author: pkubaj
Date: Sat Jan 30 11:54:44 UTC 2021
New revision: 563287
URL: https://svnweb.freebsd.org/changeset/ports/563287

Log:
  graphics/png: add SIMD option

  It's enabled by default on aarch64, amd64 and powerpc64le, which should have optimizations that are enabled in their baselines (NEON, SSE2 and VSX respectively).

  PR:             251173
  Approved by:    antoine@ (maintainer)

Changes:
  head/graphics/png/Makefile
  head/graphics/png/files/
  head/graphics/png/files/patch-configure