From b4d725bb81cc37ade002db85f085075f53c484f2 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Wed, 31 Jul 2024 09:46:06 -0700 Subject: [PATCH] Optional logging wrapper. --- src/fuzzer.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fuzzer.cc b/src/fuzzer.cc index 10971dc..67725d1 100644 --- a/src/fuzzer.cc +++ b/src/fuzzer.cc @@ -20,6 +20,7 @@ #include "deterministic_random.h" #include "legion.h" +#include "logging_wrapper.h" #include "mapper.h" using namespace Legion; @@ -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; @@ -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; @@ -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; @@ -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); } }; @@ -1211,9 +1217,12 @@ void top_level(const Task *task, const std::vector ®ions, Con static void create_mappers(Machine machine, Runtime *runtime, const std::set &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); } } @@ -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));