Skip to content
Jonathan Beard edited this page May 2, 2016 · 3 revisions

This isn't hugely exciting, however it is quite critical if you want to modify the current syntax to figure out where the overloads are, how they're organized and what each does.

Within the mapbase.hpp there is a link function with multiple linking options. Each of these takes a source and destination kernel along with a src or destination port or both. If no ports are given, then the source is assumed to have a single output and destination

The overloads themselves rely on these link functions. The overloads are located in the kpair.hpp and kpair.cpp files.

These definitions include the following:

kpair& operator >> ( raft::kernel &a,  raft::kernel &b  );
kpair& operator >> ( raft::kernel &&a, raft::kernel &&b );
kpair& operator >> ( kpair &a, raft::kernel &b );
kpair& operator >> ( kpair &a, raft::kernel &&b );

LOoOkpair& operator >> ( raft::kernel &a, const raft::order::spec &&order );
kpair&     operator >> ( LOoOkpair &a, raft::kernel &b );
kpair&     operator >> ( LOoOkpair &a, raft::kernel &&b );

ROoOkpair& operator >> ( kpair &a, const raft::order::spec &&order );
kpair&     operator >> ( ROoOkpair &a, raft::kernel &b );
kpair&     operator >> ( ROoOkpair &a, raft::kernel &&b );

kpair& operator <= ( raft::kernel &a, raft::kernel  &b );
kpair& operator <= ( raft::kernel &&a, raft::kernel &&b );
kpair& operator <= ( raft::kernel &a,  kpair &b );
kpair& operator <= ( raft::kernel &&a, kpair &b );

kpair& operator >= ( kpair &a, raft::kernel &b );
kpair& operator >= ( kpair &a, raft::kernel &&b );
kpair& operator >= ( kpair &a, kpair &b );

kpair& operator >= ( raft::kernel &a, kpair &b );
kpair& operator >= ( raft::kernel &&a, kpair &b );

Two object types that might not be immediately familiar are LOoOkpair and the ROoOkpair which are created when instantiated when a raft::order::out is seen in the input stream on the left side of a kernel or on the right hand side. The other operators are relative self explanatory.

Each of these overloads builds a linked list of the stream from left to right (essentially source to sink). This stream is actually processed once the assignment equals operator of the raft::map object is called from left to right. The place where that processing occurs is in the map.hpp file. The actual implementation is of course in the corresponding map.cpp file. The only non-trivial part to implement is the broadcast <= and join >= operators where kernels must be duplicated. The details of the implementations will be covered in detail within their respective sections.

Once each kernel is linked, nothing else is done until the exe() function is where the rest of the work happens. The implications of this is that allocations are lazy. There is nothing "real" to connect any of these compute kernels, i.e., no communication media yet.