[dpdk-dev] sched: enable neon optimizations

Message ID 20170427130007.33210-1-ashwin.sekhar@caviumnetworks.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ashwin Sekhar T K April 27, 2017, 1 p.m. UTC
  * Enabled CONFIG_RTE_SCHED_VECTOR for arm64
* Verified the changes with sched_autotest unit test case

Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
---
 config/defconfig_arm64-armv8a-linuxapp-gcc |  2 +-
 lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
  

Comments

Jianbo Liu April 28, 2017, 3:50 a.m. UTC | #1
On 27 April 2017 at 21:00, Ashwin Sekhar T K
<ashwin.sekhar@caviumnetworks.com> wrote:
> * Enabled CONFIG_RTE_SCHED_VECTOR for arm64
> * Verified the changes with sched_autotest unit test case
>
> Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
> ---
>  config/defconfig_arm64-armv8a-linuxapp-gcc |  2 +-
>  lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
> index 65888ce..021044a 100644
> --- a/config/defconfig_arm64-armv8a-linuxapp-gcc
> +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
> @@ -48,4 +48,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
>  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
>  CONFIG_RTE_LIBRTE_AVP_PMD=n
>
> -CONFIG_RTE_SCHED_VECTOR=n
> +CONFIG_RTE_SCHED_VECTOR=y

It's enough to remove this line only, I don't think you must enable it
explicitly in the armv8a common config.

> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 614705d..4ba476a 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -58,6 +58,8 @@
>
>  #if defined(__SSE4__)
>  #define SCHED_VECTOR_SSE4
> +#elif defined(RTE_MACHINE_CPUFLAG_NEON)
> +#define SCHED_VECTOR_NEON
>  #endif
>
>  #endif
> @@ -1732,6 +1734,26 @@ grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
>         return 1;
>  }
>
> +#elif defined(SCHED_VECTOR_NEON)
> +
> +static inline int
> +grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
> +{
> +       uint32x4_t index, pipes;
> +       uint32_t *pos = (uint32_t *)port->grinder_base_bmp_pos;
> +
> +       index = vmovq_n_u32(base_pipe);
> +       pipes = vld1q_u32(pos);
> +       if (!vminvq_u32(veorq_u32(pipes, index)))
> +               return 1;
> +
> +       pipes = vld1q_u32(pos + 4);
> +       if (!vminvq_u32(veorq_u32(pipes, index)))
> +               return 1;
> +
> +       return 0;
> +}
> +
>  #else
>
>  static inline int
> --
> 2.7.4
>
  
Sekhar, Ashwin April 28, 2017, 5:27 a.m. UTC | #2
On Friday 28 April 2017 09:20 AM, Jianbo Liu wrote:
> On 27 April 2017 at 21:00, Ashwin Sekhar T K
> <ashwin.sekhar@caviumnetworks.com> wrote:
>> * Enabled CONFIG_RTE_SCHED_VECTOR for arm64
>> * Verified the changes with sched_autotest unit test case
>>
>> Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
>> ---
>>  config/defconfig_arm64-armv8a-linuxapp-gcc |  2 +-
>>  lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
>>  2 files changed, 23 insertions(+), 1 deletion(-)
>>
>> diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
>> index 65888ce..021044a 100644
>> --- a/config/defconfig_arm64-armv8a-linuxapp-gcc
>> +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
>> @@ -48,4 +48,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
>>  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
>>  CONFIG_RTE_LIBRTE_AVP_PMD=n
>>
>> -CONFIG_RTE_SCHED_VECTOR=n
>> +CONFIG_RTE_SCHED_VECTOR=y
>
> It's enough to remove this line only, I don't think you must enable it
> explicitly in the armv8a common config.
>
Tried removing this line from armv8a config. But in that case 
RTE_SCHED_VECTOR doesn't get defined.
./config/common_base has "CONFIG_RTE_SCHED_VECTOR=n" as the default 
setting. So enabling explicitly is required.

- Ashwin

>> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
>> index 614705d..4ba476a 100644
>> --- a/lib/librte_sched/rte_sched.c
>> +++ b/lib/librte_sched/rte_sched.c
>> @@ -58,6 +58,8 @@
>>
>>  #if defined(__SSE4__)
>>  #define SCHED_VECTOR_SSE4
>> +#elif defined(RTE_MACHINE_CPUFLAG_NEON)
>> +#define SCHED_VECTOR_NEON
>>  #endif
>>
>>  #endif
>> @@ -1732,6 +1734,26 @@ grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
>>         return 1;
>>  }
>>
>> +#elif defined(SCHED_VECTOR_NEON)
>> +
>> +static inline int
>> +grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
>> +{
>> +       uint32x4_t index, pipes;
>> +       uint32_t *pos = (uint32_t *)port->grinder_base_bmp_pos;
>> +
>> +       index = vmovq_n_u32(base_pipe);
>> +       pipes = vld1q_u32(pos);
>> +       if (!vminvq_u32(veorq_u32(pipes, index)))
>> +               return 1;
>> +
>> +       pipes = vld1q_u32(pos + 4);
>> +       if (!vminvq_u32(veorq_u32(pipes, index)))
>> +               return 1;
>> +
>> +       return 0;
>> +}
>> +
>>  #else
>>
>>  static inline int
>> --
>> 2.7.4
>>
>
  
