From: Ferruh Yigit <ferruh.yigit@amd.com>
To: "Varghese, Vipin" <Vipin.Varghese@amd.com>,
Konstantin Ananyev <konstantin.ananyev@huawei.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
"konstantin.v.ananyev@yandex.ru" <konstantin.v.ananyev@yandex.ru>,
"aman.deep.singh@intel.com" <aman.deep.singh@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v2 1/3] app/testpmd: add register keyword
Date: Fri, 4 Oct 2024 06:04:22 +0100 [thread overview]
Message-ID: <e3ad6477-9899-4b6a-a817-98e06dc2b363@amd.com> (raw)
In-Reply-To: <PH7PR12MB859639DA1EDC9494B9703817829E2@PH7PR12MB8596.namprd12.prod.outlook.com>
On 9/6/2024 2:02 PM, Varghese, Vipin wrote:
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> <snipped>
>
>> > > >> --- a/app/test-pmd/macswap_sse.h
>> > > >> +++ b/app/test-pmd/macswap_sse.h
>> > > >> @@ -16,13 +16,13 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t
>> nb,
>> > > >> uint64_t ol_flags;
>> > > >> int i;
>> > > >> int r;
>> > > >> - __m128i addr0, addr1, addr2, addr3;
>> > > >> + register __m128i addr0, addr1, addr2, addr3;
>> > > > Some compilers treat register as a no-op. Are you sure? Did you check
>> with godbolt.
>> > >
>> > > Thank you Stephen, I have tested the code changes on Linux using GCC
>> > > and Clang compiler.
>> > >
>> > > In both cases in Linux environment, we have seen the the values
>> > > loaded onto register `xmm`.
>> > >
>> > > ```
>> > > registerconst__m128i shfl_msk = _mm_set_epi8(15, 14, 13, 12, 5, 4,
>> > > 3, 2, 1, 0, 11, 10, 9, 8, 7, 6); vmovdqaxmm0, xmmwordptr[rip+
>> > > .LCPI0_0]
>>
>> Yep, that what I would probably expect: one time load before the loop starts,
>> right?
>> Curious what exactly it would generate then if 'register' keyword is missed?
>> BTW, on my box, gcc-11 with '-O3 -msse4.2 ...' I am seeing expected
>> behavior without 'register' keyword.
>> Is it some particular compiler version that misbehaves?
>
> Thank you, Konstantin, for this pointer. I have been trying this
> understand this a bit more internally. Here are my observations
>
> 1. shuf simd ISA works on XMM register only.
> 2. Any values from variables has to be loaded to `xmm` register before
> processing.
> 3. when compiled for `-march=native` with compiler not aware (SoC Arch
> gcc weights) without patch might have generating with `movzx eax, BYTE
> PTR [rbp-48]`
> 4. when register keyword is applied for both shufl_mask and addr, the
> compiler generates trying to get the variables directly into xmm using `
> vmovdqu (%rsi),%xmm1`
>
> So, I think you are right, from gcc12.3 and gcc 13.1 which supports `-
> march=znver4` this problem will not come.
>
Hi Konstantin, Stephen,
There is no negative impact of adding 'register' keyword, right? At
worst it is useless, but Vipin can demonstrate that it has benefit for
some cases, so I think OK to get it.
next prev parent reply other threads:[~2024-10-04 5:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 6:37 [PATCH] app/testpmd: improve sse based macswap Vipin Varghese
2024-07-23 16:45 ` Ferruh Yigit
2024-07-23 17:12 ` Bruce Richardson
2024-07-25 12:47 ` Varghese, Vipin
2024-07-25 12:52 ` Bruce Richardson
2024-08-21 14:38 ` [PATCH v2 0/3] " Vipin Varghese
2024-08-21 14:38 ` [PATCH v2 1/3] app/testpmd: add register keyword Vipin Varghese
2024-08-21 14:55 ` Stephen Hemminger
2024-08-27 15:32 ` Varghese, Vipin
2024-08-27 17:39 ` Stephen Hemminger
2024-08-29 8:14 ` Varghese, Vipin
2024-09-03 11:52 ` Konstantin Ananyev
2024-09-06 13:02 ` Varghese, Vipin
2024-10-04 5:04 ` Ferruh Yigit [this message]
2024-08-21 14:38 ` [PATCH v2 2/3] app/testpmd: move offload update Vipin Varghese
2024-08-21 14:38 ` [PATCH v2 3/3] app/testpmd: interleave SSE SIMD Vipin Varghese
2024-10-04 5:08 ` [PATCH v2 0/3] app/testpmd: improve sse based macswap Ferruh Yigit
2024-10-08 1:12 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e3ad6477-9899-4b6a-a817-98e06dc2b363@amd.com \
--to=ferruh.yigit@amd.com \
--cc=Vipin.Varghese@amd.com \
--cc=aman.deep.singh@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).