« first day (3076 days earlier)      last day (1855 days later) » 

3:18 AM
The most well written performance question I've seen in a long time stackoverflow.com/questions/55232880/…
I almost cried.
 
What stopped you from crying?
@PasserBy Was it dehydration from drinking too much coffee?
 
3:54 AM
Perhaps ;)
 
An autonomous truck company, is going the route of combining radar, sensors and cameras. All of these solutions are less expensive than lidar.
Then I checked online and found this:
Pretty sure at this price, it's not industrial ...
 
4:21 AM
@traducerad macros are among the few ways, maybe the only way to pass the the file and line number from the caller to the callee.
Perhaps the most common use is debug asserts, especially when we have to deal with older compilers.
 
 
1 hour later…
5:39 AM
So I was debugging code in Netbeans and the only output was "build failed" and some random shit that there was an error in a library that hadn't been changed. It turned out that an argument was added that was passed to a std::thread constructor which hadn't been updated to pass the new argument. Is there any list of situations when a C++ compiler tends to give misleading or bizarre errors? IIRC other situations include missing a semicolon at the end of a class deceleration or prototype.
 
Yes, this is the one of the reoccurring complaints about C++
74
Q: Generate the longest error message in C++

Elazar LeibovichWrite a short program, that would generate the longest possible error message, in a standard C++ compiler (gcc, cl.exe, icc, or clang). The score of each entry is the number of characters in the longest error message the compiler emitted. Types included in your source code and quoted by the comp...

104
A: Generate the longest error message in C++

BЈовић19 characters Create a file a.cpp with this content : #include __FILE__ p; Compile as : g++ a.cpp and get amazing 21300 lines error messages : In file included from a.cpp:1:0, from a.cpp:1, from a.cpp:1, from a.cpp:1, ... ... 2...

 
This is rich
Are the error messages mandated by the C++ standard themselves? e.g. why does compiling with g++ give same error as when compiling with clang++?
 
5:56 AM
Error messages change between compilers
 
 
3 hours later…
8:59 AM
though giving enough information about the error to be able to fix it is what makes them long, especially when templates get involved
 
 
2 hours later…
 
1 hour later…
12:19 PM
@TelKitty it's too bad you could never get one into aus thehill.com/policy/energy-environment/…
 
1:09 PM
@Mgetz @YvetteColomb is the one adopting wild horses.
Australia is probably spending $1000 a horse too - but use the money to shoot horses from helicopters instead. Barbarians.
 
nwp
There are probably people willing to pay to do that.
 
IMO, it's wrong to kill any warm blood mammals unless you have raised them by providing shelter and food for them. The only exception would be if they cause immediate danger to you or people around you.
 
