Skip to content

Commit b4d725b

Browse files
Optional logging wrapper.
1 parent 98ac213 commit b4d725b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/fuzzer.cc

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "deterministic_random.h"
2222
#include "legion.h"
23+
#include "logging_wrapper.h"
2324
#include "mapper.h"
2425

2526
using namespace Legion;
@@ -52,6 +53,7 @@ static Logger log_fuzz("fuzz");
5253

5354
static RngSeed root_seed;
5455
static uint64_t replicate_levels = 0;
56+
static bool mapper_logging = false;
5557

5658
static long long parse_long_long(const std::string &flag, const std::string &arg) {
5759
long long result;
@@ -84,6 +86,7 @@ struct FuzzerConfig {
8486
uint64_t replicate_levels = 0;
8587
uint64_t num_ops = 1;
8688
uint64_t skip_ops = 0;
89+
bool mapper_logging = false;
8790

8891
static FuzzerConfig parse_args(int argc, char **argv) {
8992
FuzzerConfig config;
@@ -116,6 +119,8 @@ struct FuzzerConfig {
116119
} else if (flag == "-fuzz:skip") {
117120
std::string arg(argv[++i]);
118121
config.skip_ops = parse_uint64_t(flag, arg);
122+
} else if (flag == "-fuzz:mapper_logging") {
123+
config.mapper_logging = true;
119124
}
120125
}
121126
return config;
@@ -135,6 +140,7 @@ struct FuzzerConfig {
135140
LOG_ONCE(log_fuzz.print() << " config.replicate_levels = " << replicate_levels);
136141
LOG_ONCE(log_fuzz.print() << " config.num_ops = " << num_ops);
137142
LOG_ONCE(log_fuzz.print() << " config.skip_ops = " << skip_ops);
143+
LOG_ONCE(log_fuzz.print() << " config.mapper_logging = " << mapper_logging);
138144
}
139145
};
140146

@@ -1211,9 +1217,12 @@ void top_level(const Task *task, const std::vector<PhysicalRegion> &regions, Con
12111217
static void create_mappers(Machine machine, Runtime *runtime,
12121218
const std::set<Processor> &local_procs) {
12131219
for (Processor proc : local_procs) {
1214-
FuzzMapper::FuzzMapper *mapper =
1220+
Mapping::Mapper *mapper =
12151221
new FuzzMapper::FuzzMapper(runtime->get_mapper_runtime(), machine, proc,
12161222
root_seed.make_stream(), replicate_levels);
1223+
if (mapper_logging) {
1224+
mapper = new Mapping::LoggingWrapper(mapper);
1225+
}
12171226
runtime->replace_default_mapper(mapper, proc);
12181227
}
12191228
}
@@ -1227,6 +1236,7 @@ int main(int argc, char **argv) {
12271236
FuzzerConfig config = FuzzerConfig::parse_args(argc, argv);
12281237
root_seed = RngSeed(config.initial_seed);
12291238
replicate_levels = config.replicate_levels;
1239+
mapper_logging = config.mapper_logging;
12301240

12311241
Runtime::preregister_projection_functor(PROJECTION_OFFSET_1_ID,
12321242
new OffsetProjection(1));

0 commit comments

Comments
 (0)