From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7767a311e01e1cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!multikabel.net!feed20.multikabel.net!news2.euro.net!62.253.162.218.MISMATCH!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe6-win.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: GNAT compiler switches and optimization User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada References: <1161341264.471057.252750@h48g2000cwc.googlegroups.com> <9Qb_g.111857$aJ.65708@attbi_s21> <434o04-7g7.ln1@newserver.thecreems.com> <4539ce34$1_2@news.bluewin.ch> <453A532F.2070709@obry.net> <9kfq04-sgm.ln1@newserver.thecreems.com> <5vgs04-64f.ln1@newserver.thecreems.com> <453bc74e$0$19614$426a74cc@news.free.fr> <1161611520.6582.4.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Mon, 23 Oct 2006 17:57:01 GMT NNTP-Posting-Host: 82.10.238.153 X-Trace: newsfe6-win.ntli.net 1161626221 82.10.238.153 (Mon, 23 Oct 2006 18:57:01 BST) NNTP-Posting-Date: Mon, 23 Oct 2006 18:57:01 BST Organization: NTL Xref: g2news2.google.com comp.lang.ada:7171 Date: 2006-10-23T17:57:01+00:00 List-Id: On Mon, 23 Oct 2006 19:11:51 +0200, Warner BRUNS wrote: > Georg Bauhaus wrote: >> On Mon, 2006-10-23 at 14:40 +0200, Warner BRUNS wrote: >> >>> A problem with Ada is that the memory layout of multidimensional arrays >>> is not specified in the standard. If you want to have the same memory >>> layout for all Ada compilers, you have to specify that a multimensional >>> array should follow the convention of a foreign language, eg. Fortran. >> >> Will a memory layout cast in source really help with e.g. all >> Ada X Fortran combinations of compilers and libraries? >> It might disallow "knowledgeable" compilers to choose a layout >> that suits the current setup, I'd think, and require touching >> the sources. >> >> -- Georg >> > It will help with all Ada/ Fortran Compiler combinations, > but the really strange thing is that the memory layout is not > definitely known from the Ada source alone, if it is not specified > as being the layout as required by a different language, eg. Fortran. > If one wants to code a cache aware algorithm for eg. multiplying > matrices, one cannot do this in Ada without enforcing the memory > layout of the matrices via PRAGMA CONVENTION. A agree that it seems like an omission from the Ada standard. This specification should be available using a representation clause. Telling the compiler to allocate it like Fortran would is the wrong way, logically. Of course, if it really mattered, you could use an array of arrays (like in C), or an array of array accesses. With appropriate use of pragma representation you have a very high degree of flexibility. Compare this to almost any other language, and you find Ada leads the field by a mile. What if you wanted an alternative layout in Fortran? Or C++? Sometimes I'd like to see some intermingling of row/column ordering, so a page in memory holds a square sub-array of a 2-D array. The approach I'll take (if I get around to it!) is to use a 2-D array of acceses, allocated (by a pool allocator) with the desired pattern. Moral of the story: One Size does not Fit All... -- Adrian