Skip to content

Commit

Permalink
legion: merging dma into deppart and resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsighter committed Aug 31, 2017
2 parents bd3389f + 0fc1084 commit 12cc9a5
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ env:
- WARN_AS_ERROR=1
- MAKEFLAGS="-s"
- REALM_SYNTHETIC_CORE_MAP=""
- REALM_BACKTRACE=1
- TEST_FUZZER=0
matrix:
- CC_FLAGS="-std=c++98" DEBUG=0 USE_CMAKE=1 TEST_REGENT=0
- CC_FLAGS="-std=c++98" DEBUG=0 TEST_LEGION_CXX=0 TEST_REALM=0
- CC_FLAGS="-std=c++98 -DPRIVILEGE_CHECKS -DBOUNDS_CHECKS" DEBUG=1 TEST_REGENT=0
- CC_FLAGS="-std=c++98 -DLEGION_SPY" DEBUG=1 USE_SPY=1 TEST_LEGION_CXX=0 TEST_REALM=0
- CC_FLAGS="-std=c++98" USE_GASNET=1 USE_HDF=1 USE_CMAKE=1 TEST_REGENT=0
- CC_FLAGS="-std=c++11" DEBUG=0 TEST_REGENT=0
matrix:
exclude:
Expand Down Expand Up @@ -48,6 +50,7 @@ before_install:
brew install pypy llvm@3.9 homebrew/science/hdf5
export CLANG="$(brew --prefix)/opt/llvm@3.9/bin/clang"
export LLVM_CONFIG="$(brew --prefix)/opt/llvm@3.9/bin/llvm-config"
export CXX="$(brew --prefix)/opt/llvm@3.9/bin/clang++"
fi
- if [[ "$(uname)" = "Linux" && "$CXX" = "g++" ]]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
- if [[ "$(uname)" = "Linux" && "$CXX" = "clang++" ]]; then export CXX="clang++-3.5" CC="clang-3.5"; fi
Expand Down
12 changes: 8 additions & 4 deletions runtime/legion/legion_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4850,8 +4850,10 @@ namespace Legion {
// Record that we are mapped when all our points are mapped
// and we are executed when all our points are executed
complete_mapping(Runtime::merge_events(mapped_preconditions));
complete_execution(Runtime::protect_event(
Runtime::merge_events(executed_preconditions)));
ApEvent done = Runtime::merge_events(executed_preconditions);
Runtime::trigger_event(completion_event, done);
need_completion_trigger = false;
complete_execution(Runtime::protect_event(done));
}

//--------------------------------------------------------------------------
Expand Down Expand Up @@ -13292,8 +13294,10 @@ namespace Legion {
// Record that we are mapped when all our points are mapped
// and we are executed when all our points are executed
complete_mapping(Runtime::merge_events(mapped_preconditions));
complete_execution(Runtime::protect_event(
Runtime::merge_events(executed_preconditions)));
ApEvent done = Runtime::merge_events(executed_preconditions);
Runtime::trigger_event(completion_event, done);
need_completion_trigger = false;
complete_execution(Runtime::protect_event(done));
}

