From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C234423A4; Tue, 10 Jan 2023 14:56:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D5BD340A8B; Tue, 10 Jan 2023 14:56:08 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) by mails.dpdk.org (Postfix) with ESMTP id 52B6B40687 for ; Tue, 10 Jan 2023 14:56:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T8gagu9Ge38IOzO24P2EFhwYK/e4phPAk76KnTpFOCOdG609BzozAP2HTzfHd96/2v8pAlSNLl/wJoBYZtkqMifKdx3tPY3n9g4TObFLBNIoMvUSLULkfB3e8jy5sHsezrMJ1sKqb/gv/IaI146YE0zsacO/93NOuRJpORLgbsONkmz6VMfxx27q4CSM98KCGPeqY9+yOBRksdDVQmBHSJOwwmni22tj4p7wikvfaF35QrR89vA+qHbJVt6TzInNGK6USyX1VoICM32im63mrqnLo/hq1iyhfh1tb2Pj/LcUzzPWfAO9QaJhwOWYPfIW0v+vEx7ZJncH8M9fkMBpJQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JXpmbKHwJ/8DcD255i5BTkbQEakVxz1voesTV0yJZHA=; b=CvRx646Nv0E4XBMUMhrNy6b/8XIG/kptpHtyU8O6XGBYKPsqaYw/fq6+TBXJhQNhLFEXfoB7TTnjXUK1hHgzTWZpjDv+Lpzu+Uy68eR/Bxg+jZYOd+zIjeSKWrkRhI0bJQfOpQ+sqeZ0UveX9J8M5KuU16Hu4Yk9X2PLXRJPTjWb5UpygOwzgqGds0wpycfM9TYUf39Hsq9hva9UyuKbRXh93cHJuKXudYNj+xscCNUY4FLhCcqgSrc8h+cXOdjuIrbByZZAX3iZNYXjEce5MhBAm4SZ8OoXetEt6oTs45qP/pgZ4TWS6VWnJXLtcPxPqEbvbVxO30s62N1mdeOKmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JXpmbKHwJ/8DcD255i5BTkbQEakVxz1voesTV0yJZHA=; b=MPIjOwmk+v3IzLY4xtRZKJ5jdnDqVxejC/GTdBkShpx0lJ5isQYouegzkxon4h3J8xZvLg3Rl2vd+ggQzPasblISHdF+4rGyxtNhykSokXTR/6vZ1GVrQ713LPiRxT+n6/30ebDMZSvRgcQ9523knRSq/jw5v1cWb+xkTq6rpEw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by SA3PR12MB7877.namprd12.prod.outlook.com (2603:10b6:806:31b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Tue, 10 Jan 2023 13:56:05 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%9]) with mapi id 15.20.5986.018; Tue, 10 Jan 2023 13:56:05 +0000 Message-ID: <7d1d6509-83e0-ce20-ac26-b72f4c0ba02d@amd.com> Date: Tue, 10 Jan 2023 13:55:59 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US To: Tyler Retzlaff , dev@dpdk.org Cc: thomas@monjalon.net, mb@smartsharesystems.com, bruce.richardson@intel.com, Tyler Retzlaff References: <1669246997-30592-1-git-send-email-roretzla@linux.microsoft.com> <1673285784-14394-1-git-send-email-roretzla@linux.microsoft.com> <1673285784-14394-3-git-send-email-roretzla@linux.microsoft.com> From: Ferruh Yigit Subject: Re: [PATCH v4 2/2] eal: provide leading and trailing zero bit count abstraction In-Reply-To: <1673285784-14394-3-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P123CA0053.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::17) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SA3PR12MB7877:EE_ X-MS-Office365-Filtering-Correlation-Id: c98efcab-33b8-4691-e1d2-08daf3126a8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xJV5RBDBfgvR8zKtufFzsUtNkbZUTjpo/yVH/Veapc0EVFTK4nxhpc2/urEPPBrLfi79ALQWmlhbCaxfCJYJLMWKL9gXDck7x1R/1I+LIk6zknafqxiC+DAcWlkmvCZsaa8yyhBNTMksOzLdiDYpj3xlIStjLQzcp+xQebQyLOQleO3gNOFoAxVof/KY/xx7n4zM/FiQnxeh9IcMruFeN57YFXptTtdDseKt06BTDmuEWoZFCe3dTiV4qu3sIau7X3Rh4Tk95D+zy/kt/QLMezJEPh7LzWhrth2blOh26zUwf1KgVfhlPvDfUFnHZOwepmIx7HJ/0BsfNh3rPWt8RZkmxuz3uVTAHPkbEX469dwnisMqSax9YAdXQM8JLoZX2r3PW9K9H71n6yiZVD1nfQnE4x+VAvxoYHvKdp6HZDEGEvFbZA/F+PTP10OokR/8Nub9xxDVZBYwGZ5BSAX+Y7DTg57aLJQ8LSiwnTcIDQrOgm0zS5eJHGrBv1uPfKYaYI4iV1P/Q9MSCshWAdemcu7EG5r8zHeqP+nO178Ws0xI261g4HAHT4F6t00HYsr0G03wr1tj9dGu3XflKWwvCpVDeOYibRONjy3eOw7tpdzVT+TccC5Zyil2QXCtUYkQmosu9VKC3CxykFydwLTv+9urmCLp6iss9iB4GKZY3QRJ/KoVgH3KBcYKjFvRsp7hg30nbej5nI+uXOJ55boiIPPCrRM1+2HgR/vPUCiXuNh6kV+R5c5ktkHLxV2D+qYtsQQSrSXde4p4YuvIrP7yde7Zn/jFuOpn/sQOXrzSZo5VWn8Vafm+zQ2Z7AMrTgk1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(366004)(39860400002)(396003)(376002)(346002)(451199015)(53546011)(31686004)(2906002)(6506007)(6486002)(966005)(6512007)(26005)(6666004)(186003)(478600001)(8676002)(2616005)(66556008)(36756003)(66946007)(66476007)(45080400002)(316002)(4326008)(41300700001)(5660300002)(83380400001)(38100700002)(44832011)(31696002)(86362001)(8936002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dzhiTzVSc1d5N3ZuQkJwV2pidEZTeGsrKzdxT3dpRmpSSFF0QXhDUjlxVWhN?= =?utf-8?B?Yy9GM2hOcFdyNWt4UHEzMkw3TWNmbG82cVJobTQzVUl4czhySkJZN1JTek52?= =?utf-8?B?cEFyTXkraVkza0FNb1ZDWkRvbi8rbFgzQU9KQSs4ZGMyK0I5VWdz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VdTajl5ZjlxclVFYnVBMkY2M0dNS3M3aDVHYlk2dGFJNXgrSDVB?= =?utf-8?B?QW8xUFMxaXpPOUJHZHU0TXRoNlZRVzVZemJJdGZKQThIQUZiUWUyeSt0Mjlv?= =?utf-8?B?OE1TazBNTkNjQlNOK2pkNUw2ZnpTNTBLTUY5TVZ2TWhkMXlvUUJxdUVhVTZ1?= =?utf-8?Q?ov1NUd0aePItf+G9QktQynKzn?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c98efcab-33b8-4691-e1d2-08daf3126a8d X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 13:56:05.1469 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UjP+wxKH2IPdt2Kemn/BsXjJc6ae4ToYn6ZuV/+iQSGf+ojhg6C+3l/WtfXM65EH X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7877 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 On 1/9/2023 5:36 PM, Tyler Retzlaff wrote: > From: Tyler Retzlaff > > Provide an abstraction for leading and trailing zero bit counting > functions to hide compiler specific intrinsics and builtins. > > Include basic unit test of following functions added. > > rte_clz32 > rte_clz64 > rte_ctz32 > rte_ctz64 > > Signed-off-by: Tyler Retzlaff > --- > app/test/meson.build | 2 + > app/test/test_bitcount.c | 71 ++++++++++++++++++ > lib/eal/include/rte_bitops.h | 168 +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 241 insertions(+) > create mode 100644 app/test/test_bitcount.c > > diff --git a/app/test/meson.build b/app/test/meson.build > index f34d19e..d1277bc 100644 > --- a/app/test/meson.build > +++ b/app/test/meson.build > @@ -13,6 +13,7 @@ test_sources = files( > 'test_alarm.c', > 'test_atomic.c', > 'test_barrier.c', > + 'test_bitcount.c', > 'test_bitops.c', > 'test_bitmap.c', > 'test_bpf.c', > @@ -160,6 +161,7 @@ test_deps += ['bus_pci', 'bus_vdev'] > fast_tests = [ > ['acl_autotest', true, true], > ['atomic_autotest', false, true], > + ['bitcount_autotest', true, true], > ['bitmap_autotest', true, true], > ['bpf_autotest', true, true], > ['bpf_convert_autotest', true, true], > diff --git a/app/test/test_bitcount.c b/app/test/test_bitcount.c > new file mode 100644 > index 0000000..36eb05c > --- /dev/null > +++ b/app/test/test_bitcount.c > @@ -0,0 +1,71 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright (C) 2022 Microsoft Corporation > + */ > + > +#include > + > +#include > +#include > + > +#include "test.h" > + > +RTE_LOG_REGISTER(bitcount_logtype_test, test.bitcount, INFO); > + > +static int > +test_clz32(void) > +{ > + uint32_t v = 1; > + RTE_TEST_ASSERT(rte_clz32(v) == sizeof(v) * CHAR_BIT - 1, > + "Unexpected count."); > + > + return 0; > +} > + > +static int > +test_clz64(void) > +{ > + uint64_t v = 1; > + RTE_TEST_ASSERT(rte_clz64(v) == sizeof(v) * CHAR_BIT - 1, > + "Unexpected count."); > + > + return 0; > +} > + > +static int > +test_ctz32(void) > +{ > + uint32_t v = 2; > + RTE_TEST_ASSERT(rte_ctz32(v) == 1, "Unexpected count."); > + > + return 0; > +} > + > +static int > +test_ctz64(void) > +{ > + uint64_t v = 2; > + RTE_TEST_ASSERT(rte_ctz64(v) == 1, "Unexpected count."); > + > + return 0; > +} > + > +static struct unit_test_suite bitcount_test_suite = { > + .suite_name = "bitcount autotest", > + .setup = NULL, > + .teardown = NULL, > + .unit_test_cases = { > + TEST_CASE(test_clz32), > + TEST_CASE(test_clz64), > + TEST_CASE(test_ctz32), > + TEST_CASE(test_ctz64), > + TEST_CASES_END() > + } > +}; > + > +static int > +test_bitcount(void) > +{ > + return unit_test_suite_runner(&bitcount_test_suite); > +} > + > +REGISTER_TEST_COMMAND(bitcount_autotest, test_bitcount); > diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h > index 531479e..387d7aa 100644 > --- a/lib/eal/include/rte_bitops.h > +++ b/lib/eal/include/rte_bitops.h > @@ -1,5 +1,7 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright(c) 2020 Arm Limited > + * Copyright(c) 2010-2019 Intel Corporation > + * Copyright(c) 2023 Microsoft Corporation > */ > > #ifndef _RTE_BITOPS_H_ > @@ -275,6 +277,172 @@ > return val & mask; > } > > +#ifdef RTE_TOOLCHAIN_MSVC > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of leading 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of leading zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_clz32(uint32_t v) > +{ > + unsigned long rv; > + > + (void)_BitScanReverse(&rv, v); > + > + return (unsigned int)rv; > +} OK, this looks wrong to me, '_BitScanReverse' is [1]: "Search the mask data from most significant bit (MSB) to least significant bit (LSB) for a set bit (1)." As far as I can see index starts from zero and from lsb to msb. So _BitScanReverse() returns following index values: 0x2 => 1 0xffffffff => 31 If above is correct, above function doesn't return number of leading zeros, but it should return "31 - (unsigned int)rv". Please check godbolt experiment for above: https://godbolt.org/z/znYn54f57 As far as I can see unit test is correct, so above should fail with windows compiler, and I assume you run unit test with windows compiler, so probably I am missing something but please help me understand. [1] https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=msvc-170 > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of leading 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of leading zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_clz64(uint64_t v) > +{ > + unsigned long rv; > + > + (void)_BitScanReverse64(&rv, v); > + > + return (unsigned int)rv; > +} > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of trailing 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of trailing zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_ctz32(uint32_t v) > +{ > + unsigned long rv; > + > + (void)_BitScanForward(&rv, v); > + > + return (unsigned int)rv; > +} > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of trailing 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of trailing zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_ctz64(uint64_t v) > +{ > + unsigned long rv; > + > + (void)_BitScanForward64(&rv, v); > + > + return (unsigned int)rv; > +} > + > +#else > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of leading 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of leading zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_clz32(uint32_t v) > +{ > + return (unsigned int)__builtin_clz(v); > +} > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of leading 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of leading zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_clz64(uint64_t v) > +{ > + return (unsigned int)__builtin_clzll(v); > +} > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of trailing 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of trailing zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_ctz32(uint32_t v) > +{ > + return (unsigned int)__builtin_ctz(v); > +} > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Get the count of trailing 0-bits in v. > + * > + * @param v > + * The value. > + * @return > + * The count of trailing zero bits. > + */ > +__rte_experimental > +static inline unsigned int > +rte_ctz64(uint64_t v) > +{ > + return (unsigned int)__builtin_ctzll(v); > +} 'rte_ctz32()' & 'rte_ctz64()' are practically exact same with 'rte_bsf32()' & 'rte_bsf64()', Although I can see description is different, do we need same functionality with new function name, why not add 'rte_bsf32()' & 'rte_bsf64()' versions for the Windows? btw, do you guys know what 'bsf' & 'fls' (rte_fls_u32) stands for? > + > +#endif > + > /** > * Combines 32b inputs most significant set bits into the least > * significant bits to construct a value with the same MSBs as x