[libc-commits] [PATCH] D100646: [libc] Add a set of elementary operations

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 29 02:29:50 PDT 2021


gchatelet marked 3 inline comments as done.
gchatelet added inline comments.


================
Comment at: libc/test/src/string/memory_utils/CMakeLists.txt:14
+  COMPILE_OPTIONS
+    -march=native
 )
----------------
avieira wrote:
> sivachandra wrote:
> > gchatelet wrote:
> > > avieira wrote:
> > > > AArch64 doesn't support -march=native, we use -mcpu=native instead, so it would be good to specify the correct option per target. 
> > > Thx I wasn't aware of this. I found this article, it's helpful and confusing at the same time :-D
> > > https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu
> > > 
> > > @sivachandra should we define a new CMake macro or do you think this should be part of `add_libc_unittest`?
> > > The aim is to use whatever is available on the host machine when performing the tests.
> > > @sivachandra should we define a new CMake macro or do you think this should be part of `add_libc_unittest`?
> > > The aim is to use whatever is available on the host machine when performing the tests.
> > 
> > I suppose you are asking about adding `-march=native` and `-mcpu=native`? If yes, then I think we should add a top-level var like `LLVM_LIBC_COMMON_COMPILE_OPTIONS` which get set to the appropriate value based on the target machine. And then, both `add_entrypoint_object` and `add_libc_unittest` should use it.
> @gchatelet I didn't quite understand why only use -march/-mcpu during the tests and not for the benchmarking for instance. @sivachandra approach sounds better to me.
> 
> As for the options, I think the simple (but maybe somewhat naive) explanation is '-march': determines what features are available, '-mtune': sets the micro-architecture tuning strategy and '-mcpu' set's both for the micro-architecture you pass it. When you pass native it tries to autodetect the micro-architecture.
> @gchatelet I didn't quite understand why only use -march/-mcpu during the tests and not for the benchmarking for instance.

We should. All of this is work in progress. I'll start a patch to address this.

1. If llvm-libc source code is part of the code base being compiled it definitely makes sense to set the micro-architecture and leverage available features.
2. In the case of shared library though we may have to provide several implementations and do runtime dispatch, if so, the tests must run all configurations up to what's available on the host.

I believe that we can stick to 1 for now. WDYT @sivachandra ?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100646/new/

https://reviews.llvm.org/D100646



More information about the libc-commits mailing list