comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: Extend slices for n dimensional arrays for Ada 202X
Date: Thu, 26 Jan 2017 21:39:04 -0800 (PST)
Date: 2017-01-26T21:39:04-08:00	[thread overview]
Message-ID: <ee45c7d5-8655-48b6-806c-655f0d8993c2@googlegroups.com> (raw)
In-Reply-To: <fb3687c7-0a40-4f8e-abfc-0438a45d2374@googlegroups.com>

Whoops!  I apologize an editing error made this sound nasty...

On Thursday, January 26, 2017 at 8:54:53 PM UTC-5, Robert Eachus wrote:
> On Thursday, January 26, 2017 at 1:29:07 PM UTC-5, Randy Brukardt wrote:
> 
> > So I don't see this happening - it doesn't make sense in the context of Ada 
> > implementation strategies.
> 
> Randy, I hope you are confused.
...about how your compiler deals with copying complex objects.  About 30 years ago, Dave Emery found that the Verdix compiler was moving strings a byte at a time and wrote a (32-bit) word at a time routine (in Ada) which did all the messy misalignment stuff, and did go byte at a time for short strings.  Verdix asked permission to put the code in their run-time.  So Dave wrote it up--I don't remember if it was for Ada Letters or Ada Europe, but anyway made it public domain.  AS far as I knew all the Ada compilers picked it up, it about doubled Dhrystone scores. ;-)
  
It would be nice to have one-dimensional slices of two dimensional arrays.  But supporting Fortran interfaces messes that up, unless someone could figure out a way to make the situation work for the easy cases and illegal for the difficult cases.  I do have code which maps a series of vectors onto a matrix.  It is not too difficult, but tends to end up with theoretically non-portable code.  (You need to know the size of the descriptor at the start of an unconstrained array.  I suspect it is the same for all compilers for the normal cases, but no guarantee.

I guess you could use the same (Unchecked_Conversion) method to put (constrained) records on top of an array if you want to step through the columns.  But as I said above, on modern hardware it just pays too well to do the transpose.  You do the transpose several rows at a time, sized based on caches.  Figuring the 'right' size for a given machine takes work, best if you can do it is to read from multiple rows and put together one cache line in the output.


  reply	other threads:[~2017-01-27  5:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 13:29 REQ: Extend slices for n dimensional arrays for Ada 202X Lucretia
2017-01-26 14:01 ` Lucretia
2017-01-26 14:03   ` Lucretia
2017-01-26 14:52   ` Dmitry A. Kazakov
2017-01-27  9:19     ` Alejandro R. Mosteo
2017-01-27 14:04     ` Lucretia
2017-01-26 18:29 ` Randy Brukardt
2017-01-27  1:54   ` Robert Eachus
2017-01-27  5:39     ` Robert Eachus [this message]
2017-01-27 14:06     ` Lucretia
2017-01-27 23:30     ` Randy Brukardt
2017-01-28  0:58       ` Robert Eachus
2017-01-27  9:34   ` Dmitry A. Kazakov
2017-01-27 13:53     ` G.B.
2017-01-27 14:20       ` Dmitry A. Kazakov
2017-01-27 23:37       ` Randy Brukardt
2017-01-28  9:08         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox