U.Mutlu via llvm-dev
2018-Jun-19 18:48 UTC
[llvm-dev] Naming clash: -DCLS=n and CLS in code
Tim Northover via llvm-dev wrote on 06/19/2018 07:55 PM:> On Tue, 19 Jun 2018 at 18:22, U.Mutlu via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> I think such "reserved" names like CLS that can be passed to the compiler(s), >> should be avoided as identifiers for naming variables, constants, enum >> members, macros etc. > > Why are you passing that argument in the first place? The compiler > completely ignores it.CLS stands for cacheline size. It is an important parameter for optimization of the generated code, at least with gcc/g++. -DCLS=n should have the same importance like for example -DNDEBUG.> I sort of assume some library makes use of it, but if so that library > is certainly not required while compiling Clang and is actually > obscure enough that it's not even obvious from Googling. So it's a bit > of a stretch to claim the token is reserved.Yes, it might not be required for the Average Joe user, but that's not me :-) Let me wish you a Good Morning!... :-)
Tim Northover via llvm-dev
2018-Jun-19 18:54 UTC
[llvm-dev] Naming clash: -DCLS=n and CLS in code
> > Why are you passing that argument in the first place? The compiler > > completely ignores it. > > CLS stands for cacheline size. It is an important parameter > for optimization of the generated code, at least with gcc/g++. > -DCLS=n should have the same importance like for example -DNDEBUG.The GCC source doesn't appear to mention it, and neither does any documentation I can find. NDEBUG on the other hand is in both the C and C++ standards. I still think there's some weird library out there that interprets it the way you're suggesting, and Clang is not that weird library. Cheers. Tim.
U.Mutlu via llvm-dev
2018-Jun-19 19:12 UTC
[llvm-dev] Naming clash: -DCLS=n and CLS in code
Tim Northover wrote on 06/19/2018 08:54 PM:>>> Why are you passing that argument in the first place? The compiler >>> completely ignores it. >> >> CLS stands for cacheline size. It is an important parameter >> for optimization of the generated code, at least with gcc/g++. >> -DCLS=n should have the same importance like for example -DNDEBUG. > > The GCC source doesn't appear to mention it, and neither does any > documentation I can find. NDEBUG on the other hand is in both the C > and C++ standards. > > I still think there's some weird library out there that interprets it > the way you're suggesting, and Clang is not that weird library.This is from a famous article series titled "What every programmer should know about memory": gcc -DCLS=$(getconf LEVEL1_DCACHE_LINESIZE) ... https://lwn.net/Articles/255364/ http://mosermichael.github.io/cstuff/all/blog/2015/12/11/wepskn.html https://www.dcl.hpi.uni-potsdam.de/teaching/numasem/slides/NUMASem_Matrix_multiplication.pdf You can find more examples by searching for "DCLS getconf LEVEL1_DCACHE_LINESIZE".