[Issue 16503] New: [ndslice] prevents fastmath LDC attribute

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 16 18:21:53 PDT 2016


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 at puremagic.com
          Reporter: ilyayaroshenko at 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 :-)

--


More information about the Digitalmars-d-bugs mailing list