Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task Fusion #113

Open
wants to merge 57 commits into
base: branch-24.03
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
8ff0261
task fusion and legality constraints
shivsundram Sep 27, 2021
4a9248f
makeshift serializer for inline ops
shivsundram Sep 27, 2021
99cd51c
reductions scalars, opids, need to remove dynamic allocations
shivsundram Sep 29, 2021
a4e21d8
fusion metadata passed via serialization now
shivsundram Sep 29, 2021
9b57fc8
remove redundant store partitioning
shivsundram Sep 30, 2021
bf7973a
remove creation of deferred arrays
shivsundram Oct 1, 2021
b6121e7
optimized packing, some transform packing
shivsundram Oct 1, 2021
e3708bf
more stuff
shivsundram Oct 4, 2021
8eca06f
partial fusion
Oct 14, 2021
dbf8ea9
merge attempt
Oct 14, 2021
a2c3874
second merge attempt
Oct 15, 2021
303866b
finishing merge
Oct 15, 2021
e8b9021
fix future stuff
Oct 15, 2021
7b0ee30
merge conflict
Oct 15, 2021
8238083
re add serializer, fix horrible merge bug
Oct 15, 2021
46856c7
debugging crap
Oct 22, 2021
6b4182b
trying merge
Oct 22, 2021
db65e43
op registry working
Oct 25, 2021
ddd8dc7
Change the pip package name to match the conda package and update ver…
marcinz Oct 27, 2021
ef677e6
Fix the version of Legion to a particular commit
marcinz Oct 28, 2021
ba955e2
Do not find a default branch for the release
marcinz Oct 28, 2021
de337cf
Change the Legion checkout target
marcinz Oct 28, 2021
78335cc
Bumped up the version of pyarrow
marcinz Oct 28, 2021
369909d
gpu descriptors
Nov 1, 2021
ab0c044
Remove back edges from partition symbols back to operations to avoid
magnatelee Nov 1, 2021
a9e1014
Merge branch 'branch-21.10' into cycle-fix
magnatelee Nov 1, 2021
54d3bb8
Make sure we don't create cycles between region fields and attachments
magnatelee Nov 1, 2021
dd46bdd
Merge pull request #84 from magnatelee/cycle-fix
magnatelee Nov 2, 2021
02103ad
Merge pull request #78 from lightsighter/interpreter-check
magnatelee Nov 3, 2021
d6ccdd2
Handle cases where one instance is used by multiple mappings
magnatelee Nov 3, 2021
94a1fba
Merge branch 'branch-21.10' into mapper-bug-fix
magnatelee Nov 3, 2021
12d13d1
Merge pull request #91 from magnatelee/mapper-bug-fix
magnatelee Nov 3, 2021
51dd00f
Fix import of legion CFFI
manopapad Nov 5, 2021
f348080
Merge pull request #97 from manopapad/fixinit
manopapad Nov 5, 2021
f388f07
Make sure we flush deferred detachments
magnatelee Nov 5, 2021
345f275
reduction fix
Nov 6, 2021
ab96ebc
Merge pull request #99 from magnatelee/detachment-fix
magnatelee Nov 6, 2021
1f9a655
put new constraint stuff back in
Nov 13, 2021
e2afa73
constant optimization
Nov 15, 2021
80aa90f
better constant opt
Nov 22, 2021
f9eb119
terminal dots
Nov 22, 2021
ba55358
useless merge
Nov 22, 2021
78366c8
merging new branch
Nov 22, 2021
f07381e
reuse partitions
Dec 1, 2021
ea12377
install.py
Dec 3, 2021
d7a8dab
new way of applying constraints
Dec 6, 2021
fe66dad
minor cleanup
Dec 7, 2021
a73dec1
more cleanup
Dec 7, 2021
437e67e
use alignment info when fusing
Dec 12, 2021
9594cb5
new apply methods
Dec 12, 2021
239ae35
removing serializer code
Dec 13, 2021
b49557b
more cleanup
Dec 13, 2021
e05e3ff
remove fusion reference from core
Dec 13, 2021
a59e142
remove comments
Dec 13, 2021
399d070
more cleanup
Dec 13, 2021
5bb4df5
partitioning fix
Apr 20, 2022
36c40cb
choose midpoint partition
Jun 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge attempt
  • Loading branch information
Shiv Sundram committed Oct 14, 2021
commit dbf8ea9259caacc440553c542aaa396b274ade95
12 changes: 7 additions & 5 deletions legate/core/operation.py
Original file line number Diff line number Diff line change
@@ -28,12 +28,12 @@ def __init__(self, context, mapper_id=0):
self._inputs = []
self._outputs = []
self._reductions = []
self._is_fused = False
self._temps = []
self._future_output = None
self._future_reduction = None
self._scalar_outputs = []
self._scalar_reductions = []
self._constraints = EqClass()
self._broadcasts = set()
self._is_fused = False
self._broadcasts = OrderedSet()

@property
def context(self):
@@ -161,13 +161,15 @@ def launch(self, strategy):

for input in self._inputs:
proj = strategy.get_projection(input)
launcher.add_input(input, proj)
tag = self.get_tag(strategy, input)
launcher.add_input(input, proj, tag=tag)
for temp in self._temps:
proj = strategy.get_projection(temp)
launcher.add_temp(temp, proj)
partition = strategy.get_partition(temp)
# We update the key partition of a store only when it gets updated
temp.set_key_partition(partition)

for output in self._outputs:
if output.unbound:
continue
70 changes: 42 additions & 28 deletions src/core.mk
Original file line number Diff line number Diff line change
@@ -15,17 +15,24 @@


# General source files
GEN_CPU_SRC = legate_c.cc \
data/scalar.cc \
data/store.cc \
data/transform.cc \
mapping/mapper.cc \
runtime/context.cc \
runtime/projection.cc \
runtime/runtime.cc \
runtime/shard.cc \
task/task.cc \
utilities/deserializer.cc \
GEN_CPU_SRC = legate_c.cc \
data/scalar.cc \
data/store.cc \
data/transform.cc \
mapping/base_mapper.cc \
mapping/core_mapper.cc \
mapping/instance_manager.cc \
mapping/mapping.cc \
mapping/task.cc \
runtime/context.cc \
runtime/projection.cc \
runtime/runtime.cc \
runtime/shard.cc \
task/return.cc \
task/task.cc \
utilities/deserializer.cc \
utilities/machine.cc \
utilities/linearize.cc \
utilities/makeshift_serializer.cc

ifeq ($(strip $(USE_CUDA)),1)
@@ -39,22 +46,29 @@ INSTALL_PATHS = data \
task \
utilities

INSTALL_HEADERS = legate.h \
legate_c.h \
legate_defines.h \
legate_preamble.h \
data/buffer.h \
data/scalar.h \
data/scalar.inl \
data/store.h \
data/store.inl \
data/transform.h \
runtime/context.h \
runtime/runtime.h \
task/task.h \
utilities/deserializer.h \
utilities/dispatch.h \
utilities/span.h \
utilities/type_traits.h \
INSTALL_HEADERS = legate.h \
legate_c.h \
legate_defines.h \
legate_preamble.h \
data/buffer.h \
data/scalar.h \
data/scalar.inl \
data/store.h \
data/store.inl \
data/transform.h \
mapping/base_mapper.h \
mapping/mapping.h \
mapping/task.h \
mapping/task.inl \
runtime/context.h \
runtime/runtime.h \
task/return.h \
task/task.h \
utilities/deserializer.h \
utilities/deserializer.inl \
utilities/dispatch.h \
utilities/machine.h \
utilities/span.h \
utilities/makeshift_serializer.h \
utilities/type_traits.h \
utilities/typedefs.h
4 changes: 2 additions & 2 deletions src/data/transform.h
Original file line number Diff line number Diff line change
@@ -35,8 +35,8 @@ class StoreTransform {
virtual Legion::DomainAffineTransform inverse_transform(int32_t in_dim) const = 0;
virtual int32_t getTransformCode() const =0;
protected:
std::unique_ptr<StoreTransform> parent_{nullptr};
friend class MakeshiftSerializer;
friend class MakeshiftSerializer;
std::shared_ptr<StoreTransform> parent_{nullptr};
};

