www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16503] New: [ndslice] prevents fastmath LDC attribute

https://issues.dlang.org/show_bug.cgi?id=16503

          Issue ID: 16503
           Summary: [ndslice] prevents fastmath LDC attribute
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

Slice
{
  front
  opIndex
  ptr
  ...
}

auto sl1 = slice!double(...);
auto sl2 = slice!double(...);

 fastmath ... {
  // loop for strides == 1
    c += sl1.ptr[i] * sl2.ptr[i];
}

c's computation can not be fully optimized because Slice primitives has not
fastmath attribute.
In the same time this is safe TODO:

Slice
{
 fastmath:
  front
  opIndex
  ...
}

auto sl = slice!double(...);

... { // no fastmath
  // loop for strides == 1
    c += sl1.ptr[i] * sl2.ptr[i];
}

No optimisations in the last case.

So, we can just mark all ndslice except mapSlice as  fastmath :-)

--
Sep 16 2016