user3956566
@TelKitty :(
 
3:41 PM
@Borgleader Nice! Now if only they'd fix their bugs as well. :)
 
4:10 PM
@Mysticial still no AVX512 support for that though
 
@Mgetz Not for automatic vectorization. But they do have the intrinsics - just buggy.
I actually found another bug this last weekend.
 
@Mysticial I don't see AVX512 being a huge priority for MS? I'm guessing they are under the impression that anyone who really wants to use AVX512 will probably be using Intel or doing it in assembly directly
 
I'm probably the only one who uses it. :)
But that doesn't mean they should be miscompiling it so badly.
 
I also think they want to focus on getting their SSA implementation solid before they really dive deep into some of the vectorization issues
 
4:13 PM
@Mysticial invalid opcode badly?
 
@Mgetz Compiles, runs, incorrect results.
 
@Mysticial is the assembly correct?
 
The vast majority of the AVX512 bugs I've filed were in that category.
@Mgetz Nope.
 
ah
not really surprised, AVX 512 is just so complicated and they are focused elsewhere
 
There were at least like 4 different bugs where usage of the reg16-31 would lose the upper bit and reference reg0-15 instead.
 
4:15 PM
@Mysticial I didn't think they supported those upper regs at all... even in windows
 
They do now.
Other cases where masked moves get treated the same as normal moves. So the merge blending disappears when it gets merged away.
Or they ignore the input parameter.
 
so they treat it as if it was AVX?
or just haven't tested it enough to care?
 
I suppose.
They haven't tested much - if at all.
Neither GCC nor ICC has these problems.
They've fixed most of them. They do treat miscompilations as highest priority.
Bugs aside, their codegen is shit. But I'm not complaining yet.
 
@Mysticial ICC I'd be surprised if they ever had issues. GCC I'd be curious to see who implemented it.
ditto clang
 
They always generate 231-FMAs. Never the other variants unless it's a memory access. So there's unnecessary reg-reg moves everywhere.
They never use more than one mask register. So spills all over the place.
Register spills spill into the callee save registers first instead of the reg16-31 which are caller save.
 
4:21 PM
@Mysticial sounds like they did exactly what I accused MS of doing... re-using the base AVX code
 
yeah
I don't think I've ever seen MSVC generate masked arithmetic with memory operands.
Though I'd need to see if even ICC does it correctly.
Right now, there's no way to express this in intrinsics:
vaddpd zmm0{k1}, zmm1, ZMMWORD_PTR[rax];
You can't just load and do the masked add, because you need to suppress the faults on the load. IOW mask both the load and the add.
But I haven't seen if ICC is smart enough to merge a load+arithmetic with the same mask.
I haven't had many usecases of masked arithmetic with memory operands.
 
Looks like this is how GCC does the arch planning github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/i386.md
I'd suggest viewing that raw... as I don't think that's markdown
yeah I don't think it's deliberately ignoring the other mask registers, I think core GCC just doesn't understand the concept at all
 
4:47 PM
@Mgetz it's not markdown, but instead a custom machine description language, looks to be derived from some lisp dialect
 
Yeah I figured, I stand by what I said though. I don't think core GCC understands the idea of a mask register at all
 
 
2 hours later…
6:45 PM
@Mikhail
0
A: how to optimize and speed up the multiplication of matrix in c++?

Sam XiaYou can try algorithm like Strassen or Coppersmith-Winograd and here is also a good example. Or maybe try Parallel computing like future::task or std::thread

^^ He's recommending the OP implement Coppersmith-Winograd. hahaha
 
6:58 PM
Real question is how does the order of algorithm of Coppersmith-Winograd compare to std::future::task :-)
 
How can I pass more then 70 000 arguments to gcc?
I mean an arbitrary number
of arguments
without getting E2BIG
 
I'm sorry, you must be mistaking us for the GCC helpdesk
 
7:33 PM
Can't pass more than ARGMAX
 
@Mikhail What is the limit anyway?
I admit that in my attempt to facilitate compiler optimizations, I have some force-inlined functions that have 40 parameters.
 
why would you want to pass that many arguments on the command line anyway
 
not command line, but actual code
 
even in actual code... why? at some point you'll trigger a stack overflow
at least on any modern ABI
 
For command lines, where do you even get that many options? There aren't even that many options in the compiler. Unless you're spamming the program with macros.
@Mgetz I've found that compilers are really had optimizing arrays on the stack.
So it's better to have 50 separate variables then to use an array of 50.
 
7:40 PM
@Mysticial or input files and not going directly to ld
 
IOW, if there's no order to them and you're not actually iterating them, they don't need to be an array.
 
@Mysticial I thought the compiler just passed the pointer?
instead of doing pushd for all of them?
 
By removing the constraint that the variables are in memory in a specific order, they all get promoted into separate values in the IR which then gets fed into the register allocator as individual pieces. The compiler spills only what is needed as opposed to having array accesses everywhere.
 
@Mysticial fair enough, but with 50 you're going to be spilling at least 45 to the stack
 
@Mgetz force-inlined function.
 
7:43 PM
eh... fair enough
 
Trivial example:
FORCE_INLINE void transpose16x16(
    __m512& r00, __m512& r01, __m512& r02, __m512& r03,
    __m512& r04, __m512& r05, __m512& r06, __m512& r07,
    ...
)
 
8:23 PM
Or when you ls a folder with so many elements ls explodes
From what I recall there was also a limit on the OS side that wouldn't match the limit in C/C++. So, people had to upgrade their 2.x kernels.
 
8:46 PM
Thanks guys
@Mgetz I am trying to pass many files to GCC to get dependencies with GCC -MM
so you have to pass each file
like this
gcc -MM path/file.c path2/file2.c
what do you do when you have an arbitrary number of these?
dividing the call in smaller ones
could be a solution
but I also need to add -iquote
for the header files
and I do not know what header file each file needs
in advance
 
