Skip to content

Commit

Permalink
Optional logging wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Jul 31, 2024
1 parent 98ac213 commit b4d725b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "deterministic_random.h"
#include "legion.h"
#include "logging_wrapper.h"
#include "mapper.h"

using namespace Legion;
Expand Down Expand Up @@ -52,6 +53,7 @@ static Logger log_fuzz("fuzz");

static RngSeed root_seed;
static uint64_t replicate_levels = 0;
static bool mapper_logging = false;

static long long parse_long_long(const std::string &flag, const std::string &arg) {
long long result;
Expand Down Expand Up @@ -84,6 +86,7 @@ struct FuzzerConfig {
uint64_t replicate_levels = 0;
uint64_t num_ops = 1;
uint64_t skip_ops = 0;
bool mapper_logging = false;

static FuzzerConfig parse_args(int argc, char **argv) {
FuzzerConfig config;
Expand Down Expand Up @@ -116,6 +119,8 @@ struct FuzzerConfig {
} else if (flag == "-fuzz:skip") {
std::string arg(argv[++i]);
config.skip_ops = parse_uint64_t(flag, arg);
} else if (flag == "-fuzz:mapper_logging") {
config.mapper_logging = true;
}
}
return config;
Expand All @@ -135,6 +140,7 @@ struct FuzzerConfig {
LOG_ONCE(log_fuzz.print() << " config.replicate_levels = " << replicate_levels);
LOG_ONCE(log_fuzz.print() << " config.num_ops = " << num_ops);
LOG_ONCE(log_fuzz.print() << " config.skip_ops = " << skip_ops);
LOG_ONCE(log_fuzz.print() << " config.mapper_logging = " << mapper_logging);
}
};

Expand Down Expand Up @@ -1211,9 +1217,12 @@ void top_level(const Task *task, const std::vector<PhysicalRegion> &regions, Con
static void create_mappers(Machine machine, Runtime *runtime,
const std::set<Processor> &local_procs) {
for (Processor proc : local_procs) {
FuzzMapper::FuzzMapper *mapper =
Mapping::Mapper *mapper =
new FuzzMapper::FuzzMapper(runtime->get_mapper_runtime(), machine, proc,
root_seed.make_stream(), replicate_levels);
if (mapper_logging) {
mapper = new Mapping::LoggingWrapper(mapper);
}
runtime->replace_default_mapper(mapper, proc);
}
}
Expand All @@ -1227,6 +1236,7 @@ int main(int argc, char **argv) {
FuzzerConfig config = FuzzerConfig::parse_args(argc, argv);
root_seed = RngSeed(config.initial_seed);
replicate_levels = config.replicate_levels;
mapper_logging = config.mapper_logging;

Runtime::preregister_projection_functor(PROJECTION_OFFSET_1_ID,
new OffsetProjection(1));
Expand Down

0 comments on commit b4d725b

Please sign in to comment.