Multidimensional Arrays

Don Clugston dac at nospam.com.au
Sun Sep 10 10:52:23 PDT 2006


Oskar Linde wrote:
> I have been implementing a strided multidimensional array type and am 
> interested in comments.

[snip]

This looks really promising -- that improved IFTI support in the last 
release has clearly opened a lot of possibilities. For now, I'll just 
comment on one thing.

> Future extensions would be writing Matrix types, and possibly hook them 
> up with a BLAS library. Anyone know if there exists BLAS implementations 
> that supports 80-bit reals?

This is a really interesting issue. Personally I don't of any 
implementations, but I haven't really looked. My first reaction was, 
"you'd always be using doubles or floats in matrices, so you'd use 
SIMD". But even with 64-bit matrices, 80-bit temporary results can still 
be useful, especially for operations on the diagonal elements of 
matrices. Basically, all vectors parameters would still be 64-bit 
doubles, but scalar parameters and returned results would be 80-bit.

And then I got thinking -- it's not clear to me that SIMD would be very 
beneficial when dealing with strided matrices, unless you're extremely 
clever(and this is probably why the AMD BLAS libraries have hand-crafted 
ASM even for the BLAS3 functions, you'd don't get much benefit 
otherwise). Consequently, I strongly suspect that you'd always want to 
treat strided arrays differently from built-in arrays (ie, stride == 1).
I don't know to what extent expression templates could keep track of 
whether an array has a stride or not, but there'd be a massive 
performance boost if you could.

-Don



More information about the Digitalmars-d-announce mailing list