class Shift : public StoreTransform {
3 changes: 2 additions & 1 deletion src/runtime/context.cc
Original file line number Diff line number Diff line change
@@ -147,8 +147,9 @@ TaskContext::TaskContext(const Legion::Task* task,
Legion::Runtime* runtime)
: task_(task), regions_(regions), context_(context), runtime_(runtime)
{
Deserializer dez(task, regions);
TaskDeserializer dez(task, regions);
fusionMetadata = dez.unpack<FusionMetadata>();

inputs_ = dez.unpack<std::vector<Store>>();
outputs_ = dez.unpack<std::vector<Store>>();
reductions_ = dez.unpack<std::vector<Store>>();
11 changes: 7 additions & 4 deletions src/runtime/context.h
Original file line number Diff line number Diff line change
@@ -54,10 +54,10 @@ class ResourceScope {

public:
bool valid() const { return base_ != -1; }
bool in_scope(int64_t resource_id) const {
std::cout<<"resource_id "<<resource_id<<std::endl;
std::cout<<"max "<<max_<<std::endl;
return base_ <= resource_id && resource_id < max_; }
bool in_scope(int64_t resource_id) const
{
return base_ <= resource_id && resource_id < base_ + max_;
}

private:
int64_t base_{-1};
@@ -121,6 +121,9 @@ class TaskContext {
std::vector<Store>& reductions() { return reductions_; }
std::vector<Scalar>& scalars() { return scalars_; }

public:
ReturnValues pack_return_values() const;

public:
const Legion::Task* task_;
const std::vector<Legion::PhysicalRegion>& regions_;
52 changes: 5 additions & 47 deletions src/utilities/deserializer.cc
Original file line number Diff line number Diff line change
@@ -40,12 +40,7 @@ TaskDeserializer::TaskDeserializer(const LegionTask* task,
first_task_ = !task->is_index_space || (task->index_point == task->index_domain.lo());
}

void Deserializer::_unpack(LegateTypeCode& value)
{
value = static_cast<LegateTypeCode>(unpack<int32_t>());
}


/*
void Deserializer::_unpack(FusionMetadata& metadata){
metadata.isFused = unpack<bool>();
if (!metadata.isFused){
@@ -99,8 +94,8 @@ void Deserializer::_unpack(FusionMetadata& metadata){
metadata.opIDs[i] = unpack<int32_t>();
}
}

void Deserializer::_unpack(Store& value)
*/
void TaskDeserializer::_unpack(Store& value)
{
auto is_future = unpack<bool>();
auto dim = unpack<int32_t>();
@@ -130,8 +125,7 @@ void TaskDeserializer::_unpack(FutureWrapper& value)
auto field_size = unpack<int32_t>();

auto point = unpack<std::vector<int64_t>>();

Domain domain;
Legion::Domain domain;
domain.dim = static_cast<int32_t>(point.size());
for (int32_t idx = 0; idx < domain.dim; ++idx) {
domain.rect_data[idx] = 0;
@@ -172,43 +166,7 @@ MapperDeserializer::MapperDeserializer(const LegionTask* task,
MapperContext context)
: BaseDeserializer(task), runtime_(runtime), context_(context)
{
int32_t code = unpack<int32_t>();
switch (code) {
case -1: {
return nullptr;
}
case LEGATE_CORE_TRANSFORM_SHIFT: {
auto dim = unpack<int32_t>();
auto offset = unpack<int64_t>();
auto parent = unpack_transform();
return std::make_unique<Shift>(dim, offset, std::move(parent));
}
case LEGATE_CORE_TRANSFORM_PROMOTE: {
auto extra_dim = unpack<int32_t>();
auto dim_size = unpack<int64_t>();
auto parent = unpack_transform();
return std::make_unique<Promote>(extra_dim, dim_size, std::move(parent));
}
case LEGATE_CORE_TRANSFORM_PROJECT: {
auto dim = unpack<int32_t>();
auto coord = unpack<int64_t>();
auto parent = unpack_transform();
return std::make_unique<Project>(dim, coord, std::move(parent));
}
case LEGATE_CORE_TRANSFORM_TRANSPOSE: {
auto axes = unpack<std::vector<int32_t>>();
auto parent = unpack_transform();
return std::make_unique<Transpose>(std::move(axes), std::move(parent));
}
case LEGATE_CORE_TRANSFORM_DELINEARIZE: {
auto dim = unpack<int32_t>();
auto sizes = unpack<std::vector<int64_t>>();
auto parent = unpack_transform();
return std::make_unique<Delinearize>(dim, std::move(sizes), std::move(parent));
}
}
assert(false);
return nullptr;
first_task_ = false;
}

void MapperDeserializer::_unpack(Store& value)
14 changes: 3 additions & 11 deletions src/utilities/deserializer.h
Original file line number Diff line number Diff line change
@@ -30,15 +30,9 @@

namespace legate {

class Store;
class StoreTransform;
class Scalar;
class FutureWrapper;
class RegionField;
class OutputRegionField;
struct FusionMetadata;

class Deserializer {
template <typename Deserializer>
class BaseDeserializer {
public:
BaseDeserializer(const Legion::Task* task);

@@ -51,9 +45,7 @@ class Deserializer {
return std::move(value);
}

//void unpackFusionMetadata(bool& isFused);

private:
public:
template <typename T, std::enable_if_t<legate_type_code_of<T> != MAX_TYPE_NUMBER>* = nullptr>
void _unpack(T& value)
{
You are viewing a condensed version of this merge commit. You can view the full changes here.