//--------------------------------------------------------------------------
Expand Down
67 changes: 41 additions & 26 deletions runtime/legion/legion_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3841,24 +3841,17 @@ namespace Legion {
profiling_reported = Runtime::create_rt_user_event();
}
}
#ifdef LEGION_SPY
if (Runtime::legion_spy_enabled)
{
LegionSpy::log_variant_decision(unique_op_id, selected_variant);
LegionSpy::log_operation_events(unique_op_id, start_condition,
completion_event);
LegionSpy::log_task_priority(unique_op_id, task_priority);
for (unsigned idx = 0; idx < futures.size(); idx++)
{
FutureImpl *impl = futures[idx].impl;
if (impl->get_ready_event().exists())
LegionSpy::log_future_use(unique_op_id, impl->get_ready_event());
}
}
#else
if (Runtime::legion_spy_enabled)
{
LegionSpy::log_variant_decision(unique_op_id, selected_variant);
#ifdef LEGION_SPY
if (perform_chaining_optimization)
LegionSpy::log_operation_events(unique_op_id, start_condition,
chain_complete_event);
else
LegionSpy::log_operation_events(unique_op_id, start_condition,
get_task_completion());
#endif
LegionSpy::log_task_priority(unique_op_id, task_priority);
for (unsigned idx = 0; idx < futures.size(); idx++)
{
Expand All @@ -3867,7 +3860,6 @@ namespace Legion {
LegionSpy::log_future_use(unique_op_id, impl->get_ready_event());
}
}
#endif
ApEvent task_launch_event = variant->dispatch_task(launch_processor, this,
execution_context, start_condition, true_guard,
task_priority, profiling_requests);
Expand Down Expand Up @@ -6352,7 +6344,7 @@ namespace Legion {
// Remove our reference to the reduction future
reduction_future = Future();
map_applied_conditions.clear();
restrict_postconditions.clear();
completion_preconditions.clear();
#ifdef DEBUG_LEGION
interfering_requirements.clear();
assert(acquired_instances.empty());
Expand Down Expand Up @@ -6971,11 +6963,11 @@ namespace Legion {
future_map.impl->complete_all_futures();
if (must_epoch != NULL)
must_epoch->notify_subop_complete(this);
if (!restrict_postconditions.empty())
if (!completion_preconditions.empty())
{
ApEvent restrict_done = Runtime::merge_events(restrict_postconditions);
ApEvent done = Runtime::merge_events(completion_preconditions);
need_completion_trigger = false;
Runtime::trigger_event(completion_event, restrict_done);
Runtime::trigger_event(completion_event, done);
}
complete_operation();
#ifdef LEGION_SPY
Expand Down Expand Up @@ -7213,7 +7205,7 @@ namespace Legion {
if (applied_condition.exists())
map_applied_conditions.insert(applied_condition);
if (restrict_post.exists())
restrict_postconditions.insert(restrict_post);
completion_preconditions.insert(restrict_post);
// Already know that mapped points is the same as total points
if (slice_fraction.is_whole())
{
Expand Down Expand Up @@ -7252,7 +7244,8 @@ namespace Legion {
}

//--------------------------------------------------------------------------
void IndexTask::return_slice_complete(unsigned points)
void IndexTask::return_slice_complete(unsigned points,
ApEvent slice_postcondition)
//--------------------------------------------------------------------------
{
DETAILED_PROFILER(runtime, INDEX_RETURN_SLICE_COMPLETE_CALL);
Expand All @@ -7261,6 +7254,11 @@ namespace Legion {
{
AutoLock o_lock(op_lock);
complete_points += points;
// Always add it if we're doing legion spy validation
#ifndef LEGION_SPY
if (!slice_postcondition.has_triggered())
#endif
completion_preconditions.insert(slice_postcondition);
#ifdef DEBUG_LEGION
assert(!complete_received);
assert(complete_points <= total_points);
Expand Down Expand Up @@ -7359,6 +7357,8 @@ namespace Legion {
DerezCheck z(derez);
size_t points;
derez.deserialize(points);
ApEvent slice_postcondition;
derez.deserialize(slice_postcondition);
ResourceTracker::unpack_privilege_state(derez, parent_ctx);
if (redop != 0)
{
Expand Down Expand Up @@ -7387,7 +7387,7 @@ namespace Legion {
must_epoch->unpack_future(p, derez);
}
}
return_slice_complete(points);
return_slice_complete(points, slice_postcondition);
}

//--------------------------------------------------------------------------
Expand Down Expand Up @@ -8396,6 +8396,18 @@ namespace Legion {
//--------------------------------------------------------------------------
{
DETAILED_PROFILER(runtime, SLICE_COMPLETE_CALL);
// Compute the merge of all our point task completions
std::set<ApEvent> slice_postconditions;
for (unsigned idx = 0; idx < points.size(); idx++)
{
ApEvent point_completion = points[idx]->get_task_completion();
#ifndef LEGION_SPY
if (point_completion.has_triggered())
continue;
#endif
slice_postconditions.insert(point_completion);
}
ApEvent slice_postcondition = Runtime::merge_events(slice_postconditions);
// For remote cases we have to keep track of the events for
// returning any created logical state, we can't commit until
// it is returned or we might prematurely release the references
Expand All @@ -8404,12 +8416,13 @@ namespace Legion {
{
// Send back the message saying that this slice is complete
Serializer rez;
pack_remote_complete(rez);
pack_remote_complete(rez, slice_postcondition);
runtime->send_slice_remote_complete(orig_proc, rez);
}
else
{
index_owner->return_slice_complete(points.size());
std::set<ApEvent> slice_postconditions;
index_owner->return_slice_complete(points.size(), slice_postcondition);
}
complete_operation();
}
Expand Down Expand Up @@ -8478,7 +8491,8 @@ namespace Legion {
}

//--------------------------------------------------------------------------
void SliceTask::pack_remote_complete(Serializer &rez)
void SliceTask::pack_remote_complete(Serializer &rez,
ApEvent slice_postcondition)
//--------------------------------------------------------------------------
{
// Send back any created state that our point tasks made
Expand All @@ -8489,6 +8503,7 @@ namespace Legion {
rez.serialize(index_owner);
RezCheck z(rez);
rez.serialize<size_t>(points.size());
rez.serialize(slice_postcondition);
// Serialize the privilege state
pack_privilege_state(rez, target, true/*returning*/);
// Now pack up the future results
Expand Down
7 changes: 4 additions & 3 deletions runtime/legion/legion_tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,8 @@ namespace Legion {
void return_slice_mapped(unsigned points, long long denom,
RtEvent applied_condition,
ApEvent restrict_postcondition);
void return_slice_complete(unsigned points);
void return_slice_complete(unsigned points,
ApEvent slice_postcondition);
void return_slice_commit(unsigned points);
public:
void unpack_slice_mapped(Deserializer &derez, AddressSpaceID source);
Expand Down Expand Up @@ -904,7 +905,7 @@ namespace Legion {
std::deque<SliceTask*> locally_mapped_slices;
protected:
std::set<RtEvent> map_applied_conditions;
std::set<ApEvent> restrict_postconditions;
std::set<ApEvent> completion_preconditions;
std::map<PhysicalManager*,std::pair<unsigned,bool> > acquired_instances;
protected:
// Whether we have to do intra-task alias analysis
Expand Down Expand Up @@ -1000,7 +1001,7 @@ namespace Legion {
void trigger_slice_commit(void);
protected:
void pack_remote_mapped(Serializer &rez, RtEvent applied_condition);
void pack_remote_complete(Serializer &rez);
void pack_remote_complete(Serializer &rez, ApEvent slice_postcondition);
void pack_remote_commit(Serializer &rez);
public:
RtEvent defer_map_and_launch(RtEvent precondition);
Expand Down
44 changes: 40 additions & 4 deletions runtime/legion/legion_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,12 @@ namespace Legion {
// SSE Bit Mask
/////////////////////////////////////////////////////////////
template<unsigned int MAX>
class SSEBitMask : public Internal::LegionHeapify<SSEBitMask<MAX> > {
#if __cplusplus >= 201103L
class alignas(16) SSEBitMask
#else
class SSEBitMask // alignment handled below
#endif
: public Internal::LegionHeapify<SSEBitMask<MAX> > {
public:
explicit SSEBitMask(uint64_t init = 0);
SSEBitMask(const SSEBitMask &rhs);
Expand Down Expand Up @@ -689,13 +694,22 @@ namespace Legion {
public:
static const unsigned ELEMENT_SIZE = 64;
static const unsigned ELEMENTS = MAX/ELEMENT_SIZE;
#if __cplusplus >= 201103L
}; // alignment handled above
#else
} __attribute__((aligned(16)));
#endif

/////////////////////////////////////////////////////////////
// SSE Two-Level Bit Mask
/////////////////////////////////////////////////////////////
template<unsigned int MAX>
class SSETLBitMask : public Internal::LegionHeapify<SSETLBitMask<MAX> > {
#if __cplusplus >= 201103L
class alignas(16) SSETLBitMask
#else
class SSETLBitMask
#endif
: public Internal::LegionHeapify<SSETLBitMask<MAX> > {
public:
explicit SSETLBitMask(uint64_t init = 0);
SSETLBitMask(const SSETLBitMask &rhs);
Expand Down Expand Up @@ -762,15 +776,24 @@ namespace Legion {
public:
static const unsigned ELEMENT_SIZE = 64;
static const unsigned ELEMENTS = MAX/ELEMENT_SIZE;
#if __cplusplus >= 201103L
};
#else
} __attribute__((aligned(16)));
#endif
#endif // __SSE2__

#ifdef __AVX__
/////////////////////////////////////////////////////////////
// AVX Bit Mask
/////////////////////////////////////////////////////////////
template<unsigned int MAX>
class AVXBitMask : public Internal::LegionHeapify<AVXBitMask<MAX> > {
#if __cplusplus >= 201103L
class alignas(32) AVXBitMask
#else
class AVXBitMask // alignment handled below
#endif
: public Internal::LegionHeapify<AVXBitMask<MAX> > {
public:
explicit AVXBitMask(uint64_t init = 0);
AVXBitMask(const AVXBitMask &rhs);
Expand Down Expand Up @@ -838,13 +861,22 @@ namespace Legion {
public:
static const unsigned ELEMENT_SIZE = 64;
static const unsigned ELEMENTS = MAX/ELEMENT_SIZE;
#if __cplusplus >= 201103L
}; // alignment handled above
#else
} __attribute__((aligned(32)));
#endif

/////////////////////////////////////////////////////////////
// AVX Two-Level Bit Mask
/////////////////////////////////////////////////////////////
template<unsigned int MAX>
class AVXTLBitMask : public Internal::LegionHeapify<AVXTLBitMask<MAX> > {
#if __cplusplus >= 201103L
class alignas(32) AVXTLBitMask
#else
class AVXTLBitMask // alignment handled below
#endif
: public Internal::LegionHeapify<AVXTLBitMask<MAX> > {
public:
explicit AVXTLBitMask(uint64_t init = 0);
AVXTLBitMask(const AVXTLBitMask &rhs);
Expand Down Expand Up @@ -915,7 +947,11 @@ namespace Legion {
public:
static const unsigned ELEMENT_SIZE = 64;
static const unsigned ELEMENTS = MAX/ELEMENT_SIZE;
#if __cplusplus >= 201103L
}; // alignment handled above
#else
} __attribute__((aligned(32)));
#endif
#endif // __AVX__

template<typename BITMASK, unsigned int MAX, unsigned int WORDS>
Expand Down

0 comments on commit 12cc9a5

Please sign in to comment.