From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 66B52A034F;
	Tue,  9 Nov 2021 18:34:41 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2E31840E03;
	Tue,  9 Nov 2021 18:34:41 +0100 (CET)
Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com
 [209.85.219.177])
 by mails.dpdk.org (Postfix) with ESMTP id 606E84068B
 for <dev@dpdk.org>; Tue,  9 Nov 2021 18:34:39 +0100 (CET)
Received: by mail-yb1-f177.google.com with SMTP id o12so54954562ybk.1
 for <dev@dpdk.org>; Tue, 09 Nov 2021 09:34:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=zv1rxRRRkBrraLTv9Z9BENPUgIvu/iFwBzvTPmWAE5A=;
 b=hpXXz75bylzDz/3rVXvK9BEerkF2C4u6mmKyM+16m0asDp80UzOLzfWsrpYzKQA5Yp
 Uc+VUFCN35j+QVG+Xh0s6vUu6UHddKZ3NtVfe98YG5K/VI5GUebUjW8D2tnhF7foc5la
 EAO+VIbKcPHmkqnKTopqEXUbfwBIE42mCsttg=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=zv1rxRRRkBrraLTv9Z9BENPUgIvu/iFwBzvTPmWAE5A=;
 b=0gENZmLySUrJihOGSv2atkD3vTlcUcnYXMy1L2Ht6ZzKkJOO3Uf9vah8WsqTRBBEH6
 DLypjF+Xxst7HXogeeG/YEkrGBw+GMbe+zhFJ+L6j4hqsRho9jGtbTlD70u29csuUWb1
 eObNyfVHlQc+9HDvRtDLzmGElg8LnFGIWW6S7uIEHTDnc+wHHUTW2KBTmWlQVrBQyXvr
 98bd0f7BjPxxqa6p+qmlc6/Ff+82YsXEKHofjlOPMii+KqfC47bcCkEQSH0SAkUKv38o
 Yo17iv+TRcUq2aY+ndCE6oXD/Xk0OmV1YVwELnxGBJP2PbBQ1pPR+2rQKdhI+KhPfoZi
 DA1g==
X-Gm-Message-State: AOAM533D6x23GvNdDocedIL1SJjllYJeSDHx3q5ferYObYKJBZTG99qx
 SHiksRfGFZ46AbtCpbDEVOU9KTxJDJYazk3KFDVSdQ==
X-Google-Smtp-Source: ABdhPJwI6RKxlCsXXqJcJt7WJTmbB553AtPLgkI/wgkyNIlKf1Wm0AURI++NdJhcuBgPH5ZkuJ82C/o61qMMuk5Cq9k=
X-Received: by 2002:a05:6902:1201:: with SMTP id
 s1mr9663791ybu.248.1636479278719; 
 Tue, 09 Nov 2021 09:34:38 -0800 (PST)
MIME-Version: 1.0
References: <20211109172456.147140-1-vladimir.medvedkin@intel.com>
In-Reply-To: <20211109172456.147140-1-vladimir.medvedkin@intel.com>
From: Lance Richardson <lance.richardson@broadcom.com>
Date: Tue, 9 Nov 2021 12:34:27 -0500
Message-ID: <CADyeNEBoQeMaP=k=_JJ2_F1JcM+mpiJJLm4sk6iqNF0TgYbfcA@mail.gmail.com>
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: dev <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>, 
 David Marchand <david.marchand@redhat.com>, 
 "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
 Yipeng Wang <yipeng1.wang@intel.com>, 
 Sameh Gobriel <sameh.gobriel@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH] hash: fix thash gfni implementation
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Tue, Nov 9, 2021 at 12:25 PM Vladimir Medvedkin
<vladimir.medvedkin@intel.com> wrote:
>
> This patch replaces _mm512_set_epi8 with _mm512_set_epi32
> due to the lack of support by some compilers.
> Also this patch checks if AVX512F is supported along with GFNI.
> This is done if the code is built on a platform that supports GFNI,
> but does not support AVX512.
>
> Fixes: 4fd8c4cb0de1 ("hash: add new Toeplitz hash implementation")
> Cc: vladimir.medvedkin@intel.com
>
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---
>  lib/hash/rte_thash_x86_gfni.h | 31 +++++++++++++------------------
>  1 file changed, 13 insertions(+), 18 deletions(-)
>
> diff --git a/lib/hash/rte_thash_x86_gfni.h b/lib/hash/rte_thash_x86_gfni.h
> index c2889c3734..7afbbedc08 100644
> --- a/lib/hash/rte_thash_x86_gfni.h
> +++ b/lib/hash/rte_thash_x86_gfni.h
> @@ -18,7 +18,7 @@
>  extern "C" {
>  #endif
>
> -#ifdef __GFNI__
> +#if defined(__GFNI__) && defined(__AVX512F__)
>  #define RTE_THASH_GFNI_DEFINED
>
>  #define RTE_THASH_FIRST_ITER_MSK       0x0f0f0f0f0f0e0c08
> @@ -56,23 +56,18 @@ static inline __m512i
>  __rte_thash_gfni(const uint64_t *mtrx, const uint8_t *tuple,
>         const uint8_t *secondary_tuple, int len)
>  {
> -       __m512i permute_idx = _mm512_set_epi8(7, 6, 5, 4, 7, 6, 5, 4,
> -                                               6, 5, 4, 3, 6, 5, 4, 3,
> -                                               5, 4, 3, 2, 5, 4, 3, 2,
> -                                               4, 3, 2, 1, 4, 3, 2, 1,
> -                                               3, 2, 1, 0, 3, 2, 1, 0,
> -                                               2, 1, 0, -1, 2, 1, 0, -1,
> -                                               1, 0, -1, -2, 1, 0, -1, -2,
> -                                               0, -1, -2, -3, 0, -1, -2, -3);
> -
> -       const __m512i rewind_idx = _mm512_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
> -                                               0, 0, 0, 0, 0, 0, 0, 0,
> -                                               0, 0, 0, 0, 0, 0, 0, 0,
> -                                               0, 0, 0, 0, 0, 0, 0, 0,
> -                                               0, 0, 0, 0, 0, 0, 0, 0,
> -                                               0, 0, 0, 59, 0, 0, 0, 59,
> -                                               0, 0, 59, 58, 0, 0, 59, 58,
> -                                               0, 59, 58, 57, 0, 59, 58, 57);
> +       __m512i permute_idx = _mm512_set_epi32(0x7060504, 0x7060504,
> +                                               0x6050403, 0x6050403,
> +                                               0x5040302, 0x5040302,
> +                                               0x4030201, 0x4030201,
> +                                               0x3020100, 0x3020100,
> +                                               0x20100FF, 0x20100FF,
> +                                               0x100FFFE, 0x100FFFE,
> +                                               0xFFFEFD, 0xFFFEFD);
> +       const __m512i rewind_idx = _mm512_set_epi32(0, 0, 0, 0, 0, 0, 0, 0,
> +                                                       0, 0, 0x3B, 0x3B,
> +                                                       0x3B3A, 0x3B3A,
> +                                                       0x3B3A39, 0x3B3A39);
>         const __mmask64 rewind_mask = RTE_THASH_REWIND_MSK;
>         const __m512i shift_8 = _mm512_set1_epi8(8);
>         __m512i xor_acc = _mm512_setzero_si512();
> --
> 2.25.1
>
This fixes the gcc 8 build issue on my CentOS 8 system.

Acked-by: Lance Richardson <lance.richardson@broadcom.com>