From patchwork Tue Oct 26 15:56:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Kumar X-Patchwork-Id: 102942 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 868DCA0547; Tue, 26 Oct 2021 17:57:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74C60410D5; Tue, 26 Oct 2021 17:57:18 +0200 (CEST) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by mails.dpdk.org (Postfix) with ESMTP id CA630407FF for ; Tue, 26 Oct 2021 17:57:16 +0200 (CEST) Received: by mail-pg1-f180.google.com with SMTP id r28so10247539pga.0 for ; Tue, 26 Oct 2021 08:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vvdntech-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ShNv+jJvS1kJxCxWh9r1XwjX8GwEARHC5VRHRTfkqpg=; b=vzZa9dOVreN4ZZSbYDfFUEvc08BSbpM/TAIyC5bn8pbigvn+y0waL8VrYnlfK4+dLQ 1chRi2m7z65X1LGhyWWC2GYi3k3KxWOoBG+qNOq9SmPAqYdrc0TD7VdW3eMsyAqd3xTO ah0BrG34jsBLBd3ACCjGFtWrLpDk9MlFyoyCRxUUhIDrSVcKGERAH+2xYVhPHaauPO6D lYANNeRIRrp1gj488s51Tt/o5BLAqUejlUODCvYB/Xn0FoLEGipk9gsYTcqYsgtNPAAL TiXWP9vchBK4xRcFwJgv98mpbHXPJ00VfkmqsBNdBNIB2Lm2xFPz5StxUnL1wC0yJxK2 oRKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ShNv+jJvS1kJxCxWh9r1XwjX8GwEARHC5VRHRTfkqpg=; b=QSbdlWGd8g9Q7ypTc89pdIQcSEoIirDkhJ4a++/Y57xnl02o8UsPhZ8GWwcuk5ea2I 6m5PJTMVf0kwu1cdmB9BA6cCYlBKQKWxGGVH3I6+aWaET7mkDGVBcQaRGMZgTfBMt3D2 AF7PK6ZKnkm6Dy9LQPA5pNXyog6TqfzR+zzvkr15DAqsuu0G7dh3pz0STmBj6klZzRYF DxtZefMVYdurFWDwHFg+p7NDTm4v8FzYdDpVylOJPfgPkn/apuUAKH/uCEju1wZwwQia xQ2pixCcLhQhWaKtw6FWE8q6kGg/wIlyNDKVJSY9BXzY05roWduluzF540R+hko0hAwg AjAg== X-Gm-Message-State: AOAM531aZ9aF0vmWAYFJAaF8jT1+YRGig78otsyeo1qo+OhvcSwpuI2a mbI1grsx05MrzZ0Sdn+dDUMEudBsmpz8ldf9 X-Google-Smtp-Source: ABdhPJy/hWsuFrsP03OuOOseY+He5ITNWGTrLmTbDHbCbSpldibLoJv5K7Oo647ozI0g9GBrc7RDnQ== X-Received: by 2002:a65:448a:: with SMTP id l10mr19502148pgq.313.1635263835765; Tue, 26 Oct 2021 08:57:15 -0700 (PDT) Received: from 470--5GDC--BLR.blore.vvdntech.com ([106.51.39.131]) by smtp.gmail.com with ESMTPSA id b8sm24649824pfv.56.2021.10.26.08.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 08:57:15 -0700 (PDT) From: Aman Kumar To: dev@dpdk.org Cc: thomas@monjalon.net, viacheslavo@nvidia.com, anatoly.burakov@intel.com, keesang.song@amd.com, aman.kumar@vvdntech.in, jerinjacobk@gmail.com, konstantin.ananyev@intel.com, bruce.richardson@intel.com Date: Tue, 26 Oct 2021 21:26:43 +0530 Message-Id: <20211026155645.246783-1-aman.kumar@vvdntech.in> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019104724.19416-1-aman.kumar@vvdntech.in> References: <20211019104724.19416-1-aman.kumar@vvdntech.in> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 1/3] config/x86: add support for AMD platform X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" -Dcpu_instruction_set=znverX meson option can be used to build dpdk for AMD platform. Supported options are znver1, znver2 and znver3. Signed-off-by: Aman Kumar --- config/x86/meson.build | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/x86/meson.build b/config/x86/meson.build index 29f3dea181..abb1bafb6e 100644 --- a/config/x86/meson.build +++ b/config/x86/meson.build @@ -72,3 +72,12 @@ endif dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64) dpdk_conf.set('RTE_MAX_LCORE', 128) dpdk_conf.set('RTE_MAX_NUMA_NODES', 32) + +# AMD platform support +if get_option('cpu_instruction_set') == 'znver3' + dpdk_conf.set('RTE_MAX_LCORE', 512) +elif get_option('cpu_instruction_set') == 'znver2' + dpdk_conf.set('RTE_MAX_LCORE', 512) +elif get_option('cpu_instruction_set') == 'znver1' + dpdk_conf.set('RTE_MAX_LCORE', 256) +endif From patchwork Tue Oct 26 15:56:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Kumar X-Patchwork-Id: 102943 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 25DF9A0547; Tue, 26 Oct 2021 17:57:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B63D4114F; Tue, 26 Oct 2021 17:57:22 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 2469741134 for ; Tue, 26 Oct 2021 17:57:21 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id u6-20020a17090a3fc600b001a00250584aso2659886pjm.4 for ; Tue, 26 Oct 2021 08:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vvdntech-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bgeuoJKYE6GkkRtXEfkWXyO7lLTLWDDHFw43FyCdnlE=; b=kByRlWgTzgFB1MBkzjounenYFrM4daDtCC6xEhKbGrFMK6tv6NnFoBOpwf3xIlpkbu M8yfP0n+EnpMmimqBADUrpbk4o6WktD6U+JCDApm9bybAR4XoKKBb/92zyk9oJhz4n0H +dXa91IJeZO9zBac9Qv/QTFgsIz7+H+bSL2WZc4ZUt3DF+4ZE1leJZIkFVu6KTqTH3gG ofKqsWkHRw2OHtSWx1v/62GSz4y0O6qTmWobGMRhECllPYXSJbV8QHnTW9MF6YwFTMPr smd8HsGcdGLr7peNOQh7VE2T9Umo4PLVl/PWfKGDhYvzqD/FyU6hOULqAElwK9fM642c kTZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bgeuoJKYE6GkkRtXEfkWXyO7lLTLWDDHFw43FyCdnlE=; b=sgVWRxHsmisJlaJgnkE3osVQgpvtEmNFztR7wjyidS5bmjBIzzFqOmQWmeeJhveGSX R7Cw8/grQaukzXQ4EiR84FwwQhH3ANhMyBFEYSqAidOGZwxbCzR9TKOm5TPWzLGxTBJ6 xFPvUBdKVaawlIq75XF+QRyN0cBT3PNHCAtVzQhoZy36UgMrsXjly+B2FTKbYr9CzaEJ gf9NJLfDdIWq+oQ6CJpkD2bVCMvVSJFPcMIMtl7YFGCgV7z8Vjwf2dwE2J9HxYiyny/i m5Bu441T6tOr+tIyneinFEWOZEUULVuJNHEbZVwWqzAzc9FAhbA1CnR3Z/wKIJswe9m2 KzCw== X-Gm-Message-State: AOAM531tot0RAMegl1rNxwZGXomPv4UZuiTPuzbS/f+3qWRRzZ5YcHq/ lq4W9QRoZZkYshU8zvfC0goNWTa8ZwUaBlvl X-Google-Smtp-Source: ABdhPJzyUewkx3zaYjTn8ws5TGtMXTZg/lfB+Gkg8PTSP8UdWZ7X/N5A2ouOimc/U1HXG2xFquv53Q== X-Received: by 2002:a17:902:b593:b0:12d:7aa5:de2d with SMTP id a19-20020a170902b59300b0012d7aa5de2dmr23609491pls.31.1635263840000; Tue, 26 Oct 2021 08:57:20 -0700 (PDT) Received: from 470--5GDC--BLR.blore.vvdntech.com ([106.51.39.131]) by smtp.gmail.com with ESMTPSA id b8sm24649824pfv.56.2021.10.26.08.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 08:57:19 -0700 (PDT) From: Aman Kumar To: dev@dpdk.org Cc: thomas@monjalon.net, viacheslavo@nvidia.com, anatoly.burakov@intel.com, keesang.song@amd.com, aman.kumar@vvdntech.in, jerinjacobk@gmail.com, konstantin.ananyev@intel.com, bruce.richardson@intel.com Date: Tue, 26 Oct 2021 21:26:44 +0530 Message-Id: <20211026155645.246783-2-aman.kumar@vvdntech.in> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211026155645.246783-1-aman.kumar@vvdntech.in> References: <20211019104724.19416-1-aman.kumar@vvdntech.in> <20211026155645.246783-1-aman.kumar@vvdntech.in> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 2/3] doc/guides: add dpdk build instruction for AMD platforms X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" linux guide updated with AMD platform related build instructions. Signed-off-by: Aman Kumar --- doc/guides/linux_gsg/build_dpdk.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/guides/linux_gsg/build_dpdk.rst b/doc/guides/linux_gsg/build_dpdk.rst index 0b08492ca2..3110448467 100644 --- a/doc/guides/linux_gsg/build_dpdk.rst +++ b/doc/guides/linux_gsg/build_dpdk.rst @@ -113,6 +113,10 @@ The instruction set will be set automatically by default according to these rule To override what instruction set will be used, set the ``cpu_instruction_set`` parameter to the instruction set of your choice (such as ``corei7``, ``power8``, etc.). +To build dpdk for AMD Zen CPU based platforms, pass ``-Dcpu_instruction_set=`` +to meson when configuring the build folder initially. Supported options are znver1, +znver2 and znver3. + ``cpu_instruction_set`` is not used in Arm builds, as setting the instruction set without other parameters leads to inferior builds. The way to tailor Arm builds is to build for a SoC using ``-Dplatform=`` mentioned above. From patchwork Tue Oct 26 15:56:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Kumar X-Patchwork-Id: 102944 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4585A0547; Tue, 26 Oct 2021 17:57:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63B064113F; Tue, 26 Oct 2021 17:57:26 +0200 (CEST) Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by mails.dpdk.org (Postfix) with ESMTP id 0AE12407FF for ; Tue, 26 Oct 2021 17:57:25 +0200 (CEST) Received: by mail-pg1-f175.google.com with SMTP id h193so14596302pgc.1 for ; Tue, 26 Oct 2021 08:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vvdntech-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g8u15E8iAmYmoRFTpoukv6aSR1ig4/UrWVJdVKhGVVU=; b=4EYxIYblyJbcrpvuxFxcyjsIUevAuH673eqR02IstOTy1OsyK2Q0D/5xTN0pmIGW0d nKZeQS3LoCe9S8oimgIdV2+x4BStkWG7s38Bn1xzz6t+6TKfklBX4O2vgSE8nioB2mp2 aoLfoJA9ttn6umWQ27SVb5rRZPxdiW4zaKy7rxs/+6ljOHL0I/Ih+cBv0E1/hoDhUms8 DtWhdVpXCO8DIZL9bY1k/FmpCA6Ymc2bKh68Izyq+9tV4+xrP6cPw3rjR9Af8QdnVvvP VVvun3Y8F6tTm8GJnIVVomyD/rzzMpg6FFSjdU+gRPCo92+L1D5Cva81d2ApERSLs351 TORQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g8u15E8iAmYmoRFTpoukv6aSR1ig4/UrWVJdVKhGVVU=; b=MwYZ+EGVsp0FI6JZCAWOEGS+gl7c82aYdkINK+FxoFjh4ZHH55e4x1jx1IZ3i71laJ rvLj876gPdIi7kH3h1b6nYVmuLG8ZMogTro6mp6G0wTUZAkMoZQDKtWBP7fakyP76veM Yr7sKnq/7i8p8qkGaa8l5OYo5QGzI36OaMEUb/gckDWFaoIal1nTQw3JDTw6GUx9YdDS tH/Hy6NAE5ogqP2ifCsidM4B7dSqRUqIkNUp/Kro2U1Tgpdsz0PPmGu10jPGuPeYWW45 OrqEvKbS3L+Uj7JfGmwfnetjpOf1N9k4Oph5INcuqRZfIWnrsJDiG0HtwTPMdWQQvvqL vJYg== X-Gm-Message-State: AOAM532+utcfiMmyAVGTxKSkCAoAavGSdN9DI/WUW9N3hGSMUlxgl3vs MjeGolztcPhyaWmOaBCoroPaFp2/2L7eEB/I X-Google-Smtp-Source: ABdhPJx0Drqofxaya7SFwLTq205f4cxOOfqc01dqMFTkyzTjzeCkIvMq+xUYqVlBtlVlFbkCiubtNw== X-Received: by 2002:a65:45cd:: with SMTP id m13mr19738836pgr.26.1635263844017; Tue, 26 Oct 2021 08:57:24 -0700 (PDT) Received: from 470--5GDC--BLR.blore.vvdntech.com ([106.51.39.131]) by smtp.gmail.com with ESMTPSA id b8sm24649824pfv.56.2021.10.26.08.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 08:57:23 -0700 (PDT) From: Aman Kumar To: dev@dpdk.org Cc: thomas@monjalon.net, viacheslavo@nvidia.com, anatoly.burakov@intel.com, keesang.song@amd.com, aman.kumar@vvdntech.in, jerinjacobk@gmail.com, konstantin.ananyev@intel.com, bruce.richardson@intel.com Date: Tue, 26 Oct 2021 21:26:45 +0530 Message-Id: <20211026155645.246783-3-aman.kumar@vvdntech.in> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211026155645.246783-1-aman.kumar@vvdntech.in> References: <20211019104724.19416-1-aman.kumar@vvdntech.in> <20211026155645.246783-1-aman.kumar@vvdntech.in> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 3/3] lib/eal: add temporal store memcpy support on AMD platform X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 provides a rte_memcpy* call with temporal stores. Use -Dcpu_instruction_set=znverX with build to enable this API. Signed-off-by: Aman Kumar --- config/x86/meson.build | 2 + lib/eal/x86/include/rte_memcpy.h | 114 +++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) diff --git a/config/x86/meson.build b/config/x86/meson.build index abb1bafb6e..7ef7f32cd4 100644 --- a/config/x86/meson.build +++ b/config/x86/meson.build @@ -76,8 +76,10 @@ dpdk_conf.set('RTE_MAX_NUMA_NODES', 32) # AMD platform support if get_option('cpu_instruction_set') == 'znver3' dpdk_conf.set('RTE_MAX_LCORE', 512) + dpdk_conf.set('RTE_MEMCPY_AMDEPYC', 1) elif get_option('cpu_instruction_set') == 'znver2' dpdk_conf.set('RTE_MAX_LCORE', 512) + dpdk_conf.set('RTE_MEMCPY_AMDEPYC', 1) elif get_option('cpu_instruction_set') == 'znver1' dpdk_conf.set('RTE_MAX_LCORE', 256) endif diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h index 1b6c6e585f..8fe7822cb4 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -376,6 +376,120 @@ rte_mov128blocks(uint8_t *dst, const uint8_t *src, size_t n) } } +#if defined RTE_MEMCPY_AMDEPYC + +/** + * Copy 16 bytes from one location to another, + * with temporal stores + */ +static __rte_always_inline void +rte_copy16_ts(uint8_t *dst, uint8_t *src) +{ + __m128i var128; + + var128 = _mm_stream_load_si128((__m128i *)src); + _mm_storeu_si128((__m128i *)dst, var128); +} + +/** + * Copy 32 bytes from one location to another, + * with temporal stores + */ +static __rte_always_inline void +rte_copy32_ts(uint8_t *dst, uint8_t *src) +{ + __m256i ymm0; + + ymm0 = _mm256_stream_load_si256((const __m256i *)src); + _mm256_storeu_si256((__m256i *)dst, ymm0); +} + +/** + * Copy 64 bytes from one location to another, + * with temporal stores + */ +static __rte_always_inline void +rte_copy64_ts(uint8_t *dst, uint8_t *src) +{ + rte_copy32_ts(dst + 0 * 32, src + 0 * 32); + rte_copy32_ts(dst + 1 * 32, src + 1 * 32); +} + +/** + * Copy 128 bytes from one location to another, + * with temporal stores + */ +static __rte_always_inline void +rte_copy128_ts(uint8_t *dst, uint8_t *src) +{ + rte_copy32_ts(dst + 0 * 32, src + 0 * 32); + rte_copy32_ts(dst + 1 * 32, src + 1 * 32); + rte_copy32_ts(dst + 2 * 32, src + 2 * 32); + rte_copy32_ts(dst + 3 * 32, src + 3 * 32); +} + +/** + * Copy len bytes from one location to another, + * with temporal stores 16B aligned + */ +static __rte_always_inline void * +rte_memcpy_aligned_tstore16_generic(void *dst, void *src, int len) +{ + void *dest = dst; + + while (len >= 128) { + rte_copy128_ts((uint8_t *)dst, (uint8_t *)src); + dst = (uint8_t *)dst + 128; + src = (uint8_t *)src + 128; + len -= 128; + } + while (len >= 64) { + rte_copy64_ts((uint8_t *)dst, (uint8_t *)src); + dst = (uint8_t *)dst + 64; + src = (uint8_t *)src + 64; + len -= 64; + } + while (len >= 32) { + rte_copy32_ts((uint8_t *)dst, (uint8_t *)src); + dst = (uint8_t *)dst + 32; + src = (uint8_t *)src + 32; + len -= 32; + } + if (len >= 16) { + rte_copy16_ts((uint8_t *)dst, (uint8_t *)src); + dst = (uint8_t *)dst + 16; + src = (uint8_t *)src + 16; + len -= 16; + } + if (len >= 8) { + *(uint64_t *)dst = *(const uint64_t *)src; + dst = (uint8_t *)dst + 8; + src = (uint8_t *)src + 8; + len -= 8; + } + if (len >= 4) { + *(uint32_t *)dst = *(const uint32_t *)src; + dst = (uint8_t *)dst + 4; + src = (uint8_t *)src + 4; + len -= 4; + } + if (len != 0) { + dst = (uint8_t *)dst - (4 - len); + src = (uint8_t *)src - (4 - len); + *(uint32_t *)dst = *(const uint32_t *)src; + } + + return dest; +} + +static __rte_always_inline void * +rte_memcpy_aligned_tstore16(void *dst, void *src, int len) +{ + return rte_memcpy_aligned_tstore16_generic(dst, src, len); +} + +#endif /* RTE_MEMCPY_AMDEPYC */ + static __rte_always_inline void * rte_memcpy_generic(void *dst, const void *src, size_t n) {