@Mysticial I'm probably missing some context here, ...but force-inline can't increase the number of registers.
@Mgetz 50 params means 45 on the stack? ...I really don't get it.
 
@StackedCrooked It doesn't, but it brings everything into the scope of the caller so the optimizer has everything there to optimize with.
 
Ah, so it can optimize at will at compile time.
 
The compiler is also unlikely to inline a function with 20+ parameters on it. Their heuristics usually go by the size of a function. And if you have 20+ parameters that are all being used, chances are it's large enough to be above the threshold.
@StackedCrooked correct
Basically, I don't want to keep copy-pasting the same 50+ instruction transpose code everywhere. So I make a force-inline function for it.
But I can't pass in an array because:
1. The inputs aren't necessarily arrays in the caller.
2. It suppresses compiler optimization.
I have functions like this that go up to 40+ parameters. That's way over the # of registers. But once it's all inlined into the caller, the spilling is actually pretty sparse in most cases.
 
Alexandrescu often rants about "indirect writes" being inefficient. Basically he means array writes being less efficient than local variable writes.
One of his main arguments is that array elements are less likely to be registers.
 
8:57 PM
Recently I've been toying with some really ugly workloads that require massive working sets. (60+ live SIMD registers)
Turns out that even when you write it all out, the compiler does a pretty damn good job of minimizing the spilling.
 
@Mysticial You mean, because the compiler is smart enough to reuse registers for multiple purposes?
 
In fact, if the code has a low density of load/stores to memory, it becomes beneficial to increase the working size to intentionally spill to use up the idle load/store resources. Assuming that there is material benefit to increasing the working size.
@StackedCrooked Yes. It's "just" a graph coloring algorithm.
 
There's this debate about the power of compilers vs the power of hand-written assembly. It seems to be that both sides have some valid points.
However, it also seems that the most powerful argument in favor of compilers is register allocation.
I mean, it seems way too burdensome to do this by hand.
Every time a small piece of code changes, the register allocation may need to change.
 
There's a sort of rule-of-thumb to unroll something just enough to use all the registers, but not more. But it's not a sharp cutoff. Once you go into spilling territory, the degradation is gradual. And there's a lot of room to penetrate into that area to extract other benefits.
But with 32 registers, it does lead to some pretty impressively sized code that would never pass a code review. :)
 
32 registers?
 
9:05 PM
Unless it was auto-generated.
 
I thought there's only 16.
 
yeah, 32 AVX512 registers.
 
Wow. Intel invested a lot of real estate for AVX512.
I mean that's like 16KiB of register memory?
 
2k
 
Ah. I was confusing bits and bytes :D
But that's still a lot.
 
9:08 PM
I've also found that with more registers, the "spill ratio" seems to improve.
IOW, if I have 16 live variables with 8 registers, fucking every other access is a spill.
With 32 variables and 16 regs, it improves. Maybe 1 in 4 will spill.
With 64 variables and 32 regs, it's low enough that I don't care.
Obviously this is workload-dependent. But you get the idea.
 
You mean the compiler gets more leeway as the number of registers increases?
 
I think there's more room to exploit locality in variable usage.
That said, I really don't like writing massive code bodies like this. But there are enough cases where the choice is between:
- Branch-heavy sequential implementation.
- Fully unrolled AVX512 implementation that has 50 live variables.
This happens a lot when I'm trying to vectorize something that's inherently not vectorizable. So the approach is see how much data is needed to align properly, then multiply it by the SIMD width. Then do a massive transpose on the data.
 
@StackedCrooked in most calling conventions the first few arguments are passed in registers the rest are on the stack
 
So if the algorithm is operating on chunks of 29x64-bits. And I'm on AVX512 with a SIMD width of 8x64-bits. 29 and 8 share no common factors. So I need to load 29 x 512-bit chunks into 29 AVX512 registers. Do a 29x8 transpose. Then apply the sequential algorithm on 8 lanes at once. Then transpose back.
The result is a 1000 lines of completely unrolled, transpose-heavy AVX512 code that runs way over the register count. But it's really fucking fast nevertheless.
 
@Mgetz I know, but AMD64 only has 16 registers (including stack pointer and program counter). So I expected to be 12-14 to be in register. (Sorry.)
 
