Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/50261/?format=api
http://patches.dpdk.org/api/patches/50261/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190211073001.37438-1-ruifeng.wang@arm.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20190211073001.37438-1-ruifeng.wang@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190211073001.37438-1-ruifeng.wang@arm.com", "date": "2019-02-11T07:30:01", "name": "[v1] hash: optimize signature compare by using neon intrinsic", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "dcb33267f16f0e5da85e887cd6380285fd0310dc", "submitter": { "id": 1198, "url": "http://patches.dpdk.org/api/people/1198/?format=api", "name": "Ruifeng Wang", "email": "ruifeng.wang@arm.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190211073001.37438-1-ruifeng.wang@arm.com/mbox/", "series": [ { "id": 3420, "url": "http://patches.dpdk.org/api/series/3420/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=3420", "date": "2019-02-11T07:30:01", "name": "[v1] hash: optimize signature compare by using neon intrinsic", "version": 1, "mbox": "http://patches.dpdk.org/series/3420/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/50261/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/50261/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9AC3A1B5AA;\n\tMon, 11 Feb 2019 08:30:47 +0100 (CET)", "from foss.arm.com (foss.arm.com [217.140.101.70])\n\tby dpdk.org (Postfix) with ESMTP id E9A761B5A9\n\tfor <dev@dpdk.org>; Mon, 11 Feb 2019 08:30:46 +0100 (CET)", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43C50A78;\n\tSun, 10 Feb 2019 23:30:46 -0800 (PST)", "from net-arm-thunderx2-02.shanghai.arm.com\n\t(net-arm-thunderx2-02.shanghai.arm.com [10.169.41.104])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id\n\t1991C3F575; Sun, 10 Feb 2019 23:30:44 -0800 (PST)" ], "From": "Ruifeng Wang <ruifeng.wang@arm.com>", "To": "yipeng1.wang@intel.com", "Cc": "dev@dpdk.org, jerinj@marvell.com, Honnappa.Nagarahalli@arm.com,\n\tnd@arm.com, Ruifeng Wang <ruifeng.wang@arm.com>", "Date": "Mon, 11 Feb 2019 15:30:01 +0800", "Message-Id": "<20190211073001.37438-1-ruifeng.wang@arm.com>", "X-Mailer": "git-send-email 2.17.1", "Subject": "[dpdk-dev] [PATCH v1] hash: optimize signature compare by using\n\tneon intrinsic", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Implemented signature compare function based on neon intrinsic.\nHash bulk lookup had 3% - 6% performance gain after optimization.\n\nSigned-off-by: Ruifeng Wang <ruifeng.wang@arm.com>\n---\n lib/librte_hash/rte_cuckoo_hash.c | 32 ++++++++++++++++++++++++++++++-\n lib/librte_hash/rte_cuckoo_hash.h | 1 +\n 2 files changed, 32 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c\nindex c01489ba5..5745a254f 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.c\n+++ b/lib/librte_hash/rte_cuckoo_hash.c\n@@ -26,6 +26,9 @@\n #include <rte_spinlock.h>\n #include <rte_ring.h>\n #include <rte_compat.h>\n+#if defined(RTE_ARCH_ARM64)\n+#include <arm_neon.h>\n+#endif\n \n #include \"rte_hash.h\"\n #include \"rte_cuckoo_hash.h\"\n@@ -407,6 +410,10 @@ rte_hash_create(const struct rte_hash_parameters *params)\n \tif (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE2))\n \t\th->sig_cmp_fn = RTE_HASH_COMPARE_SSE;\n \telse\n+#elif defined(RTE_ARCH_ARM64)\n+\tif (rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON))\n+\t\th->sig_cmp_fn = RTE_HASH_COMPARE_NEON;\n+\telse\n #endif\n \t\th->sig_cmp_fn = RTE_HASH_COMPARE_SCALAR;\n \n@@ -1578,10 +1585,15 @@ compare_signatures(uint32_t *prim_hash_matches, uint32_t *sec_hash_matches,\n \t\t\tenum rte_hash_sig_compare_function sig_cmp_fn)\n {\n \tunsigned int i;\n+#ifdef RTE_MACHINE_CPUFLAG_NEON\n+\tuint16x8_t vmat, vsig, x;\n+\tuint64x2_t x64;\n+\tint16x8_t shift = {-15, -13, -11, -9, -7, -5, -3, -1};\n+#endif\n \n \t/* For match mask the first bit of every two bits indicates the match */\n \tswitch (sig_cmp_fn) {\n-#ifdef RTE_MACHINE_CPUFLAG_SSE2\n+#if defined(RTE_MACHINE_CPUFLAG_SSE2)\n \tcase RTE_HASH_COMPARE_SSE:\n \t\t/* Compare all signatures in the bucket */\n \t\t*prim_hash_matches = _mm_movemask_epi8(_mm_cmpeq_epi16(\n@@ -1594,6 +1606,24 @@ compare_signatures(uint32_t *prim_hash_matches, uint32_t *sec_hash_matches,\n \t\t\t\t\t(__m128i const *)sec_bkt->sig_current),\n \t\t\t\t_mm_set1_epi16(sig)));\n \t\tbreak;\n+#elif defined(RTE_MACHINE_CPUFLAG_NEON)\n+\tcase RTE_HASH_COMPARE_NEON:\n+\t\tvsig = vld1q_dup_u16((uint16_t const *)&sig);\n+\t\t/* Compare all signatures in the primary bucket */\n+\t\tvmat = vceqq_u16(vsig,\n+\t\t\tvld1q_u16((uint16_t const *)prim_bkt->sig_current));\n+\t\tx = vshlq_u16(vandq_u16(vmat, vdupq_n_u16(0x8000)), shift);\n+\t\tx64 = vpaddlq_u32(vpaddlq_u16(x));\n+\t\t*prim_hash_matches = (uint32_t)(vgetq_lane_u64(x64, 0) +\n+\t\t\tvgetq_lane_u64(x64, 1));\n+\t\t/* Compare all signatures in the secondary bucket */\n+\t\tvmat = vceqq_u16(vsig,\n+\t\t\tvld1q_u16((uint16_t const *)sec_bkt->sig_current));\n+\t\tx = vshlq_u16(vandq_u16(vmat, vdupq_n_u16(0x8000)), shift);\n+\t\tx64 = vpaddlq_u32(vpaddlq_u16(x));\n+\t\t*sec_hash_matches = (uint32_t)(vgetq_lane_u64(x64, 0) +\n+\t\t\tvgetq_lane_u64(x64, 1));\n+\t\tbreak;\n #endif\n \tdefault:\n \t\tfor (i = 0; i < RTE_HASH_BUCKET_ENTRIES; i++) {\ndiff --git a/lib/librte_hash/rte_cuckoo_hash.h b/lib/librte_hash/rte_cuckoo_hash.h\nindex eacdaa8d4..0548c97f0 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.h\n+++ b/lib/librte_hash/rte_cuckoo_hash.h\n@@ -141,6 +141,7 @@ struct rte_hash_key {\n enum rte_hash_sig_compare_function {\n \tRTE_HASH_COMPARE_SCALAR = 0,\n \tRTE_HASH_COMPARE_SSE,\n+\tRTE_HASH_COMPARE_NEON,\n \tRTE_HASH_COMPARE_NUM\n };\n \n", "prefixes": [ "v1" ] }{ "id": 50261, "url": "