   SSE resources
  I began last week learning on my own, intel manuals in hand, the SSE instruction set (indeed, I've been working with the SSE2 128 bits extension of MMX).It's wonderful. I had an application with the option of doing some adjusts (contrast, brightness, saturation, chroma) in a bunch of YUV PAL (720x576) videos. With the c++ full optimized version, activating all the four adjusts was eating some 10-15% CPU power from my twin dual xeons (four cores) for each video.So, it was using like 40-60% of a single core for each video.Now, the SSE2 version (in which I haven't spent any time optimizing, I've just done enough to get it working) proccessing four videos at once is hard to meter; perhaps an 1% or 2% of the full CPU.Really. Awesome.However, the path has been long and steep. It's a radiccally new philosophy. So, my question: Can anyone recommend me some tutorials/examples/exercises/whatever to help me master the full MMX/SSE/SSE2/SSE3 instruction sets?   
  I've actually been doing the same thing over the past week. The bad news is, besides the Intel and AMD manuals, I haven't really found anything of use online.In fact, the only sites I found in any way useful at all are http://neilkemp.us/src/sse_tutorial/sse_tutorial.html and http://www.tommesani.com/Docs.html, but you've likely out-grown what they have to offer.The only other thing I can think of is the MSDN docs on the SSE compiler intrinsics: MMX, SSE and SSE2, SSSE3 and Instruction Reference.If you find anything else, do let me know, I'm interested in learning more myself, especially SSE, SSE2 and SSE3 (since SSSE3 and SSE4 aren't supported by enough processors for my purposes).   ;  I don't know any other resources either, but I too recently embarked on really using simd stuff on some image processing/measuring routines.  The speedups were phenominal here as well.  One major thing that I *didn't* find any where else besides just "hmm it'd be nice if they had an instruction for this" was the equivalent of the microsoft intrinsic _mm_shuffle_epi8.  Combined with some masking the versions I have for thresholding a 24 bit rgb image using this instruction (which requires SSSE3) just destroys the one that uses only SSE2.  So, for 24 bit packed images, my threshold function (and possibly other ones in the future) will have 2 paths - 1 for SSE2 and 1 for SSSE3 if it's available (3 paths counting the reference path).  I say all this because you'll find many shuffle instructions in SSE and SSE2, but none for shuffling bytes :( so it's good to know there's one somewhere and it's well worth it sometimes if you're willing to add yet another code path.Other than that, the only way I've been able to learn was to first define my goal, and then break it down into optimized steps, and then see if there are instructions that are equivalent to my steps.  So we all seem to be in the same boat.  Anyway have fun!   ;  Thanks issch. Will take a look into those tutorials, just in case.I found this some time ago, but I think i've outgrown it without even reading it:http://www.mikekohn.net/stuff/image_processing.phpWhat a shame, such a wondrous technology and no easy way to learn about it.To be honest, what most of the instructions do is quite easy to grasp. What would be really interesting is a more general look about them: types of problems in which they are useful, how to do some common operations, code examples...About intrinsics... I don't really like them, I haven't even used them but seem to me like a lame substitute. You have to learn what most instructions do anyway, but don't have the fine control to squeeze the most of them (OK, compilers should be better than humans at this, although I've heard they really aren't regarding SSE). And they are really, really ugly...   ;Quote:Original post by popsoftheyearI don't know any other resources either, but I too recently embarked on really using simd stuff on some image processing/measuring routines.  The speedups were phenominal here as well.  One major thing that I *didn't* find any where else besides just "hmm it'd be nice if they had an instruction for this" was the equivalent of the microsoft intrinsic _mm_shuffle_epi8.  I'm a bit confused by your statement. http://msdn.microsoft.com/en-us/library/bb531427.aspxQuote:Microsoft SpecificEmits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction pshufb. This instruction shuffles 16-byte parameters from a 128-bit parameter.;  DScalar (an open source project) has lots of plugins for processing video that are written in a mix of SSE/MMX/3DNow/C++ etc they're reasonably well commented.They are how I got started using that stuff myself, so if you have a TV card then I thoroughly recommend it.   ;Optimizing for SSE: A case studyInsomniac R&D has a lot of PS3 SPU articles you may want to look at. SPUs are designed for SSE/VMX style instructions.   ;  check this :Software optimization resources by Agner;Quote:Original post by ravengangrelAbout intrinsics... I don't really like them, I haven't even used them but seem to me like a lame substitute. You have to learn what most instructions do anyway, but don't have the fine control to squeeze the most of them (OK, compilers should be better than humans at this, although I've heard they really aren't regarding SSE). And they are really, really ugly...The main point of intrinsics (not just for SSE) is that they let you write assembly without resorting to actually writing assembly ;)Interleaving asm and C/C++ code makes the compilers job a lot harder and retards the optimiser, meaning the overall code (the bits surrounding your asm) could be a bit more bloated. Intrinsics don't suffer from this problem.Also, MSVC has removed support for inline assembly in their x64 compiler, which makes intrinsics a lot more important ;)   ;Quote:Original post by HodgmanThe main point of intrinsics (not just for SSE) is that they let you write assembly without resorting to actually writing assembly ;)Interleaving asm and C/C++ code makes the compilers job a lot harder and retards the optimiser, meaning the overall code (the bits surrounding your asm) could be a bit more bloated. Intrinsics don't suffer from this problem.Also, MSVC has removed support for inline assembly in their x64 compiler, which makes intrinsics a lot more important ;)Thanks for the info, Hodgman.   