Skip to content

Commit

Permalink
realm: clean up deppart instantiation stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
streichler committed Dec 22, 2018
1 parent fcbfb04 commit 62b24fd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 67 deletions.
1 change: 0 additions & 1 deletion runtime/realm/deppart/preimage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ namespace Realm {

template <int N, typename T>
template <int N2, typename T2>
__attribute__ ((noinline))
Event IndexSpace<N,T>::create_subspaces_by_preimage(const std::vector<FieldDataDescriptor<IndexSpace<N,T>,Rect<N2,T2> > >& field_data,
const std::vector<IndexSpace<N2,T2> >& targets,
std::vector<IndexSpace<N,T> >& preimages,
Expand Down
3 changes: 0 additions & 3 deletions runtime/realm/deppart/setops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ namespace Realm {


template <int N, typename T>
__attribute__ ((noinline))
/*static*/ Event IndexSpace<N,T>::compute_unions(const std::vector<IndexSpace<N,T> >& lhss,
const std::vector<IndexSpace<N,T> >& rhss,
std::vector<IndexSpace<N,T> >& results,
Expand Down Expand Up @@ -229,7 +228,6 @@ namespace Realm {
}

template <int N, typename T>
__attribute__ ((noinline))
/*static*/ Event IndexSpace<N,T>::compute_intersections(const std::vector<IndexSpace<N,T> >& lhss,
const std::vector<IndexSpace<N,T> >& rhss,
std::vector<IndexSpace<N,T> >& results,
Expand Down Expand Up @@ -299,7 +297,6 @@ namespace Realm {
}

template <int N, typename T>
__attribute__ ((noinline))
/*static*/ Event IndexSpace<N,T>::compute_differences(const std::vector<IndexSpace<N,T> >& lhss,
const std::vector<IndexSpace<N,T> >& rhss,
std::vector<IndexSpace<N,T> >& results,
Expand Down
65 changes: 2 additions & 63 deletions runtime/realm/deppart/sparsity_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ namespace Realm {

// call actual implementation - inlining makes this cheaper than a virtual method
template <int N, typename T>
__attribute__ ((noinline))
Event SparsityMapPublicImpl<N,T>::make_valid(bool precise /*= true*/)
{
return static_cast<SparsityMapImpl<N,T> *>(this)->make_valid(precise);
Expand Down Expand Up @@ -1011,70 +1010,10 @@ namespace Realm {
Message::request(target, args);
}


// instantiation stuff
namespace {

#define NT_INSTANTIATIONS(u, t) \
t((SparsityMapPublicImpl<N,T> *(SparsityMap<N,T>::*)(void) const),(&SparsityMap<N,T>::impl)) \
u((SparsityMapImpl<N,T>::lookup)) \
t((Event (SparsityMapPublicImpl<N,T>::*)(bool)),(&SparsityMapPublicImpl<N,T>::make_valid)) \
t((SparsityMap<N,T> (*)(const std::vector<Point<N,T> >&, bool)),(&SparsityMap<N,T>::construct)) \
t((SparsityMap<N,T> (*)(const std::vector<Rect<N,T> >&, bool)),(&SparsityMap<N,T>::construct)) \
t((bool (SparsityMapImpl<N,T>::*)(PartitioningMicroOp *, bool)),(&SparsityMapImpl<N,T>::add_waiter)) \
t((void (SparsityMapImpl<N,T>::*)(void)),(&SparsityMapImpl<N,T>::contribute_nothing))

struct UntypedWrapper {
template <typename T>
static UntypedWrapper *wrap(T val);
};

template <typename T>
struct TypedWrapper : public UntypedWrapper {
public:
TypedWrapper(T _val) : val(_val) {}
T val;
};

template <typename T>
UntypedWrapper *UntypedWrapper::wrap(T val)
{
return new TypedWrapper<T>(val);
}

class NT_Instantiator {
public:
template <int N, typename T>
static void demux2(int tag, std::vector<void *> *v)
{
#define UNWRAP(x) x
#define UNTYPED(x) v->push_back(UntypedWrapper::wrap(&x));
#define TYPED(t,x) v->push_back(UntypedWrapper::wrap(t x));
NT_INSTANTIATIONS(UNTYPED, TYPED);
}
template <typename NT, typename T>
static void demux(int tag, std::vector<void *> *v)
{
demux2<NT::N,T>(tag, v);
}
};

// use our dynamic template demux stuff to enumerate all possible
// combinations of template paramters
void instantiate_stuff(int tag, std::vector<void *> *v)
{
NT_TemplateHelper::demux<NT_Instantiator>(tag, tag, v);
//NTF_TemplateHelper::demux<NTF_Instantiator>(tag, tag, v);
//NTNT_TemplateHelper::demux<NTNT_Instantiator>(tag, tag, v);
}
};

//void (*dummy)(void) __attribute__((unused)) = &InstantiatePartitioningStuff<1,int>::inst_stuff;
void (*dummy)(int, std::vector<void *> *) __attribute__((weak, unused)) = &instantiate_stuff;

#define DOIT(N,T) \
template class SparsityMapPublicImpl<N,T>; \
template class SparsityMapImpl<N,T>;
template class SparsityMapImpl<N,T>; \
template class SparsityMap<N,T>;
FOREACH_NT(DOIT)

}; // namespace Realm

0 comments on commit 62b24fd

Please sign in to comment.