OK. I see... Are we going to do wrappers for all functions? How would an application writter know what to pick?. We can take that on monday, as Nicolas has libc related problems (he uses ulibc, and we use glibC). Thanks for your explanation and sorry for the spam.
Christophe. On 5 November 2015 at 12:00, Savolainen, Petri (Nokia - FI/Espoo) < [email protected]> wrote: > This is from 22th Oct, RE: [lng-odp] [API-NEXT PATCH] api: clib: added > standard c library api. About +20% performance compared to standard C lib > implementation. This is not for wrapping it but for optimizing it. > > > > -Petri > > > > > > Here's some cycle count measurements from x86 with DPDK. Compiled with -O2 > -mavx2, so that GCC knows about AVX2 and memcpy could use the same vector > instructions that DPDK uses (== best case results for memcpy). Code warms > up caches before measuring and repeats each data len 6 times. Generally > rte_memcpy is at least 20% faster. > > > > len memcpy rte_memcpy > > 256 232 156 88 88 88 88 148 72 68 72 > 72 68 > > 512 208 104 104 104 104 104 136 112 80 80 > 80 80 > > 768 156 120 120 116 120 120 192 116 92 92 > 88 88 > > 1024 224 136 132 136 136 136 136 100 100 100 > 96 100 > > 1280 184 168 152 152 152 152 136 112 104 104 > 108 104 > > 1536 200 168 164 164 168 168 156 152 136 140 > 140 140 > > 1792 208 212 184 184 180 180 160 132 124 124 > 120 120 > > 2048 220 212 204 204 200 200 148 144 128 128 > 132 128 > > 2304 252 228 220 216 216 212 152 144 136 140 > 136 136 > > 2560 272 240 232 232 228 232 164 144 148 144 > 144 148 > > 2816 280 256 248 248 248 248 164 164 152 152 > 152 156 > > 3072 296 272 264 264 268 264 188 172 160 160 > 164 164 > > 3328 312 288 284 280 284 280 180 176 168 168 > 172 168 > > 3584 324 304 300 300 296 296 180 184 176 176 > 176 176 > > 3840 340 320 320 316 316 316 208 188 184 188 > 184 188 > > 4096 348 348 332 332 332 332 204 204 192 196 > 196 192 > > > > > > > > *From:* EXT Christophe Milard [mailto:[email protected]] > *Sent:* Thursday, November 05, 2015 12:53 PM > > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* EXT Maxim Uvarov; LNG ODP Mailman List > *Subject:* Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added > validation tests > > > > Also, I am not sure about why we need to wrap the libC functions in ODP, > how much we should do it, and how it relates to the problems experienced by > Nicolas, ODP-224 > > Maybe somehting for the ARCH call on monday? > > > > On 5 November 2015 at 11:43, Christophe Milard < > [email protected]> wrote: > > ok.then it is the right place in the structure. Are you fixing the names, > Petri? > > > > On 5 November 2015 at 11:35, Savolainen, Petri (Nokia - FI/Espoo) < > [email protected]> wrote: > > /** > > * @defgroup odp_std_clib ODP STD CLIB > > * @details > > * ODP version of often used C library calls > > * @{ > > */ > > > > The module name is “std_clib”. I did try to use that as the module name. > You can find e.g. std_clib.h in api-next. > > > > -Petri > > > > > > > > *From:* EXT Christophe Milard [mailto:[email protected]] > *Sent:* Thursday, November 05, 2015 12:28 PM > > > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* EXT Maxim Uvarov; LNG ODP Mailman List > *Subject:* Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added > validation tests > > > > /doc/implementers-guide/implementers-guide.html: > > > 2.1.2. Module test and naming convention > > · Tests, i.e. C functions which are used in CUnit test suites are > named: * <Module>_test_** > where the suffix idendify the test. > > · Test arrays, i.e. arrays of odp_testinfo_t, listing the test > functions belonging to a suite, are called: *<Module>_suite[_*]* > where the possible suffix can be used if many suites are declared. > > · CUnit suite init and termination functions are called: > *<Module>_suite[_*]_init()* and *<Module>_suite[_*]_term()* respectively. > where the possible extra middle pattern can be used if many suites are > declared. > > · Suite arrays, i.e. arrays of odp_suiteinfo_t used in executables > (CUnit registry) are called: *<Module>_suites[_*]* > where the possible suffix identifies the executable using it, if many. > > · Main executable function(s), are called: *<Module>_main[_*]* > where the possible suffix identifies the executable, if many, using it. > > · Init/term functions for the whole executable are called: > *<Module>_init* *<Module>_term* > > All the above symbols are part of the generated libtest<Module>.la > libraries. The generated main executable(s) (named <module>_main[_*], where > the optional suffix is used to distinguish the executables belonging to the > same module, if many) simply call(s) the related <Module>_main[_*] from the > library. > > > > On 5 November 2015 at 11:16, Savolainen, Petri (Nokia - FI/Espoo) < > [email protected]> wrote: > > What rules exactly? > > > > *From:* EXT Christophe Milard [mailto:[email protected]] > *Sent:* Thursday, November 05, 2015 12:15 PM > > > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* EXT Maxim Uvarov; LNG ODP Mailman List > *Subject:* Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added > validation tests > > > > Also, this patch does not respect the test naming convention rules. > > /Christophe. > > > > On 5 November 2015 at 11:12, Christophe Milard < > [email protected]> wrote: > > but why should ODP tests test the C lib, as it is not part of ODP? > > If there is a good reason to do so (which I do not unerstand at this > stage), I think the test sould be placed elsewhere. > > > > On 5 November 2015 at 11:06, Savolainen, Petri (Nokia - FI/Espoo) < > [email protected]> wrote: > > It’s asn ODP module. It tests ODP version of (optimized) common C lib > calls – like odp_memcpy() > > > > -Petri > > > > +static void std_clib_test_memcpy(void) > +{ > + uint8_t src[] = {0, 1, 2, 3, 4, 5, 6, 7, > + 8, 9, 10, 11, 12, 13, 14, 15}; > + uint8_t dst[16]; > + int ret; > + > + memset(dst, 0, sizeof(dst)); > + > + *odp_memcpy*(dst, src, sizeof(dst)); > + > + ret = memcmp(dst, src, sizeof(dst)); > + > + CU_ASSERT(ret == 0); > +} > > > > *From:* EXT Christophe Milard [mailto:[email protected]] > *Sent:* Thursday, November 05, 2015 12:02 PM > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* EXT Maxim Uvarov; LNG ODP Mailman List > > > *Subject:* Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added > validation tests > > > > This is not a ODP module, is it? should/could it be one? > > I am not sure either what is the point of testing libC? If the question is > to make sure that libc contains such or such function, I thing we should > first decide which libC to use. > > ( see Jira ODP 224 ) > > But maybe I am missing some point... > > > > /Christophe. > > > > On 5 November 2015 at 09:52, Savolainen, Petri (Nokia - FI/Espoo) < > [email protected]> wrote: > > Ping. > > > > *From:* EXT Bill Fischofer [mailto:[email protected]] > *Sent:* Thursday, October 29, 2015 5:27 PM > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* LNG ODP Mailman List > *Subject:* Re: [lng-odp] [API-NEXT PATCH] validation: std_clib: added > validation tests > > > > > > > > On Thu, Oct 29, 2015 at 9:52 AM, Petri Savolainen < > [email protected]> wrote: > > Added validation tests for ODP std C library API. > > Signed-off-by: Petri Savolainen <[email protected]> > > > > Reviewed-and-Tested-by: Bill Fischofer <[email protected]> > > > > --- > configure.ac | 1 + > platform/linux-generic/test/Makefile.am | 1 + > test/validation/Makefile.am | 1 + > test/validation/std_clib/.gitignore | 1 + > test/validation/std_clib/Makefile.am | 10 +++++ > test/validation/std_clib/std_clib.c | 66 > ++++++++++++++++++++++++++++++++ > test/validation/std_clib/std_clib.h | 21 ++++++++++ > test/validation/std_clib/std_clib_main.c | 12 ++++++ > 8 files changed, 113 insertions(+) > create mode 100644 test/validation/std_clib/.gitignore > create mode 100644 test/validation/std_clib/Makefile.am > create mode 100644 test/validation/std_clib/std_clib.c > create mode 100644 test/validation/std_clib/std_clib.h > create mode 100644 test/validation/std_clib/std_clib_main.c > > diff --git a/configure.ac b/configure.ac > index 8e94d82..9887589 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -326,6 +326,7 @@ AC_CONFIG_FILES([Makefile > test/validation/queue/Makefile > test/validation/random/Makefile > test/validation/scheduler/Makefile > + test/validation/std_clib/Makefile > test/validation/synchronizers/Makefile > test/validation/thread/Makefile > test/validation/time/Makefile > diff --git a/platform/linux-generic/test/Makefile.am > b/platform/linux-generic/test/Makefile.am > index a657de9..24285c1 100644 > --- a/platform/linux-generic/test/Makefile.am > +++ b/platform/linux-generic/test/Makefile.am > @@ -19,6 +19,7 @@ TESTS = pktio/pktio_run \ > ${top_builddir}/test/validation/queue/queue_main$(EXEEXT) \ > ${top_builddir}/test/validation/random/random_main$(EXEEXT) \ > ${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \ > + ${top_builddir}/test/validation/std_clib/std_clib_main$(EXEEXT) \ > > ${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT) \ > ${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \ > ${top_builddir}/test/validation/time/time_main$(EXEEXT) \ > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am > index 4f926ce..1711b93 100644 > --- a/test/validation/Makefile.am > +++ b/test/validation/Makefile.am > @@ -12,6 +12,7 @@ ODP_MODULES = buffer \ > pool \ > random \ > scheduler \ > + std_clib \ > synchronizers \ > thread \ > time \ > diff --git a/test/validation/std_clib/.gitignore > b/test/validation/std_clib/.gitignore > new file mode 100644 > index 0000000..3782833 > --- /dev/null > +++ b/test/validation/std_clib/.gitignore > @@ -0,0 +1 @@ > +std_clib_main > diff --git a/test/validation/std_clib/Makefile.am > b/test/validation/std_clib/Makefile.am > new file mode 100644 > index 0000000..aa02be6 > --- /dev/null > +++ b/test/validation/std_clib/Makefile.am > @@ -0,0 +1,10 @@ > +include ../Makefile.inc > + > +noinst_LTLIBRARIES = libteststd_clib.la > +libteststd_clib_la_SOURCES = std_clib.c > + > +bin_PROGRAMS = std_clib_main$(EXEEXT) > +dist_std_clib_main_SOURCES = std_clib_main.c > +std_clib_main_LDADD = libteststd_clib.la $(LIBCUNIT_COMMON) $(LIBODP) > + > +EXTRA_DIST = std_clib.h > diff --git a/test/validation/std_clib/std_clib.c > b/test/validation/std_clib/std_clib.c > new file mode 100644 > index 0000000..e53ad39 > --- /dev/null > +++ b/test/validation/std_clib/std_clib.c > @@ -0,0 +1,66 @@ > +/* Copyright (c) 2015, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp.h> > +#include <odp_cunit_common.h> > +#include "std_clib.h" > + > +#include <string.h> > + > +#define PATTERN 0x5e > + > +static void std_clib_test_memcpy(void) > +{ > + uint8_t src[] = {0, 1, 2, 3, 4, 5, 6, 7, > + 8, 9, 10, 11, 12, 13, 14, 15}; > + uint8_t dst[16]; > + int ret; > + > + memset(dst, 0, sizeof(dst)); > + > + odp_memcpy(dst, src, sizeof(dst)); > + > + ret = memcmp(dst, src, sizeof(dst)); > + > + CU_ASSERT(ret == 0); > +} > + > +static void std_clib_test_memset(void) > +{ > + uint8_t data[] = {0, 1, 2, 3, 4, 5, 6, 7, > + 8, 9, 10, 11, 12, 13, 14, 15}; > + uint8_t ref[16]; > + int ret; > + > + odp_memset(data, PATTERN, sizeof(data)); > + > + memset(ref, PATTERN, sizeof(ref)); > + > + ret = memcmp(data, ref, sizeof(data)); > + > + CU_ASSERT(ret == 0); > +} > + > +odp_testinfo_t std_clib_suite[] = { > + ODP_TEST_INFO(std_clib_test_memcpy), > + ODP_TEST_INFO(std_clib_test_memset), > + ODP_TEST_INFO_NULL, > +}; > + > +odp_suiteinfo_t std_clib_suites[] = { > + {"Std C library", NULL, NULL, std_clib_suite}, > + ODP_SUITE_INFO_NULL > +}; > + > +int std_clib_main(void) > +{ > + int ret = odp_cunit_register(std_clib_suites); > + > + if (ret == 0) > + ret = odp_cunit_run(); > + > + return ret; > +} > diff --git a/test/validation/std_clib/std_clib.h > b/test/validation/std_clib/std_clib.h > new file mode 100644 > index 0000000..eab6872 > --- /dev/null > +++ b/test/validation/std_clib/std_clib.h > @@ -0,0 +1,21 @@ > +/* Copyright (c) 2015, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#ifndef _ODP_TEST_STD_CLIB_H_ > +#define _ODP_TEST_STD_CLIB_H_ > + > +#include <odp_cunit_common.h> > + > +/* test arrays: */ > +extern odp_testinfo_t std_clib_suite[]; > + > +/* test registry: */ > +extern odp_suiteinfo_t std_clib_suites[]; > + > +/* main test program: */ > +int std_clib_main(void); > + > +#endif > diff --git a/test/validation/std_clib/std_clib_main.c > b/test/validation/std_clib/std_clib_main.c > new file mode 100644 > index 0000000..010c1c6 > --- /dev/null > +++ b/test/validation/std_clib/std_clib_main.c > @@ -0,0 +1,12 @@ > +/* Copyright (c) 2015, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include "std_clib.h" > + > +int main(void) > +{ > + return std_clib_main(); > +} > -- > 2.6.2 > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp > > > > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp > > > > > > > > > > > > >
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
