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 B1FF543D18;
	Thu, 21 Mar 2024 18:27:10 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 44DB842830;
	Thu, 21 Mar 2024 18:27:10 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 989FD427E1
 for <dev@dpdk.org>; Thu, 21 Mar 2024 18:27:08 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1086)
 id EA75820B74C0; Thu, 21 Mar 2024 10:27:07 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EA75820B74C0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1711042027;
 bh=J418EevalnSReA9yl5GMm3taOKX22GfEvu/ByKrBTG8=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=Ow7cRUcECAZYmBiZUjSFBRJffj7J/tHFLa68rHym4FFPpzmZeFbzdBG2ND4+pp6ey
 uOiDVnNf3sv0IsZX1aRCn3lkyduLlPk5vRyELLbOTpBN2GzJGJTvsQG3bSOLomnkXH
 /ADVJfvtMhYQNklHrdE6zBspk4GjDEaJwTDu/8HM=
Date: Thu, 21 Mar 2024 10:27:07 -0700
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
 Jasvinder Singh <jasvinder.singh@intel.com>,
 Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Subject: Re: [PATCH] net: stop using mmx intrinsics
Message-ID: <20240321172707.GA1605@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
References: <1710969121-18503-1-git-send-email-roretzla@linux.microsoft.com>
 <1710969121-18503-2-git-send-email-roretzla@linux.microsoft.com>
 <13164815.EVyyLHbfrO@thomas>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <13164815.EVyyLHbfrO@thomas>
User-Agent: Mutt/1.5.21 (2010-09-15)
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

On Thu, Mar 21, 2024 at 06:09:01PM +0100, Thomas Monjalon wrote:
> 20/03/2024 22:12, Tyler Retzlaff:
> > +#ifdef RTE_TOOLCHAIN_MSVC
> > +#include <intrin.h>
> > +#else
> >  #include <x86intrin.h>
> > +#endif
> 
> It is not the same include in MSVC?

unfortunately intrin.h is vestigial in the monolithic approach. to use
any intrinsic you're supposed to include only the one and only true
header instead of vendor/arch feature specific headers.

> Is it something we want to wrap in a DPDK header file?

do you mean create a monolithic rte_intrinsic.h header that is
essentially

#ifdef MSVC
#include <intrin.h>
#else
#include <x86intrin.h>
#include <immintrin.h>
#include <nmmintrin.h>
...
#endif

i assumed that doing something like this might be unpopular due to the
unnecessary namespace pollution.

another alternative could be to find a way to limit that pollution only
to msvc by stashing intrin.h in e.g. rte_common.h (or rte_os.h) under
conditional compile but the problem i think we had with that approach is
that some llvm headers don't define prototypes that match those from
msvc see lib/eal/windows/include/rte_windows.h another issue arises
where if the application includes intrin.h before dpdk headers we again
have to deal with llvm vs msvc differences.

fwiw the instance highlighted llvm should have volatile qualified in
their prototype but didn't.

i will commit to looking into this more after applications are working.