Title: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 15, 2010, 03:52:09 PM 0.3.10 has tcatm's 4-way SSE2 as an option switch.
Use the switch "-4way" to turn it on. Without the switch you get Crypto++ ASM SHA-256. I could only get this working with Linux. Download: Get 0.3.10 from http://bitcointalk.org/index.php?topic=827.0 Please report back your CPU and results! I think it's pretty clear that Core 2 and lower are slower, i5 faster. I don't think we've heard any i7 results yet. We need to know about the different models of AMD or other less common CPUs. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: knightmb on August 15, 2010, 05:02:16 PM I did a quick test, will report back when I try it on more machines.
Pentium E5300 Dual-Core 2.6 GHz (2MB cache, FSB 800MHz) Processor info: http://en.wikipedia.org/wiki/Wolfdale_%28microprocessor%29 Stock = 2261 khash/s 4-way = 1103 khash/s (64 bit) Pentium 4 - 3.0GHz (hyper-threading off) 1MB Cache, FSB 800MHz Processor info: http://en.wikipedia.org/wiki/NetBurst_%28microarchitecture%29 Stock = 1024 khash/s (32 bit) 4-way = 658 khash/s (32 bit) Pentium 4 - 2.8GHz (hyper-threading off) 1MB Cache, FSB 800MHz Processor info: http://en.wikipedia.org/wiki/NetBurst_%28microarchitecture%29 Stock = 917 khash/s (64 bit) 4-way = 747 khash/s (64 bit) If I didn't know better, I would say the key is the CPU cache size. Seems all the CPU that run slower have 2 MB or less onboard cache, where as the Core i5 starts with at least 3MB of onboard CPU cache. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: satoshi on August 15, 2010, 06:23:26 PM I hope someone can test an i5 or AMD to check that I built it right. I don't have either to test with.
I'm also curious if it performs much worse on 32-bit linux vs 64-bit. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: sgtstein on August 15, 2010, 06:26:40 PM Where is the code for this? I'm on a CentOS 5.5 box and need to build it myself. Once I do that I will report back with linux 32-bit and 1MB cache Xeon.
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: satoshi on August 15, 2010, 06:43:27 PM I just uploaded a quick build so testers can check if I built it right. (I don't have an i5 or AMD) If it checks out, I'll put together the full package and do all the release stuff.
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: sgtstein on August 15, 2010, 06:46:25 PM Okay, makes sense. I have an i7 930 I'll try and test out with too.
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: tcatm on August 15, 2010, 09:50:41 PM If I didn't know better, I would say the key is the CPU cache size. Seems all the CPU that run slower have 2 MB or less onboard cache, where as the Core i5 starts with at least 3MB of onboard CPU cache. That's unlikely. The loop accesses 432 bytes of data. That should fit in most caches. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: Ground Loop on August 15, 2010, 11:49:40 PM 5,911 khash with -4way
11,260 without (Dual Xeon E5450, 64-bit, 8 threads) Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: tcatm on August 16, 2010, 12:03:18 AM -4way: 12518 khash/s
without: 6550 khash/s It's a little bit slower than my patch (~14000kash/s). edit: I ran the binary on an older AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ with the same effect we see on older intel cpus: -4way: 1120khash/s without: 2012khash/s Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: tcatm on August 16, 2010, 12:08:38 AM Did anyone verify it to produce correct results on 32 bit hosts?
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: gebler on August 16, 2010, 12:32:57 AM Running 32-bit Linux on an AMD Athlon 64 X2, I get the following results:
normal: 2850 khash/s with -4way: 1708 khash/s I haven't checked if the hashes are correct, just the speed. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: aceat64 on August 16, 2010, 12:37:54 AM I created a wiki page so we can keep track of the results: http://www.bitcoin.org/wiki/doku.php?id=4-way_sse2 (http://www.bitcoin.org/wiki/doku.php?id=4-way_sse2)
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: tcatm on August 16, 2010, 12:43:39 AM I propose to compile sha256.cpp with -O3 -march=amdfamk10 (will work on 32bit and 64bit) as only CPUs supporting this instruction set (AMD Phenom, Intel i5 and newer) benefit from -4way and it'll improve performance by ~9%.
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: HostFat on August 16, 2010, 12:47:23 AM I propose to compile sha256.cpp with -O3 -march=amdfamk10 (will work on 32bit and 64bit) as only CPUs supporting this instruction set (AMD Phenom, Intel i5 and newer) benefit from -4way and it'll improve performance by ~9%. Good :DWill this also work on Windows OS? Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: tcatm on August 16, 2010, 12:50:04 AM I propose to compile sha256.cpp with -O3 -march=amdfamk10 (will work on 32bit and 64bit) as only CPUs supporting this instruction set (AMD Phenom, Intel i5 and newer) benefit from -4way and it'll improve performance by ~9%. Good :DWill this also work on Windows OS? Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: NewLibertyStandard on August 16, 2010, 01:49:01 AM I created a wiki page so we can keep track of the results: http://www.bitcoin.org/wiki/doku.php?id=4-way_sse2 (http://www.bitcoin.org/wiki/doku.php?id=4-way_sse2) You might want to add columns for whether hyper-threading is enabled, number of physical cores and how many cores Bitcoin is using. Without 4way, I get very slightly better results when I have half of my virtual cores hashing. With 4way, I get significantly better performance when I have all my virtual cores enabled. I think I get about the same amount of hashes when hyper threading is turned off with or without 4way.Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: aceat64 on August 16, 2010, 02:13:28 AM I created a wiki page so we can keep track of the results: http://www.bitcoin.org/wiki/doku.php?id=4-way_sse2 (http://www.bitcoin.org/wiki/doku.php?id=4-way_sse2) You might want to add columns for whether hyper-threading is enabled, number of physical cores and how many cores Bitcoin is using. Without 4way, I get very slightly better results when I have half of my virtual cores hashing. With 4way, I get significantly better performance when I have all my virtual cores enabled. I think I get about the same amount of hashes when hyper threading is turned off with or without 4way.I've updated the page with your suggestions, I've also added footnotes to explain some of the fields. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: jgarzik on August 16, 2010, 02:30:52 AM My -4way results: slower for two older boxes, faster for newer one. ("model name" comes from Linux's /proc/cpuinfo, which reports directly from CPU) 1) model name : Intel(R) Pentium(R) D CPU 3.00GHz total cores: 2 without -4way: 0.999 Mhash/sec with -4way: 0.850 Mhash/sec 2) model name : Dual Core AMD Opteron(tm) Processor 280 total cores: 4 without -4way: 4.6 Mhash/sec with -4way: 4.0 Mhash/sec 3) model name : Genuine Intel(R) CPU 000 @ 3.20GHz total cores: 4 without -4way: 5.7 Mhash/sec with -4way: 7.0 Mhash/sec Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: satoshi on August 16, 2010, 02:57:57 AM I propose to compile sha256.cpp with -O3 -march=amdfamk10 (will work on 32bit and 64bit) as only CPUs supporting this instruction set (AMD Phenom, Intel i5 and newer) benefit from -4way and it'll improve performance by ~9%. GCC 4.3.3 doesn't support -march=amdfamk10. I get:sha256.cpp:1: error: bad value (amdfamk10) for -march= switch With 4way, I get significantly better performance when I have all my virtual cores enabled. I think I get about the same amount of hashes when hyper threading is turned off with or without 4way. Hey, you may be onto something!hyperthreading didn't help before because all the work was in the arithmetic and logic units, which the hyperthreads share. tcatm's SSE2 code must be a mix of normal x86 instructions and SSE2 instructions, so while one is doing x86 code, the other can do SSE2. How much of an improvement do you get with hyperthreading? Some numbers? What CPU is that? Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: lfm on August 16, 2010, 03:10:34 AM model name : AMD Phenom(tm) II X4 940 Processor at 3.0 ghz linux 64
with -4way "hashespersec" : 11132770 without "hashespersec" : 5877668 Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: gridecon on August 16, 2010, 03:15:44 AM I have two quadcore Phenom II 64-bit linux machines (ubuntu 9.10 both) and the -4way option increases my hashing speed so much I'm suspicious. I get about 5-6khash/sec on these boxes previously and without -4way option. With -4way I get over 11khash/sec! In other words, the -4way switch almost DOUBLES the reported hashing speed. This level of improvement seems more than expected and makes me wonder if my boxes are really doing the hashing that much faster or if there could possible be an issue where the math operations are actually being skipped over for some reason, causing illusory speed and an inability to actually generate blocks?
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: Vasiliev on August 16, 2010, 03:17:07 AM I propose to compile sha256.cpp with -O3 -march=amdfamk10 (will work on 32bit and 64bit) as only CPUs supporting this instruction set (AMD Phenom, Intel i5 and newer) benefit from -4way and it'll improve performance by ~9%. GCC 4.3.3 doesn't support -march=amdfamk10. I get:sha256.cpp:1: error: bad value (amdfamk10) for -march= switch Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit 0.3.9 rc2 Post by: satoshi on August 16, 2010, 03:23:04 AM try -march=amdfam10 That works.That's strange... are we sure that's the same thing? tcatm, try amdfam10 and make sure you get the same speed measurement. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Vasiliev on August 16, 2010, 03:27:35 AM http://www.google.com/search?q=amdfamk10
I think he misremembered it since AMD arches are K#. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: lfm on August 16, 2010, 03:30:35 AM model name : Intel(R) Core(TM)2 Quad CPU Q9450 @ 2.66GHz, linux 64
no difference at about 4950 khash/s Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: jgarzik on August 16, 2010, 03:35:28 AM Update for Code: cpu family : 6 Machine has 4 cores, each with 2 hyperthreads. /proc/cpuinfo shows 8 virtual processors. without -4way, setgen 4: 5.7 Mhash/sec without -4way, setgen 8: 5.0 Mhash/sec with -4way, setgen 4: 7.0 Mhash/sec with -4way, setgen 8: 9.3 Mhash/sec So, the old wisdom of "hyperthreading slows things down" is now shattered, on this machine. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on August 16, 2010, 04:34:20 AM No winners for 4way in my other three Intel machines either:
Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz (64-bit Linux) 4way: 1565 std: 3002 Intel(R) Xeon(TM) CPU 3.00GHz (32-bit Linux) 4way: 1243 std: 2048 Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz 4way: 932 std: 1733 (All running 0.3.10, -1 proclimit) Experiments with proclimit weren't any better. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 16, 2010, 04:36:59 AM Code: cpu family : 6 That's a 23% speedup with -4way, 63% total speedup with -4way + hyperthreading. 33% faster with hyperthreading than without it. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: NewLibertyStandard on August 16, 2010, 05:02:31 AM I have two quadcore Phenom II 64-bit linux machines (ubuntu 9.10 both) and the -4way option increases my hashing speed so much I'm suspicious. I get about 5-6khash/sec on these boxes previously and without -4way option. With -4way I get over 11khash/sec! In other words, the -4way switch almost DOUBLES the reported hashing speed. This level of improvement seems more than expected and makes me wonder if my boxes are really doing the hashing that much faster or if there could possible be an issue where the math operations are actually being skipped over for some reason, causing illusory speed and an inability to actually generate blocks? o_O... good luck hashing, you're gonna need it!With 4way, I get significantly better performance when I have all my virtual cores enabled. I think I get about the same amount of hashes when hyper threading is turned off with or without 4way. Hey, you may be onto something!hyperthreading didn't help before because all the work was in the arithmetic and logic units, which the hyperthreads share. tcatm's SSE2 code must be a mix of normal x86 instructions and SSE2 instructions, so while one is doing x86 code, the other can do SSE2. How much of an improvement do you get with hyperthreading? Some numbers? What CPU is that? Without 4way, with HT, 4/8 virtual cores, 4.5-5 Mhash/sec Without 4way, with HT, 8/8 virtual cores, a bit less than above, but basically the same With 4way, with HT, 8/8 virtual cores, 6.5-8 Mhash/sec (It may be my imagination, but it seems noticeably more variable.) With 4way, with HT, 4/8 virtual cores, 5-6 Mhash/sec Without 4way, without HT, 4/4 physical cores, 4.5-5 Mhas/sec (But a bit slower than the first result.) With 4way, without HT, 4/4 physical cores, 5-6 Mhash/sec Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: gridecon on August 16, 2010, 05:30:15 AM I have two quadcore Phenom II 64-bit linux machines (ubuntu 9.10 both) and the -4way option increases my hashing speed so much I'm suspicious. I get about 5-6khash/sec on these boxes previously and without -4way option. With -4way I get over 11khash/sec! In other words, the -4way switch almost DOUBLES the reported hashing speed. This level of improvement seems more than expected and makes me wonder if my boxes are really doing the hashing that much faster or if there could possible be an issue where the math operations are actually being skipped over for some reason, causing illusory speed and an inability to actually generate blocks? o_O... good luck hashing, you're gonna need it!Perhaps that typographical error is why nobody has answered whether or not a nearly 100% speeded from the -4way option is at all realistic? I'm not convinced the crypto hashing is really taking place at the rate of 11000khash/sec on my desktop box. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: jgarzik on August 16, 2010, 05:33:56 AM Code: cpu family : 6 That's a 23% speedup with -4way, 63% total speedup with -4way + hyperthreading. 33% faster with hyperthreading than without it. Does bitcoin perform any self-tests at startup, to verify that hashing is working? Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: NewLibertyStandard on August 16, 2010, 06:16:44 AM More importantly, about how long should it take 10 Mhash/sec to verify difficulty 1 blocks?
After the 64-bit Linux hashing bug was fixed I generated a block or two in short order, but since that one or two blocks, I have not generated a single block. It's starting to seem a little fishy. I'm currently testing Bitcoin on two Linux 64-bit computers. Is there anything in the code blocking early block verification? Edit: Never mind. I used the Bitcoin Generation Calculator (http://www.alloscomp.com/bitcoin/calculator.php) and divided out the difficulty. Everything is fine here, I've generated a couple blocks with 4way. About to start testing without 4way. Another Edit: My test only verifies that hashing works. It does not verify whether I'm really getting the displayed speed. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: tcatm on August 16, 2010, 11:15:04 AM @satoshi: Oops, I meant -march=amdfam10. Sorry.
@everyone confused about improvement on Phenoms: I developed the code on a Phenom (940) and verified it (at least in 64bit mode) and the improvement you see is real. Concerning Hyperthreading: It seems to give a little performance gain, maybe from running load/store instructions in parallel with aritmethic instructions. There's only a tiny bit of plain x86 instructions for glueing the function into the ABI. They take less than ~2% of the total CPU time (measured with gprof). Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: teknohog on August 16, 2010, 12:31:51 PM On a Core 2 Duo T7200, the default code gives about 1.8 Mhash/s, and 4way is slower at 1.0 Mhash/s. It has 4 MB of L2 cache, so it is probably not a question of cache size, as suggested at some point.
Unfortunately, the code (from svn) no longer compiles on ARM, as it now has SSE intrinsics hardcoded. I have removed the -msse2 and -DFOURWAYSSE2 flags from the makefile, and it still produces errors like this Code: sha256.cpp:8:23: error: xmmintrin.h: No such file or directory but hopefully this is easy to fix. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 16, 2010, 01:38:01 PM I wrapped sha256.cpp in
#ifdef FOURWAYSSE2 #endif // FOURWAYSSE2 try it now. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: tommy on August 16, 2010, 03:42:55 PM model name : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
w/o -4way "hashespersec" : 2539397 with -4way "hashespersec" : 2108791 Linux, Debian, 32 bit. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: teknohog on August 16, 2010, 04:41:31 PM I wrapped sha256.cpp in #ifdef FOURWAYSSE2 #endif // FOURWAYSSE2 try it now. Thanks, works fine now. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: hugolp on August 17, 2010, 06:26:27 PM Model: Intel Atom n330 (2 cores, 4 virtual).
OS: Ubuntu 10.04 64bit Using the -4way option I get half the speed than using no option. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: denaje on August 18, 2010, 07:06:04 PM 64-bit Gentoo / Intel Core i7
W/O 4way: 4324294 With 4way: 7649415 32-bit Ubuntu VM on XP host / Intel Core 2 Duo W/O 4way: 1751518 With 4way: 793100 Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on August 18, 2010, 11:00:08 PM So is it accurate to say that, so far, only Intel Core i7 processors and certain (Phenom?) AMD processors enjoy a speed bump from -4way?
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: nelisky on August 18, 2010, 11:02:25 PM So is it accurate to say that, so far, only Intel Core i7 processors and certain (Phenom?) AMD processors enjoy a speed bump from -4way? And i5, at least on my macbookpro Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on August 18, 2010, 11:14:26 PM Any non-Mac i5 love?
Windows i5 64-bit got slower here. [correction -- not true. Windows doesn't have -4way, and the Linux machines are Xeons.] Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: vess on August 19, 2010, 06:41:27 AM My Core i5 laptop (Ubuntu) doubled in speed. Actually, it didn't double in speed. It stayed the same speed, but only uses half the CPU now. I can't get it to go back to full CPU usage. That said, my laptop is a lot cooler when generating blocks now. I'll post back if I see it successfully go up to 100% usage.
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 19, 2010, 07:07:43 PM Any non-Mac i5 love? That's the first I've heard anyone say i5 was slower. Everyone else has said 4way was faster on i5. Moreso with hyperthreading enabled.Windows i5 64-bit got slower here. And i5, at least on my macbookpro Good, so I take it that's a confirmation that it's working on Mac as well?Laszlo told me he did compile in the -4way stuff on Mac, so the -4way switch is also available to try on Mac. I don't think makefile.osx on SVN has it yet, just the built version. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: nelisky on August 19, 2010, 08:28:19 PM And i5, at least on my macbookpro Good, so I take it that's a confirmation that it's working on Mac as well?Laszlo told me he did compile in the -4way stuff on Mac, so the -4way switch is also available to try on Mac. I don't think makefile.osx on SVN has it yet, just the built version. Yep, it's working all right. The number I had posted were from an old svn revision patched with tcatm's changes, but today I compiled trunk and while I had to once again tweak the makefile, after I did it works great with the numbers matching what I experienced before. Changes I did for my system are below, and while some are cosmetic, like removing wx-config from making bitcoind, just to avoid the warnings if you don't have it installed, others are system specific, like the DEPS dir, and the fact I don't have 32bit libs which makes the link step fail if -arch i386 is there. The bsddb changes are, I believe, a typo. Includes and Libs point to db46, but then the object list for the linker states db48. Anyway, here's the diff for what got me going: Code: Index: makefile.osx Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: ArtForz on August 21, 2010, 04:56:31 PM The difference between new and older CPUs is pretty easy to explain.
Older microarchitectures have 64-bit mmx/sse execution units and split 128bit sse ops into 2 64bit microops. Newer archs have 128bit sse units.
nehalem = xeon 34xx/35xx/36xx/55xx/56xx/65xx/75xx, i3/i5/i7 Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 22, 2010, 11:21:50 PM Thanks for clearing that up. I read the link someone posted about AMD making that change around 2007, but I didn't know what the story was for Intel.
There's no hope for Core/Core2 then. They only have half the SSE2 hardware. Strange that Intel has 3 128bit units, but AMD with 2 128bit units is the faster one. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on August 23, 2010, 05:45:17 AM Intel Atom 230 @ 1.60GHz. Linux 32-bit.
(Acer Aspire Revo) Stock: 438 khash/sec (1 proc gives 354) 4way: 254 khash/sec So you can take this one off the powerhouse list. :) ;D Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: sgtstein on August 24, 2010, 05:31:08 PM Anybody catch the new AMD Bulldozer press release? If I understand correctly, it should be capable of processing 8 64bit hashes, per core, at the same time. Would be quite a speed boost using this same code design.
Slashdot (http://hardware.slashdot.org/story/10/08/24/1521203/AMD-Details-Upcoming-Bulldozer-Architecture) has the article. PC Perspective (http://www.pcper.com/article.php?aid=985&type=expert) has the details. Was also covered by AnandTech (http://www.anandtech.com/show/2872) back in November, 2009. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 24, 2010, 10:43:56 PM
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: tcatm on August 28, 2010, 12:27:08 AM I just reviewed the sourcecode as I had a few ideas to optimize it further and I noticed that 4way is partly broken:
from main.cpp: Code: for (int j = 0; j < NPAR; j++) The code will only process one hash (the last with thash[7] == 0) out of 32 hashes even when there is more than one hash that might be a correct one. Somethine like this should fix it but it won't be safe at higher difficulties. Also, I'm not sure whether the byte order should be reversed or not. Could someone review this? Code: unsigned int min_hash = ~1; Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: satoshi on August 28, 2010, 02:27:15 PM The simplification is intentional. There will only be more than one thash[7]=0 in one out of 134,217,728 cases. It only makes it 0.0000007% slower.
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Gespenster on August 29, 2010, 11:11:32 AM @sgtstein: Intel's Sandy Bridge (to be released Q4 2010) will also support AVX 256-bit SIMD registers. That means 8 simultaneous hash calculations/thread would be possible, in principle.
Does anybody has any reports on 4-way SSE2 on the Pentium D (Presler)? What kind of performance can I expect? I have an old Pentium D+mobo laying around and I would fire it up as a mining server if performance would be ok. Probably won't be the most efficient khash/Watt though. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: lfm on August 29, 2010, 04:55:41 PM Does anybody has any reports on 4-way SSE2 on the Pentium D (Presler)? What kind of performance can I expect? I have an old Pentium D+mobo laying around and I would fire it up as a mining server if performance would be ok. Probably won't be the most efficient khash/Watt though. My Pentium-D died but it was generally just two P4s in one package and probably will do bitcoin like that. Yes it was terribly power hungry. The 4way code doesn't do very well on P4s in general. I only get about 900 khash/s on a 3.4ghz P4 without -4way. With -4way its in the 600s. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on August 31, 2010, 12:48:33 AM Seriously? Got free electricity?
At Difficulty 623, I've shut down anything under 3000 khash/sec. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: lfm on September 01, 2010, 05:23:26 PM Seriously? Got free electricity? At Difficulty 623, I've shut down anything under 3000 khash/sec. I don't have free electricity but I am running a number of electric heaters that look like computers. The bits produced are a by-product. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on September 16, 2010, 07:08:19 PM 4way pays off on one of the HP blade machines..
It's a 12-core Intel(R) Xeon(R) CPU X5650 @ 2.67GHz Running 24 threads with 4way, I get 22,569 khash/sec. Yow. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: LZ on September 16, 2010, 08:20:19 PM Cool! This means that the processor in practice can catch up with the video card!
Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: Ground Loop on September 16, 2010, 09:24:30 PM It's still not cost effective.
These are HP BL460c blades.. around $6k each. That buys a lot of fresh CUDA! It's a fun way to do "burn in", but not a smart use of resources. 12 hyperthreading Xeon cores, though.. each. 22,500 khash/sec with -4way, and only 13,400 without, so yeah, it's not subtle. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: BeeCee1 on January 21, 2011, 02:11:10 AM I made a couple of changes to the sse2 source that sped it up about 5 or 6%:
I changed: #define add4(x0, x1, x2, x3) _mm_add_epi32(_mm_add_epi32(_mm_add_epi32(x0, x1), x2), x3) to #define add4(x0, x1, x2, x3) _mm_add_epi32(_mm_add_epi32(x0, x1),_mm_add_epi32( x2,x3)) It is just re-ordering the adds. There is a data dependency, each one depends on the result of the one before, the way I reordered it two of the adds are independent. This function is called a lot of times so that little change can add up. (On an older machine it made no difference so YMMV) A portion of the nonce calculation is repeated over and over, even though the result is the same. I moved nonce = _mm_set1_epi32(In[3]); nonce = _mm_add_epi32(nonce, offset); out of the "for(k = 0; k<NPAR; k+=4) {" Here's a diff 153c153 > __m128i nonce,preNonce; --- < __m128i nonce; 157d156 > preNonce = _mm_add_epi32(_mm_set1_epi32(In[3]),offset); 179,182c178,180 > //nonce = _mm_set1_epi32(In[3]); > //nonce = _mm_add_epi32(nonce, offset); > //nonce = _mm_add_epi32(nonce, _mm_set1_epi32(k)); > nonce = _mm_add_epi32(preNonce,_mm_set1_epi32(k)); --- < nonce = _mm_set1_epi32(In[3]); < nonce = _mm_add_epi32(nonce, offset); < nonce = _mm_add_epi32(nonce, _mm_set1_epi32(k)); I have been running this for a couple of days on the mining pool and have generated shares. Title: Re: tcatm's 4-way SSE2 for Linux 32/64-bit is in 0.3.10 Post by: jwalck on January 22, 2011, 11:23:16 AM I made a couple of changes to the sse2 source that sped it up about 5 or 6%: Nice find of data dependencies! Get about the same increase here on my AMD Opteron 6128 server. From ~32.4M to ~34.2M with all 16 cores. Too bad it will have plenty of other things to do soon. ;) |