Skip to content

Commit

Permalink
Run remote benchmarks with REMOTE=1, compatible with binary translation
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsGonzo committed Jun 4, 2024
1 parent ea76f05 commit 28f749e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions engine/scripts/src/level1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,7 @@ void do_benchmarks()
sys_test_array(test_vector.get());
});


if (Game::setting("remote").value_or(false))
do_remote_stuff();
}
2 changes: 2 additions & 0 deletions engine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ int main()
{
const bool debug = getenv("DEBUG") != nullptr;
const bool do_benchmarks = getenv("BENCHMARK") != nullptr;
const bool do_remote = getenv("REMOTE") != nullptr;

// Dynamically extend the functionality available
// See: setup_timers.cpp
Expand All @@ -29,6 +30,7 @@ int main()
Script::set_global_setting("benchmarks", do_benchmarks);
if (Script::get_global_setting("benchmarks") != do_benchmarks)
throw std::runtime_error("Insane global settings");
Script::set_global_setting("remote", do_remote);

/* The event_loop function can be resumed later, and can execute work
that has been preemptively handed to it from other machines. */
Expand Down
7 changes: 7 additions & 0 deletions engine/src/script/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@ void Script::reset()
riscv::MachineOptions<MARCH> options {
.memory_max = MAX_MEMORY,
.stack_size = STACK_SIZE,
.verbose_loader = getenv("VERBOSE") != nullptr,
.use_memory_arena = true,
.default_exit_function = "fast_exit",
#ifdef RISCV_BINARY_TRANSLATION
.translate_enabled = getenv("NO_TRANSLATE") == nullptr,
// The gameplay machine is loaded into a high-memory area
// In order for remote calls to work, disable the arena
.translation_use_arena = name() != "gameplay",
#endif
};
m_machine = std::make_unique<machine_t> (*m_binary, options);

Expand Down
2 changes: 1 addition & 1 deletion ext/libriscv

0 comments on commit 28f749e

Please sign in to comment.