31 google::protobuf::RepeatedFieldBackInserter(
proto.mutable_sizes()));
35 :
Tiling(std::vector<uint64_t>(il)) {}
38 std::vector<uint64_t> result(
proto.sizes().begin(),
proto.sizes().end());
43 return proto.sizes_size();
47 CHECK_LT(i,
proto.sizes_size()) <<
"index overflow";
49 [
this, i](uint64_t u) { this->
proto.set_sizes(i, u); },
50 [
this, i]() {
return this->
proto.sizes(i); });
54 CHECK_LT(i,
proto.sizes_size()) <<
"index overflow";
55 return proto.sizes(i);
64 return proto.SerializeAsString() == view.
proto.SerializeAsString();
68 return !(*
this == view);
75 CHECK_GT(il.size(), 0) <<
"list of values in CudaDimView must be non-empty";
76 CHECK_LE(il.size(), 3) <<
"at most 3 values allowed in CudaDimView";
80 proto.set_z(*(il.begin() + 2));
82 proto.set_y(*(il.begin() + 1));
84 proto.set_x(*il.begin());
87 CHECK(
false) <<
"unreachable";
92 :
CudaDim(std::vector<uint64_t>(il)) {}
106 CHECK(!(!
proto.has_y() &&
proto.has_z())) <<
"CudaDimView has z but not y";
110 }
else if (
proto.has_y()) {
117 CHECK(!(!
proto.has_y() &&
proto.has_z())) <<
"CudaDimView has z but not y";
119 std::vector<uint64_t> result;
120 result.push_back(
proto.x());
122 result.push_back(
proto.y());
125 result.push_back(
proto.z());
133 CudaDimView::defaultDim};
135 CHECK_LE(v.size(), 3);
136 std::copy(v.begin(), v.end(), arr.begin());
141 CHECK_LT(i, 3) <<
"index overflow";
144 [
this](uint64_t u) { this->
proto.set_x(u); },
145 [
this]() {
return this->
proto.x(); });
148 [
this](uint64_t u) { this->
proto.set_y(u); },
155 [
this](uint64_t u) { this->
proto.set_z(u); },
164 CHECK_LT(i, 3) <<
"index overflow";
180 return proto.SerializeAsString() == view.
proto.SerializeAsString();
184 return !(*
this == view);
197 return proto.SerializeAsString() == view.
proto.SerializeAsString();
201 return !(*
this == view);
208 : block(*proto.mutable_block()),
209 grid(*proto.mutable_grid()),
210 tiling(*proto.mutable_tiling()),
211 outerScheduleOptions(*proto.mutable_outer_schedule_options()),
212 intraTileScheduleOptions(*proto.mutable_intra_tile_schedule_options()) {}
215 : proto(options.proto),
216 block(*proto.mutable_block()),
217 grid(*proto.mutable_grid()),
218 tiling(*proto.mutable_tiling()),
219 outerScheduleOptions(*proto.mutable_outer_schedule_options()),
220 intraTileScheduleOptions(*proto.mutable_intra_tile_schedule_options()) {}
224 block(*proto.mutable_block()),
225 grid(*proto.mutable_grid()),
226 tiling(*proto.mutable_tiling()),
227 outerScheduleOptions(*proto.mutable_outer_schedule_options()),
228 intraTileScheduleOptions(*proto.mutable_intra_tile_schedule_options()) {}
231 bool parsed =
proto.ParseFromString(str);
232 CHECK(parsed) <<
"could not parse protobuf string";
236 return proto.SerializeAsString() == options.
proto.SerializeAsString();
240 return !(*
this == options);
244 return proto.SerializeAsString();
262 return tile(std::string(str));
265 template <
typename... Args>
269 "arguments of tile() must be integers");
270 return tile(vectorFromCastedArgs<uint64_t, Args...>(args...));
274 std::initializer_list<uint64_t> threads) {
286 const std::vector<uint64_t>& threads) {
287 CHECK_GT(threads.size(), 0) <<
"expected at least one thread size";
288 CHECK_LE(threads.size(), 3) <<
"expected at most three thread sizes";
290 uint64_t x = threads[0];
298 std::initializer_list<uint64_t> blocks) {
310 const std::vector<uint64_t>& blocks) {
311 CHECK_GT(blocks.size(), 0) <<
"expected at least one thread size";
312 CHECK_LE(blocks.size(), 3) <<
"expected at most three thread sizes";
314 uint64_t x = blocks[0];
322 proto.set_unroll(size);
327 proto.set_use_shared_memory(b);
332 proto.set_use_private_memory(b);
337 proto.set_max_shared_memory(size);
342 proto.set_fix_parameters_before_scheduling(b);
347 proto.set_unroll_copy_shared(b);
352 proto.set_tile_imperfectly_nested(b);
357 proto.set_match_library_calls(b);
369 bool couldParse = FusionStrategy_Parse(str, &fs);
370 CHECK(couldParse) <<
"unknown FusionStrategy " << str;
380 const std::string& str) {
382 bool couldParse = FusionStrategy_Parse(str, &fs);
383 CHECK(couldParse) <<
"unknown FusionStrategy " << str;
404 const std::string& str) {
406 bool couldParse = FusionStrategy_Parse(str, &fs);
407 CHECK(couldParse) <<
"unknown FusionStrategy " << str;
TilingProto & proto
Definition: mapping_options.h:256
MappingOptions & mapToThreads(std::initializer_list< uint64_t > threads)
Definition: mapping_options-inl.h:273
bool operator==(const CudaDimView &view) const
Compare the values with those from another view.
Definition: mapping_options-inl.h:179
"Materialized" TilingView.
Definition: mapping_options.h:260
ValueAccessor< uint64_t > operator[](size_t i)
Definition: mapping_options-inl.h:46
MappingOptions & intraTileScheduleAllowSkewing(bool b)
Definition: mapping_options-inl.h:411
size_t size() const
Number of values held.
Definition: mapping_options-inl.h:42
MappingOptions & usePrivateMemory(bool b)
Definition: mapping_options-inl.h:331
SchedulerOptionsView intraTileScheduleOptions
Definition: mapping_options.h:444
CudaDimView & operator=(const CudaDimView &view)
Assign the values from another view.
Definition: mapping_options-inl.h:174
Definition: mapping_options.h:120
MappingOptions & unroll(uint64_t size)
Definition: mapping_options-inl.h:321
MappingOptions & useSharedMemory(bool b)
Definition: mapping_options-inl.h:326
CudaDim()
Definition: mapping_options.h:175
MappingOptions & outerScheduleFusionStrategy(FusionStrategy fs)
Definition: mapping_options-inl.h:374
MappingOptions & matchLibraryCalls(bool b)
Definition: mapping_options-inl.h:356
CudaDimView block
Definition: mapping_options.h:440
bool operator==(const SchedulerOptionsView &view) const
Compare the values with those from another view.
Definition: mapping_options-inl.h:196
bool operator==(const MappingOptions &options) const
Compare with another message.
Definition: mapping_options-inl.h:235
MappingOptionsProto proto
Definition: mapping_options.h:437
size_t size() const
Number of values held.
Definition: mapping_options-inl.h:105
MappingOptions & mapToBlocks(std::initializer_list< uint64_t > blocks)
Definition: mapping_options-inl.h:297
bool operator!=(const MappingOptions &options) const
Definition: mapping_options-inl.h:239
Tiling()
Definition: mapping_options.h:262
TilingView tiling
Definition: mapping_options.h:442
MappingOptions & intraTileSchedulePositiveOrthant(bool b)
Definition: mapping_options-inl.h:416
Definition: mapping_options.h:336
MappingOptions & outerSchedulePositiveOrthant(bool b)
Definition: mapping_options-inl.h:392
MappingOptions & fixParametersBeforeScheduling(bool b)
Definition: mapping_options-inl.h:341
TilingView & operator=(const TilingView &view)
Assign the values from another view.
Definition: mapping_options-inl.h:58
std::string toProtobufSerializedString() const
Get a string with a serialized protocol buffers message.
Definition: mapping_options-inl.h:243
MappingOptions & intraTileScheduleFusionStrategy(FusionStrategy fs)
Definition: mapping_options-inl.h:397
bool operator!=(const TilingView &view) const
Definition: mapping_options-inl.h:67
bool operator!=(const CudaDimView &view) const
Definition: mapping_options-inl.h:183
CudaDimProto & proto
Definition: mapping_options.h:157
bool operator!=(const SchedulerOptionsView &view) const
Definition: mapping_options-inl.h:200
bool operator==(const TilingView &view) const
Compare the values with those from another view.
Definition: mapping_options-inl.h:63
MappingOptions & maxSharedMemory(uint64_t size)
Definition: mapping_options-inl.h:336
MappingOptions & tile(const std::vector< uint64_t > &sizes)
Definition: mapping_options-inl.h:251
MappingOptions & unrollCopyShared(bool b)
Definition: mapping_options-inl.h:346
Definition: mapping_options.h:173
MappingOptions & tileImperfectlyNested(bool b)
Definition: mapping_options-inl.h:351
ValueAccessor< uint64_t > operator[](size_t i)
Definition: mapping_options-inl.h:140
MappingOptions()
Definition: mapping_options-inl.h:207
SchedulerOptionsView outerScheduleOptions
Definition: mapping_options.h:443
CudaDimView grid
Definition: mapping_options.h:441
Definition: mapping_options.h:222
SchedulerOptionsProto & proto
Definition: mapping_options.h:313
SchedulerOptionsView & operator=(const SchedulerOptionsView &)
Assign the values from another view.
Definition: mapping_options-inl.h:190
std::array< uint64_t, 3 > extractDefaultedArray() const
Return a copy of values as std::array of size 3 padded with defaultDim.
Definition: mapping_options-inl.h:130
MappingOptions & scheduleFusionStrategy(FusionStrategy fs)
Definition: mapping_options-inl.h:361
std::vector< uint64_t > extractVector() const
Return a copy of values as std::vector.
Definition: mapping_options-inl.h:116
Definition: mapping_options.h:278
static const uint64_t defaultDim
Definition: mapping_options.h:159
MappingOptions & outerScheduleAllowSkewing(bool b)
Definition: mapping_options-inl.h:387
Definition: mapping_options.h:94
std::vector< uint64_t > extractVector() const
Return a copy of values as std::vector.
Definition: mapping_options-inl.h:37