Hi -
On 6/17/16, 7:38 PM, "Mike Noakes" <[email protected]> wrote:
>Assuming that I have understood your proposal, I find this concept
>intriguing in the abstract. Unfortunately I think that you are
>considering
>a notion that is beyond the current design of Chapel. It is, of course,
>possible that someone else in the community will propose an approach
>that I am overlooking.
I think that an Array of Structures to Structure of Arrays
transformation is an interesting idea. As Mike was pointing out,
it would require answering some questions and solving some
problems to get there.
I hope that nobody interpreted Mike's comment as "It can't be done".
In an abstract sense, the Chapel compiler can do program transformations
like this one, with enough effort. Nonetheless I agree with Mike that
we have to solve some problems to get to transforming AoS to SoA.
I think that we have a notion that a layout/domain map could cause arrays
of records or tuples to be stored in Array of Structures or Structure
of Arrays format. That means we have an idea:
* The domain map interface could be part of transforming AoS into SoA.
However there are some missing pieces:
* Who decides whether it is SoA or AoS? The user, the
compiler, or some runtime element?
* For the SoA case, what will the domain map return as
the type of an intermediate expression? This is the problem
Mike was getting at. E.g.
MyArray[i].x
has 2 parts: the array access and then the field access.
You might imagine that within the compiler it translates to:
var tmp = MyArray[i];
tmp.x
Unless the compiler directly addresses the AoS -> SoA transformation,
the array access has to be done first. If I were doing this in C++,
I'd probably make an intermediate "pointer type" that MyArray[i]
returns that only does the access in this case when you access
the member. I think such an approach ought to be possible
in Chapel but I'm pretty sure there are some missing pieces.
(What are the missing pieces? I'm almost certain user-defined
coercion would be necessary - which is something I have
partial work on but hasn't risen to the top of the work list).
* When is this kind of SoA vs AoS layout change important?
How much performance potential is there to be gained by
the optimization? What kinds of programs benefit?
In some ways the last question is the most important to motivate
further work on this topic.
Cheers,
-michael
>As you know, domain maps are intended to allow a relatively advanced
>user to define how the indices of a domain and the elements of an array
>map to storage locations in memory. The Chapel implementation provides
>a number of useful domains maps.
>
>
>As you indicate this means that a user could, for example, implement
>a domain map that causes array elements to be stored in row major
>order rather than the default column major order.
>
>
>However accessing the field of a record that is an element of an array
>requires two levels of addressing that Chapel considers to be distinct.
>
>
>
>
>I think one could imagine developing a language feature that allows Chapel
>to transform an array of structures to be a structure of arrays.
>However, if I
>understand correctly, you are imagining a more general language feature
>that generates this behavior as one of its use cases. Is that right?
>I wonder if you have a path in mind?
>
>
>With thanks and regards,
>
>
>Mike
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>On Jun 15, 2016, at 11:20 AM, John Hall <[email protected]>
>wrote:
>
>It appears I forgot to reply all to my original reply...
>
>
>After looking over the documentation a bit more thoroughly, I think that
>what I'm referring to is closer to the layout in the Domain Map section,
>rather than putting things on different locales. For instance, there is
>the discussion about being able to customize
> things so that an array is row major instead of column major, but I
>don't see any description of how to do that.
>
>
>With respect to AoS vs. SoA, I was thinking about customizing the layout
>of the struct/record using a domain map. For instance, the code prints an
>array of structs in Chapel. It's possible to manually adjust the AoS so
>that it is a SoA. However,
> it would be interesting if I could provide a layout/domain/domain map
>that accomplishes this without needing to adjust Foo itself and instead
>could just provide an alternate D.
>
>record Foo {
> var bar: int;
> var baz: int;
>}
>
>proc main() {
> var n: int = 2;
> var D: domain(1) = {1..n};
> var foo: [D] Foo;
>
> writeln(foo);
>}
>
>
>On Tue, Jun 14, 2016 at 1:26 PM, Elliot Ronaghan
><[email protected]> wrote:
>
>Hi John,
>
>I'm not entirely sure what you're asking WRT to domains. Domains are a
>first-class language feature, and they are not exclusive to arrays. You
>can definitely use them as a field of a record. I think I'm missing the
>relation to AoS vs. SoA though. Can you say more about how you want to
>use domains?
>
>As far as the cygwin issue: We test cygwin nightly, and that's not a
>familiar issue. I would try doing a `make clobber` in $CHPL_HOME and
>then rebuilding. My best guess is that you might have tried to build
>without all the dependencies and when you did install them the tree was
>left in a weird state?
>
>If that doesn't fix it, can you send me the output of `uname -a` as well
>as `gcc --version`? (You can send that to me off-list since it probably
>won't be of much use/interest to others.)
>
>Elliot
>
>>I was curious if domains only worked for arrays or if they can also be
>>used for records. Some people find it an inconvenience to change an
>>array of structs to a struct of arrays. I was thinking that the
>>equivalent array of records to record of arrays might
>> be more easily accomplished using domains.
>>
>>
>>I was going to test this myself, but I had issues installing with
>>Cygwin. At first I just realized that I hadn't installed all the
>>dependencies, but I found the doc for Cygwin and think I installed them
>>all. The last time I ran make, the tail of the output
>> is below. I see a bunch of these undefined reference to ___ lines.
>>
>>./util/gen/cygwin64.gnu.wide-struct.llvm-none/misc.o:misc.cpp:(.text+0xe5
>>f): undefined reference to `Symbol::hasFlag(Flag) const'
>>./util/gen/cygwin64.gnu.wide-struct.llvm-none/misc.o:misc.cpp:(.text+0x11
>>13): undefined reference to `FnSymbol::isIterator() const'
>>./util/gen/cygwin64.gnu.wide-struct.llvm-none/misc.o:misc.cpp:(.rdata$.re
>>fptr.currentAstLoc[.refptr.currentAstLoc]+0x0): undefined reference to
>>`currentAstLoc'
>>collect2: error: ld returned 1 exit status
>>make[2]: *** [Makefile:128:
>>/cygdrive/c/chapel/chapel-1.13.0/chapel-1.13.0/bin/cygwin64/chpl.exe]
>>Error 1
>>make[1]: *** [Makefile:65: compiler] Error 2
>>make: *** [Makefile:57: comprt] Error 2
>>
>>
>
>
>
>
>
>
>
>
>
>--------------------------------------------------------------------------
>----
>What NetFlow Analyzer can do for you? Monitors network bandwidth and
>traffic
>patterns at an interface-level. Reveals which users, apps, and protocols
>are
>consuming the most bandwidth. Provides multi-vendor support for NetFlow,
>J-Flow, sFlow and other flows. Make informed decisions using capacity
>planning
>reports.
>http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381_____
>__________________________________________
><http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381____
>___________________________________________>
>Chapel-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/chapel-users
>
>
>
>
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users