digitalmars.D - Saturating integer arithmetic
- Manu via Digitalmars-d (17/17) Jun 26 2016 Hi people. I've been working on this colour library when I have free
- Andrei Alexandrescu (6/23) Jun 26 2016 See the recent thread "DbI checked integral". Saturation is a direct
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (3/24) Jun 26 2016 No, saturated operations are typically SIMD instructions.
- ketmar (5/8) Jun 26 2016 alas, it is completely inappropriate for any computation-heavy
- Andrei Alexandrescu (3/9) Jun 26 2016 What is some good literature to look at for SIMD saturation arithmetic?
- ketmar (4/6) Jun 26 2016 sorry, i don't know. for me it was intel cpu manuals. certainly
- John Colvin (3/18) Jun 26 2016 http://www.intel.co.uk/content/dam/www/public/us/en/documents/manuals/64...
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (3/18) Jun 26 2016 https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=adds_...
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (4/5) Jun 26 2016 Or in the context of 8 bit colour vectors:
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (6/11) Jun 26 2016 Turns out a careful selected search for "saturat" gives you a
Hi people. I've been working on this colour library when I have free time (almost never!), and I want to work on blending/filtering functions, but that work is kinda blocked by saturating arithmetic logic. I started working on a saturating integer library a few times, but it's much a much bigger job than it appears, and I haven't had enough time for it. (Efficient) implementation tends to be significantly different for every int width and signed/unsigned. I see no use for an inefficient implementation used by a colour library; images tend to be millions of pixels, and inefficiency very quickly adds up. I wonder if anyone has an interest in the area and wants to have a go at it? It's a pretty big job. It should support scalars, packed vectors (ie, 4 bytes in an int), and SIMD vectors (wider vectors using hardware simd ops). Each step can gain considerable efficiency for the vector width. It's hard to write a useful colour blending library without the full set of these available.
Jun 26 2016
On 6/26/16 9:47 AM, Manu via Digitalmars-d wrote:Hi people. I've been working on this colour library when I have free time (almost never!), and I want to work on blending/filtering functions, but that work is kinda blocked by saturating arithmetic logic. I started working on a saturating integer library a few times, but it's much a much bigger job than it appears, and I haven't had enough time for it. (Efficient) implementation tends to be significantly different for every int width and signed/unsigned. I see no use for an inefficient implementation used by a colour library; images tend to be millions of pixels, and inefficiency very quickly adds up.See the recent thread "DbI checked integral". Saturation is a direct goal, and you should be able to optimize operations for each type by defining relatively small hooks.I wonder if anyone has an interest in the area and wants to have a go at it? It's a pretty big job. It should support scalars, packed vectors (ie, 4 bytes in an int), and SIMD vectors (wider vectors using hardware simd ops). Each step can gain considerable efficiency for the vector width. It's hard to write a useful colour blending library without the full set of these available.What primitives would the vectors implement? Andrei
Jun 26 2016
On Sunday, 26 June 2016 at 13:59:03 UTC, Andrei Alexandrescu wrote:On 6/26/16 9:47 AM, Manu via Digitalmars-d wrote:No, saturated operations are typically SIMD instructions.Hi people. I've been working on this colour library when I have free time (almost never!), and I want to work on blending/filtering functions, but that work is kinda blocked by saturating arithmetic logic. I started working on a saturating integer library a few times, but it's much a much bigger job than it appears, and I haven't had enough time for it. (Efficient) implementation tends to be significantly different for every int width and signed/unsigned. I see no use for an inefficient implementation used by a colour library; images tend to be millions of pixels, and inefficiency very quickly adds up.See the recent thread "DbI checked integral". Saturation is a direct goal, and you should be able to optimize operations for each type by defining relatively small hooks.
Jun 26 2016
On Sunday, 26 June 2016 at 13:59:03 UTC, Andrei Alexandrescu wrote:See the recent thread "DbI checked integral". Saturation is a direct goal, and you should be able to optimize operations for each type by defining relatively small hooks.alas, it is completely inappropriate for any computation-heavy task. even if dmd inliner will do some miracle and will inline some calls.
Jun 26 2016
On 06/26/2016 02:07 PM, ketmar wrote:On Sunday, 26 June 2016 at 13:59:03 UTC, Andrei Alexandrescu wrote:What is some good literature to look at for SIMD saturation arithmetic? -- AndreiSee the recent thread "DbI checked integral". Saturation is a direct goal, and you should be able to optimize operations for each type by defining relatively small hooks.alas, it is completely inappropriate for any computation-heavy task. even if dmd inliner will do some miracle and will inline some calls.
Jun 26 2016
On Sunday, 26 June 2016 at 22:34:29 UTC, Andrei Alexandrescu wrote:What is some good literature to look at for SIMD saturation arithmetic? -- Andreisorry, i don't know. for me it was intel cpu manuals. certainly not even a good way to learn the things.
Jun 26 2016
On Sunday, 26 June 2016 at 22:34:29 UTC, Andrei Alexandrescu wrote:On 06/26/2016 02:07 PM, ketmar wrote:http://www.intel.co.uk/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-opt mization-manual.pdf has some stuff about saturation in it. I learned from that and the instruction reference.On Sunday, 26 June 2016 at 13:59:03 UTC, Andrei Alexandrescu wrote:What is some good literature to look at for SIMD saturation arithmetic? -- AndreiSee the recent thread "DbI checked integral". Saturation is a direct goal, and you should be able to optimize operations for each type by defining relatively small hooks.alas, it is completely inappropriate for any computation-heavy task. even if dmd inliner will do some miracle and will inline some calls.
Jun 26 2016
On Sunday, 26 June 2016 at 22:34:29 UTC, Andrei Alexandrescu wrote:On 06/26/2016 02:07 PM, ketmar wrote:https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=adds_epiOn Sunday, 26 June 2016 at 13:59:03 UTC, Andrei Alexandrescu wrote:What is some good literature to look at for SIMD saturation arithmetic? -- AndreiSee the recent thread "DbI checked integral". Saturation is a direct goal, and you should be able to optimize operations for each type by defining relatively small hooks.alas, it is completely inappropriate for any computation-heavy task. even if dmd inliner will do some miracle and will inline some calls.
Jun 26 2016
On Monday, 27 June 2016 at 04:23:10 UTC, Ola Fosheim Grøstad wrote:https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=adds_epiOr in the context of 8 bit colour vectors: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=adds_epu8
Jun 26 2016
On Monday, 27 June 2016 at 04:25:56 UTC, Ola Fosheim Grøstad wrote:On Monday, 27 June 2016 at 04:23:10 UTC, Ola Fosheim Grøstad wrote:Turns out a careful selected search for "saturat" gives you a near complete overview over the standard intrinsics with saturation: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=saturathttps://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=adds_epiOr in the context of 8 bit colour vectors: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=adds_epu8
Jun 26 2016