flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4 Next |
Author |
|
revolution 19 Apr 2016, 01:49
For a task that runs in only 0.35s the timing is very fragile and subject to the whims of OS clocking controls and background tasks stealing cycles. If this thing runs all day everyday then it might be a worthwhile goal to make it 5% faster (and thus one can buy 5% fewer machines and save some $) but otherwise ... ?
Aside: It is always possible to find some HLL task that performs equally as well as the asm version. Usually something that it cache unfriendly and uses sparse arrays will be almost impossible to make any significant improvement by using asm. But some tasks can be made hugely faster than any HLL compiler could ever hope achieve when one can exploit the internal CPU instructions and data paths to the fullest. Choose your optimising tasks with caution. Choose to put your time into those areas where the gain will be most. Last edited by revolution on 19 Apr 2016, 04:24; edited 1 time in total |
|||
![]() |
|
redsock 19 Apr 2016, 01:59
revolution: agreed fully
![]() Boy did I open a can of worms stepping into this thread, haha... so my colleague asked me to actually analyze the adj5 function from a runtime perspective and to justify in real numbers by previous statement about whether or not a mul is really going to be better. Hahah, sure enough, gcc's 3 separate lea instructions as it turns out is the same basic cycle counts, but here is the official note taking as I walked through it (annotated gcc output, and then my rewritten version that does the same thing). I think it is particularly interesting that sometimes compilers have a tendency to be "too fancy" for their own good. Compiler optimized gcc adj5 function again (noting this is specific to Ivy Bridge): Code: movsxd rdi,edi ; sign extend edi, latency 2, recip 0.5 movsxd rsi,esi ; sign extend esi, latency 2, recip 0.5 ; 2 core clocks in until rdi is sign extended lea rax,[rdi+rdi*2] ; rax = rdi * 3, latency 1, recip 0.5 ; 3 core clocks here lea rax,[rdi+rax*4] ; rax = (rax * 4) + rdi, or rdi * 13, latency 1, recip 0.5 ; 4 core clocks here lea rax,[rdi+rax*4] ; rax = (rax * 4) + rdi, or rdi * 53, latency 1, recip 0.5 ; 5 core clocks here add rsi,rax ; + rsi, latency 1, recip 0.33 ; 6 core clocks here mov eax,DWORD PTR [rsi*4+0x405ce0] ; load dword from table into eax, latency 2, recip 0.5 ; wait 2 more for the result, so now we are at 8 core clocks test eax,eax ; test eax, latency 1, recip 0.33 ; 9 core clocks setne al ; setnz al, latency 1, recip 0.5 ; 10, although the ret will go before the result is ready ; also, is there a partial register penalty for using the 8bit here? ret Code: imul rax, rdi, 53 ; rax = rdi * 53, latency 3, recip 1 ; 3 core clocks until rax has our result add rax, rsi ; + rsi, latency , recip 0.33 ; 4 core clocks here mov eax, [rax*4+0x405ce0] ; latency for the load is 2, but since the result won't be used until after the return ; its somewhere between 4.5 and 6 core clocks before we bail out. ret ![]() Cheers again |
|||
![]() |
|
Tyler 19 Apr 2016, 02:54
revolution, I ran this for 2 weeks (or maybe more, it's been a while) on our school server, utilizing 12 cores. There was more to it then -- I stripped out all the nasty multithreading code I wrote then and am planning on rewriting it better, faster, and cleaner before I put this thing on my resume and post it to my github.
|
|||
![]() |
|
sleepsleep 19 Apr 2016, 04:08
you guys are so awesome & cool!
|
|||
![]() |
|
Tyler 19 Apr 2016, 04:44
sleepsleep, you seem like you enjoy learning a lot. You should check out some MooCs and learn this stuff. You can get a pretty high quality CS education for free on the internet these days.
Check this out: https://github.com/open-source-society/computer-science They even tell you what order to do the classes in. If you took all of these, you would know way more than me and almost every CS graduate in the US. |
|||
![]() |
|
redsock 19 Apr 2016, 07:42
Tyler, I meant to say thanks for putting this up
![]() Are you going to proceed with it? And if so, are you going to restructure the baseline code and/or test data? Cheers |
|||
![]() |
|
redsock 19 Apr 2016, 22:07
Spent some this morning over my morning coffee and reworked your C++ version.
None of the changes I made affect any of its previous functionality. On my machine, this reworked version is 2.2X faster than your original C++. https://ideone.com/u3sMA5 |
|||
![]() |
|
Tyler 19 Apr 2016, 23:10
Sorry for the radio silence today. I had to finish a project for a deadline.
What restructuring would you like for me to do? You mean compiling them separately and then linking them? Sure. I'll post another test case when I get back on my laptop (posting from phone rn). I can get you one that takes a couple minutes with my version. (Well, I can give you test cases that will run longer than either of us will live, but I think a couple minutes is more like what you want, right?) |
|||
![]() |
|
Tyler 20 Apr 2016, 17:59
As promised:
Code: tyler@smsng:~/Desktop/graph2$ time echo 233 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1,1,1}, {1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,0,1,0,0,1,1,1,1,1,1,1,0,1,0,0,1,0,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,0,0,1,0,0,0,1,0,1,1,1,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,1,1,0,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1}, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,0,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,1,1,1,0,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,0,0,0,1,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0}} 233: 19 129 real 18m9.681s user 18m9.520s sys 0m0.044s |
|||
![]() |
|
Tyler 20 Apr 2016, 18:02
I could've "chrt -f 99"'ed it, but meh. That tends to mess up my wifi and require a reboot to fit it. (Proprietary Intel garbage.) At this long of a runtime, I doubt it matters that much.
|
|||
![]() |
|
redsock 20 Apr 2016, 20:50
Did you see my 4th post back? I think my reworking your C++ version and achieving more than double the speed for the same logic/conditionals kinda moots the point of the original exercise, don't you?
|
|||
![]() |
|
bitRAKE 20 Apr 2016, 21:59
Thanks for the larger example - will make timing easier.
Here is the macro I've been using in FASM to convert into binary arrays: Code: MACRO adjacency name,[bit_array*] { COMMON adjacency@lines = 0 FORWARD adjacency@lines = adjacency@lines + 1 COMMON _ALIGN_ 64,4,<db 0> ; waste of a cacheline dd adjacency@lines name: ; non sized label name#.width = ((adjacency@lines + 63) AND (0-64))/8 ; width in bytes FORWARD gather@nodes=0 gather@dq=0 IRPS bit,bit_array \{ gather@dq = gather@dq + (bit shl (gather@nodes mod 64)) gather@nodes = gather@nodes + 1 IF 0 = (gather@nodes mod 64) dq gather@dq gather@dq=0 END IF \} IF 0 <> (gather@nodes mod 64) dq gather@dq gather@dq = 0 END IF IF gather@nodes <> adjacency@lines ERR "ERROR: Non-square Adjacency matrix!" END IF } adjacency Adj9, \ < 0 1 1 1 0 0 1 1 1 >, \ < 1 0 1 1 0 0 0 1 1 >, \ < 1 1 0 1 1 1 0 0 1 >, \ < 1 1 1 0 1 1 1 0 0 >, \ < 0 0 1 1 0 1 1 0 0 >, \ < 0 0 1 1 1 0 1 1 1 >, \ < 1 0 0 1 1 1 0 1 1 >, \ < 1 1 0 0 0 1 1 0 1 >, \ < 1 1 1 0 0 1 1 1 0 > MACRO _ALIGN_ base*,delta=0,fill=<db 0> { WHILE ((($-$$)+delta) and (base-1)) <> 0 fill END WHILE } https://turing.cs.hbg.psu.edu/txn131/clique.html Last edited by bitRAKE on 20 Apr 2016, 22:17; edited 2 times in total |
|||
![]() |
|
redsock 20 Apr 2016, 22:11
Your original C++:
Code: # perf stat ./original_129 17 Performance counter stats for './original_129': 1786268.847372 task-clock (msec) # 1.000 CPUs utilized 3,345 context-switches # 0.002 K/sec 6 cpu-migrations # 0.000 K/sec 98 page-faults # 0.000 K/sec 5,591,899,252,212 cycles # 3.130 GHz [83.34%] 2,153,264,209,241 stalled-cycles-frontend # 38.51% frontend cycles idle [83.34%] 550,463,187,942 stalled-cycles-backend # 9.84% backend cycles idle [66.68%] 10,480,382,952,859 instructions # 1.87 insns per cycle # 0.21 stalled cycles per insn [83.34%] 2,473,668,996,377 branches # 1384.825 M/sec [83.31%] 24,697,103,636 branch-misses # 1.00% of all branches [83.34%] 1785.662685113 seconds time elapsed Code: # perf stat ./reworked_129 17 Performance counter stats for './reworked_129': 707960.713577 task-clock (msec) # 1.000 CPUs utilized 1,622 context-switches # 0.002 K/sec 3 cpu-migrations # 0.000 K/sec 98 page-faults # 0.000 K/sec 2,212,800,549,865 cycles # 3.126 GHz [83.34%] 922,318,587,393 stalled-cycles-frontend # 41.68% frontend cycles idle [83.34%] 325,403,542,656 stalled-cycles-backend # 14.71% backend cycles idle [66.68%] 4,423,565,094,776 instructions # 2.00 insns per cycle # 0.21 stalled cycles per insn [83.34%] 915,235,112,899 branches # 1292.777 M/sec [83.30%] 15,808,946,453 branch-misses # 1.73% of all branches [83.34%] 707.691934200 seconds time elapsed ![]() Cheers |
|||
![]() |
|
redsock 20 Apr 2016, 22:13
bitRAKE: That is cool, thanks for sharing
|
|||
![]() |
|
Tyler 20 Apr 2016, 22:28
Damn, that's crazy. Are there any guiding principles that helped you do that or just permuting the code and timing it?
|
|||
![]() |
|
Tyler 20 Apr 2016, 22:32
Oh, wait, you removed the std::function stuff. I bet that was a massive part of the speedup. I did know that would help. I just chose not to do it.
What I'm more interested in is how you knew to rewrite the loops like that. One of my professors, who did compiler optimization for his dissertation, says gotos are horrible for optimization because it ruins invariants. What the principle behind how you use them and avoid this? |
|||
![]() |
|
redsock 20 Apr 2016, 22:53
![]()
- are there obvious programmer mistakes in any loop constructs? - can it be reduced? - does sign matter? Code: for(int i = 0;i < len;i++){ //cout << "Comparing with " << nodes[chain[i]] << "." << endl; if(i == node || !adj(subgraph[i], node)) { return false; } } return true; Code: if (node < len) return 0; I didn't spend a great deal of time or anything, just reading and "recompiling" your C++ into C++ ![]() Re: gotos in code, in my experience, any loop construct ultimately ends up in either a conditional or direct jump. In this case, the target of the goto is also the target of a loop entry, so does not affect the outcome whatsoever. Small-ish switch/case statements end up in the same basket and gotos don't affect them either IMO. $0.02 thusly ![]() |
|||
![]() |
|
revolution 21 Apr 2016, 01:44
I still haven't figured out why so many people believe that gotos are "evil" or "horrible" or <some other bad thing>. IMO there is nothing wrong with gotos, not everything fits neatly into if/else/end structures.
And besides, "case" is a just a goto in disguise so FU whoever it was that first claimed gotos are evil ![]() |
|||
![]() |
|
Tyler 21 Apr 2016, 02:38
Their great for faking exception handling in C (and apparently also good for hand optimizing), and he does admit that they're useful in some cases, but they also eliminate the possibility for the compiler to know things it otherwise would have known thus eliminating optimizations the compiler otherwise would have exploited. (Yeah, I do see the irony here that redsock beat the compiler with goto's. He out compiler'ed the compiler.) Generally I would agree with you, but this (compiler optimization) is this professor's thing. I actually argued your point with him and got the concession they can be useful in some cases, but that they should be avoided unless strictly necessary. And that's reasonable. Let the compiler handle the optimization unless you have a really hot codepath. The "gotos are always and absolutely evil" is an overly strict application of a solid general rule with few exceptions.
revolution wrote: And besides, "case" is a just a goto in disguise so FU whoever it was that first claimed gotos are evil ![]() http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html |
|||
![]() |
|
Goto page Previous 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.