Jianbo Liu April 28, 2017, 5:37 a.m. UTC | #3
On 28 April 2017 at 13:27, Sekhar, Ashwin <Ashwin.Sekhar@cavium.com> wrote:
> On Friday 28 April 2017 09:20 AM, Jianbo Liu wrote:
>> On 27 April 2017 at 21:00, Ashwin Sekhar T K
>> <ashwin.sekhar@caviumnetworks.com> wrote:
>>> * Enabled CONFIG_RTE_SCHED_VECTOR for arm64
>>> * Verified the changes with sched_autotest unit test case
>>>
>>> Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
>>> ---
>>>  config/defconfig_arm64-armv8a-linuxapp-gcc |  2 +-
>>>  lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
>>>  2 files changed, 23 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
>>> index 65888ce..021044a 100644
>>> --- a/config/defconfig_arm64-armv8a-linuxapp-gcc
>>> +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
>>> @@ -48,4 +48,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
>>>  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
>>>  CONFIG_RTE_LIBRTE_AVP_PMD=n
>>>
>>> -CONFIG_RTE_SCHED_VECTOR=n
>>> +CONFIG_RTE_SCHED_VECTOR=y
>>
>> It's enough to remove this line only, I don't think you must enable it
>> explicitly in the armv8a common config.
>>
> Tried removing this line from armv8a config. But in that case
> RTE_SCHED_VECTOR doesn't get defined.
> ./config/common_base has "CONFIG_RTE_SCHED_VECTOR=n" as the default
> setting. So enabling explicitly is required.
>

I know it must be enabled to use your enhancement. But I meant to keep
the same as common_base (or other default configs) if there is no
other strange reason to enable it.

Thanks!
Jianbo
  
Sekhar, Ashwin April 28, 2017, 6:03 a.m. UTC | #4
On Friday 28 April 2017 11:07 AM, Jianbo Liu wrote:
> On 28 April 2017 at 13:27, Sekhar, Ashwin <Ashwin.Sekhar@cavium.com> wrote:
>> On Friday 28 April 2017 09:20 AM, Jianbo Liu wrote:
>>> On 27 April 2017 at 21:00, Ashwin Sekhar T K
>>> <ashwin.sekhar@caviumnetworks.com> wrote:
>>>> * Enabled CONFIG_RTE_SCHED_VECTOR for arm64
>>>> * Verified the changes with sched_autotest unit test case
>>>>
>>>> Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
>>>> ---
>>>>  config/defconfig_arm64-armv8a-linuxapp-gcc |  2 +-
>>>>  lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
>>>>  2 files changed, 23 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
>>>> index 65888ce..021044a 100644
>>>> --- a/config/defconfig_arm64-armv8a-linuxapp-gcc
>>>> +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
>>>> @@ -48,4 +48,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
>>>>  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
>>>>  CONFIG_RTE_LIBRTE_AVP_PMD=n
>>>>
>>>> -CONFIG_RTE_SCHED_VECTOR=n
>>>> +CONFIG_RTE_SCHED_VECTOR=y
>>>
>>> It's enough to remove this line only, I don't think you must enable it
>>> explicitly in the armv8a common config.
>>>
>> Tried removing this line from armv8a config. But in that case
>> RTE_SCHED_VECTOR doesn't get defined.
>> ./config/common_base has "CONFIG_RTE_SCHED_VECTOR=n" as the default
>> setting. So enabling explicitly is required.
>>
>
> I know it must be enabled to use your enhancement. But I meant to keep
> the same as common_base (or other default configs) if there is no
> other strange reason to enable it.
>
> Thanks!
> Jianbo
>
Got it. Will update the patch removing CONFIG_RTE_SCHED_VECTOR=n from 
defconfig_arm64-armv8a-linuxapp-gcc and resend.
Thanks
Ashwin
  

Patch

diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
index 65888ce..021044a 100644
--- a/config/defconfig_arm64-armv8a-linuxapp-gcc
+++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
@@ -48,4 +48,4 @@  CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 
-CONFIG_RTE_SCHED_VECTOR=n
+CONFIG_RTE_SCHED_VECTOR=y
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 614705d..4ba476a 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -58,6 +58,8 @@ 
 
 #if defined(__SSE4__)
 #define SCHED_VECTOR_SSE4
+#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#define SCHED_VECTOR_NEON
 #endif
 
 #endif
@@ -1732,6 +1734,26 @@  grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
 	return 1;
 }
 
+#elif defined(SCHED_VECTOR_NEON)
+
+static inline int
+grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
+{
+	uint32x4_t index, pipes;
+	uint32_t *pos = (uint32_t *)port->grinder_base_bmp_pos;
+
+	index = vmovq_n_u32(base_pipe);
+	pipes = vld1q_u32(pos);
+	if (!vminvq_u32(veorq_u32(pipes, index)))
+		return 1;
+
+	pipes = vld1q_u32(pos + 4);
+	if (!vminvq_u32(veorq_u32(pipes, index)))
+		return 1;
+
+	return 0;
+}
+
 #else
 
 static inline int