9:20 PM
@Mysticial where can I learn what are the Dependency Chains in your flops project?
 
@Aurelius data dependency chains?
 
@Mysticial things like
#define flops_mul_chains12_ops24(   \
    vmul,   \
    mul0, mul1,  \
    r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, rA, rB \
){  \
 
You're probably looking at the older versions since IIRC, I did away with all the macros.
But what that macro has 12 independent data dependency chains.
 
So is that a data dependency chain?
 
A dependency chain is basically a chain of instructions where each instruction depends on the output of the previous.
Because of that dependency, they cannot run in parallel.
Haswell can run 2 multiplies/cycle. But each multiple is 5 cycles long. So if two multiplies depend on each other, it would take 5 + 5 = 10 cycles.
But the process can issue 20 multiplies in 10 cycles. The only way you can utilize it is to run many independent multiplies at once.
10 being the minimum for multiply on Haswell. As an example.
That macro does 12 - which is enough to saturate the Haswell processor.
 
9:54 PM
@Mysticial thank you very much, by 10 is the minimum you mean is the minimum amount of multiplies to saturate Haswell?
 
correct
for that particular instruction
 
where do you even get all the these information about a specific architecture?
 
Whatever you can find on the internet. (Agner Fog has tables with this information for most processors). Otherwise you have to reverse engineer it.
 
is it 10 becasue 1 multiply takes 5 cycles and in the timeframe of 5 cycles we can issue 10 multiplies or 2 per cycle?
 
exactly
 
10:50 PM
Seriously, what the fuck is wrong with you? Is this even legal? Did you ask permission from YouTube/Google? — Ben 49 secs ago
-1
A: Stack Overflow index page points to videos

BenEvidently this is a very very bad joke on the part of the Stack Overflow team. But if you want to know what's wrong with Stack Overflow: No longer curating a definitive list of questions and answers Instead recreating Usenet comp.lang.* only somehow worse... Full of rep-farming users asking ...

Someone is really pissed.
 
11:08 PM
Instead recreating Usenet comp.lang.* only somehow worse...
boomer detected
I had a weird tech issue today. Reinstall Windows, import a foreign dynamic disk (RAID 5). Disk shows up as failed and Windows won't let me recover it.
Potential loss of 20+ TB of publishable data
Somehow software RAID solutions on Windows are particularly fucked.
HighPoint (no problem yet, but no Linux drivers for 4.19, requires you build the module, but code doesn't stay updated)
Adaptec (Array breaks when power is pulled, often can rebuild, once couldn't rebuild due to firmware bugs, also potentially breaks due to firmware bugs)
Intel RST (Array break when power is pulled, can't rebuild)
ZFS (massive performance hit)
Windows (massive, massive performance hit, 24 drives behave as two, can't rebuild)
Fuck, I just wanted to make designer babies in test tubes but my RAID array keeps failing.
 
you should use debian next time.
 
debian isn't a kind of RAID controller
Linux software RAID solutions are less buggy, but have horrible performance problems that Linux users aren't aware of because they have never used real RAID controllers.
Or because they are hooked up to a 1G network.
Also debian is shit, if you're going to work for it use Gentoo
 
lol
 
I have 5 Gentoo systems deployed at work. Nobody else can use them, so they are basically dedicated to my work.
 
what's all this power for
 
11:22 PM
3D + timelapse imaging
On the other hand an MRI costs $500,000, so in the big scheme of things its not a lot of money
 
11:37 PM
cool, so you are trying to replace MRI's with some sort of image recognition system.
 
I'm working on a lot of shit, but really its about understanding light to see things better
But then the experimental part of the work is mostly fixing broken equipment, yelling at people, and the analysis is p-hacking to justify why we did all the yelling
Right now I need to fix a GUI omission/bug, but I gotta phrase the fix (and time spent working on it) in terms of how many cancers I can cure
 
I use to work in an environment like that, it sounds horrible, but it's actually a lot of fun.
 
Lol, at the rate I'm going I'm soon going to be older than all you :-)
 
you should delegate, when you give people ownership they tend to do a really good job.
 
Yeah, thats a good idea, but I work with undergrads who are smart enough to know they don't need to do any work. I don't have employees :-/
Anyways I need to get back to sucking my duck
 

« first day (3076 days earlier)      last day (1855 days later) »