From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BF17A04BE; Mon, 7 Sep 2020 00:20:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 97A502BAB; Mon, 7 Sep 2020 00:20:38 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0E9AC29AC for ; Mon, 7 Sep 2020 00:20:36 +0200 (CEST) IronPort-SDR: rmdCEsFi/YU7n2qC1JYgpQr2rQT9u7H87UUAiRb35DQv9HkcDvm0CvgPZV8Fc+RtEL+/LSmaUP N5ICNouB1qSw== X-IronPort-AV: E=McAfee;i="6000,8403,9736"; a="242747978" X-IronPort-AV: E=Sophos;i="5.76,399,1592895600"; d="scan'208";a="242747978" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2020 15:20:36 -0700 IronPort-SDR: zNTQqkYdPxiPfn1YleSDFCIEU5m+Ch4qHawIXntwkAj5hBkBqFJPricFfSZdYehkQoyvc3Y7QP f4QHr+X09vTQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,399,1592895600"; d="scan'208";a="283969800" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga007.fm.intel.com with ESMTP; 06 Sep 2020 15:20:36 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 6 Sep 2020 15:20:35 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 6 Sep 2020 15:20:35 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 6 Sep 2020 15:20:35 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Sun, 6 Sep 2020 15:20:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWJIMVgbbCB/SamVOkScbhYJEgK9Uqe7uEv3hFCUYDFWvm81NPYBhc7ItCg5reoDOTKPDI2k+CDtwrejm4Tf4A1Sw10Jsnk/Ulh0ksiXKQ2uMxJoucjulxWE4kRE8fg2hTFv/+ju3gkH0WqHGLtZ9/QYqAzPTsKtA5pvNb3IhunB73XPBtq9OHz9HTnF9mlJBwI4219N55XwL2MYa6AVOFUQGm8yadUrALIJCYF54+3o/NYJWEtNNBZ3OiMIRfEuFUPYVeN1Xmq8noT/w/+6AAdZsCrXUghGH/2cImWlcYcte9i6fvAjrCqC0DurtqJvwgegZAfzrIO1AHN2Bimhig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UbSW11rYaFBeQ25KRqgiAYymb051gc9lCx4yIpBqxUs=; b=GDWL1TqpUyKvHt/XR3i7f7BJWFJdZDQrnQ2kAFTvIKPgV0zFyhfcFuJk6QayB+MWPqkhye6wXgrgwr3T3H8gfaQfvU946BMMjBo+6uQnRAM97ih8D45nnK8Ek/XieSPh/DMKPTPegTHwm9xceLX1sNuf4HO0rtRh9AgrlD8nk1DFOxE5ZpZzU9UJP5cW9okCzWy+CBcpIJIgzP8pOTHtC6NXe2IpCuXax86k3QcKEUvjFCsDEevZyp50GMNk2RAa6N26ew/ua9TReq6RLa5+2cBQP8dKs8nrdovNVk03fgD2CMP0K855CbupVIwgKajoZL4y5+Q+RBz8vodk4IUydA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UbSW11rYaFBeQ25KRqgiAYymb051gc9lCx4yIpBqxUs=; b=VvESRHXngqJRzlNPt9jfEIu3YELCMQznxIiIud4nz9adYT3njKeLueLe92QkX1tyz9YSuAlFDY8k4S9US1App7aLi/8YD1oNdbkzCMiFjFhufFYbhImbuxOB3t4Hdr0Ail+Tfrn3Xx2+e5hnmPRGFahyjdZJ68WjQrjcNNVfNxg= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BY5PR11MB4307.namprd11.prod.outlook.com (2603:10b6:a03:1bd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Sun, 6 Sep 2020 22:20:30 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f43b:a137:dab8:8b0b]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f43b:a137:dab8:8b0b%6]) with mapi id 15.20.3348.019; Sun, 6 Sep 2020 22:20:30 +0000 From: "Ananyev, Konstantin" To: "Power, Ciara" , "dev@dpdk.org" CC: "Power, Ciara" , "Burakov, Anatoly" , "Mcnamara, John" , "Kovacevic, Marko" Thread-Topic: [dpdk-dev] [PATCH v2 03/17] doc: add detail on using max SIMD bitwidth Thread-Index: AQHWfI2RJTzM42wRBkmWe5Th/zJwNqlcOZRw Date: Sun, 6 Sep 2020 22:20:30 +0000 Message-ID: References: <20200807155859.63888-1-ciara.power@intel.com> <20200827161304.32300-1-ciara.power@intel.com> <20200827161304.32300-4-ciara.power@intel.com> In-Reply-To: <20200827161304.32300-4-ciara.power@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b76475f7-71ce-45d8-521e-08d852b310c7 x-ms-traffictypediagnostic: BY5PR11MB4307: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7xwr5tBHDr5K0AuKxbvN39yGaUjI4oGQE8FWVq75sqjDZJvEl+vrD1jQp8WjNAXIIBSH4y28xU8xj99Z0lWIkCQjMYoJvij5hhXNwH8sWqLo3Q9xN9elzBsZQTjEZCyNR0HaUkz5jVhiqx4TGxUmI3QSt796rpOZXjioDR/ikgeaNj4+D0UsRIqDmiDeQj/+MmzXnQAYMeV3phD7rXUmZrrWRyaUu9XAcNosTBlxDpJoEM+C0n4fgTktD2Z3MH9mmXz+vaYM0WL6yulB6f82yKC+IOV3mPYYIcRD05kBhLssde1LljXB7wbWJpiMF/nfloYTTFHh46RFSwolrTSpzw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(346002)(376002)(136003)(396003)(4326008)(86362001)(478600001)(107886003)(316002)(110136005)(2906002)(8936002)(7696005)(54906003)(9686003)(55016002)(5660300002)(52536014)(6506007)(186003)(26005)(76116006)(83380400001)(71200400001)(33656002)(66946007)(66446008)(64756008)(66556008)(66476007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: ZQKwa4jMYNhsreN98g1ZILQ0ssQjJ7+6L1Q2wvf7ZLItltVK8S0TziCs2uc0uAcXhEVuuMdxNyhve3E46sJB1uKAfh5gLdtAb1wwjyVUczUH2oRllZDkjEnCHLVVvjDs5NaXSww/aFsIOmh29xmgeHfxUKRugwut0g7qbzwpUp9Q9aPGGD6KDoIIF8L8N7ksSTjt11p6Hou5E6ZWHtON0ZNlN1iiRFlkyK7AMLwemg6kIfs7lLHklTygRce6v23OYKgEfXw3UvXkHQJ7GEb6djj50Id9aUSW0rWtjBo9ZUG7SBtTa70DeCc5rHzKkBwVlVpatfRbhAKjjqVv4UaJnBDqLxtpxcKghP9/9UR9crrx3tI7XHNdgNuxIT4Tb/+V82vay+FUUj/1WYXhXQTGgP8wu3TSas+3qyu9DWSeDcfUyykxMBZITJ4nkqSvIpAiPawVM24NtiBRT7YTuuer1vvYiIcrkN3I0r5ua8QZ6jT8T+vYfwd9FDx7cHzBG9psiLJH6wp+64oGfRxzi6570TMkUCeYVlKZA86TlyyWTxHzhaD5HyThXKVlCCtjJd6BetH3+cFWwxoUcICvFu/YtnQo/S7DFxvjM9+nbt4xED6DquvRI7OiZiQgEAEnNfVEuVH84B0CKAY7ubVQCl6taA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b76475f7-71ce-45d8-521e-08d852b310c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2020 22:20:30.4980 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8Gr4kczD1BiV4ZlEHF+ksvQXQYYc16I8x1hrN3ZQogeTpblFDIuu4Hzf+UgkF99p7PmJ4lupjcuihRYFmTYXr9z1G/Ep4OsG4KUOWLj0ZaE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4307 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 03/17] doc: add detail on using max SIMD bitwidth X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > This patch adds documentation on the usage of the max SIMD bitwidth EAL > setting, and how to use it to enable AVX-512 at runtime. >=20 > Cc: Anatoly Burakov > Cc: John McNamara > Cc: Marko Kovacevic >=20 > Signed-off-by: Ciara Power > --- > doc/guides/howto/avx512.rst | 36 +++++++++++++++++++ > doc/guides/linux_gsg/eal_args.include.rst | 12 +++++++ > .../prog_guide/env_abstraction_layer.rst | 31 ++++++++++++++++ > 3 files changed, 79 insertions(+) > create mode 100644 doc/guides/howto/avx512.rst >=20 > diff --git a/doc/guides/howto/avx512.rst b/doc/guides/howto/avx512.rst > new file mode 100644 > index 0000000000..ebae0f2b4f > --- /dev/null > +++ b/doc/guides/howto/avx512.rst > @@ -0,0 +1,36 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2020 Intel Corporation. > + > + > +Using AVX-512 with DPDK > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +AVX-512 is not used by default in DPDK, but it can be selected at runtim= e by apps through the use of EAL API, > +and by the user with a commandline argument. DPDK has a setting for max = SIMD bitwidth, > +which can be modified and will then limit the vector path taken by the c= ode. It's is a good idea to have such ability, though just one global variable for all DPDK lib/drivers seems a bit coarse to me. Let say we have 2 libs: libA and libB. Both do have RTE_MAX_512_SIMD specific code-path, though libA would cause frequency level change, while libB wouldn't. So user (to avoid frequency level change) would have to block 512_SIMD for both libs. I think it would be much better to follow the strategy we use for log-level= : there is a global simd_width, but each DDPK entity (lib/driver) also has = =20 it's own simd_width that overrules a global one (more fine-grained control)= . > + > + > +Using the API in apps > +--------------------- > + > +Apps can request DPDK uses AVX-512 at runtime, if it provides improved a= pplication performance. > +This can be done by modifying the EAL setting for max SIMD bitwidth to 5= 12, as by default it is 256, > +which does not allow for AVX-512. > + > +.. code-block:: c > + > + rte_set_max_simd_bitwidth(RTE_MAX_512_SIMD); > + > +This API should only be called once at initialization, before EAL init. If the only possible usage scenario for that function is init time before = EAL init, then do we really need it at all? As we have cmd-line flag anyway? User can achieve similar goal, by just: rte_eal_init(,..."--force-max-simd= -bitwidth=3D..."...);=20 > +For more information on the possible enum values to use as a parameter, = go to :ref:`max_simd_bitwidth`: > + > + > +Using the command-line argument > +--------------------------------------------- > + > +The user can select to use AVX-512 at runtime, using the following argum= ent to set the max bitwidth:: > + > + ./app/dpdk-testpmd --force-max-simd-bitwidth=3D512 > + > +This will override any further changes to the max SIMD bitwidth in DPDK, > +which is useful for testing purposes. > diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux= _gsg/eal_args.include.rst > index 0fe4457968..bab3e14e47 100644 > --- a/doc/guides/linux_gsg/eal_args.include.rst > +++ b/doc/guides/linux_gsg/eal_args.include.rst > @@ -210,3 +210,15 @@ Other options > * ``--no-telemetry``: >=20 > Disable telemetry. > + > +* ``--force-max-simd-bitwidth=3D``: > + > + Specify the maximum SIMD bitwidth size to handle. This limits which = vector paths, > + if any, are taken, as any paths taken must use a bitwidth below the = max bitwidth limit. > + For example, to allow all SIMD bitwidths up to and including AVX-512= :: > + > + --force-max-simd-bitwidth=3D512 > + > + The following example shows limiting the bitwidth to 64-bits to disa= ble all vector code:: > + > + --force-max-simd-bitwidth=3D64 > diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides= /prog_guide/env_abstraction_layer.rst > index f64ae953d1..74f26ed6c9 100644 > --- a/doc/guides/prog_guide/env_abstraction_layer.rst > +++ b/doc/guides/prog_guide/env_abstraction_layer.rst > @@ -486,6 +486,37 @@ the desired addressing mode when virtual devices tha= t are not directly attached > To facilitate forcing the IOVA mode to a specific value the EAL command = line option ``--iova-mode`` can > be used to select either physical addressing('pa') or virtual addressing= ('va'). >=20 > +.. _max_simd_bitwidth: > + > + > +Max SIMD bitwidth > +~~~~~~~~~~~~~~~~~ > + > +The EAL provides a single setting to limit the max SIMD bitwidth used by= DPDK, > +which is used in determining the vector path, if any, chosen by a compon= ent. > +The value can be set at runtime by an application using the 'rte_set_max= _simd_bitwidth(uint16_t bitwidth)' function, > +which should only be called once at initialization, before EAL init. > +The value can be overridden by the user using the EAL command-line optio= n '--force-max-sim-bitwidth'. > + > +When choosing a vector path, along with checking the CPU feature support= , > +the value of the max SIMD bitwidth must also be checked, and can be retr= ieved using the 'rte_get_max_simd_bitwidth()' function. > +The value should be compared against the enum values for accepted max SI= MD bitwidths: > + > +.. code-block:: c > + > + enum rte_max_simd_t { > + RTE_NO_SIMD =3D 64, > + RTE_MAX_128_SIMD =3D 128, > + RTE_MAX_256_SIMD =3D 256, > + RTE_MAX_512_SIMD =3D 512 > + }; > + > + if (rte_get_max_simd_bitwidth() >=3D RTE_MAX_512_SIMD) > + /* Take AVX-512 vector path */ > + else if (rte_get_max_simd_bitwidth() >=3D RTE_MAX_256_SIMD) > + /* Take AVX2 vector path */ > + > + > Memory Segments and Memory Zones (memzone) > ------------------------------------------ >=20 > -- > 2.17.1