Skip to content

Commit

Permalink
Added freezing feature
Browse files Browse the repository at this point in the history
  • Loading branch information
DoeringChristian committed Oct 23, 2024
1 parent bfc9a34 commit 8bff20e
Show file tree
Hide file tree
Showing 5 changed files with 2,387 additions and 11 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ add_library(
src/malloc.h src/malloc.cpp
src/registry.h src/registry.cpp
src/util.h src/util.cpp
src/record_ts.h src/record_ts.cpp

# CUDA backend
src/cuda_api.h
Expand Down
67 changes: 56 additions & 11 deletions src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@
license that can be found in the LICENSE file.
*/

#include "internal.h"
#include "var.h"
#include "array.h"
#include "call.h"
#include "cond.h"
#include "cuda_tex.h"
#include "eval.h"
#include "log.h"
#include "util.h"
#include "registry.h"
#include "internal.h"
#include "llvm.h"
#include "cuda_tex.h"
#include "op.h"
#include "call.h"
#include "log.h"
#include "loop.h"
#include "cond.h"
#include "op.h"
#include "profile.h"
#include "array.h"
#include <thread>
#include "record_ts.h"
#include "registry.h"
#include "util.h"
#include "var.h"
#include <condition_variable>
#include <drjit-core/half.h>
#include <drjit-core/texture.h>
#include <thread>

#if defined(DRJIT_ENABLE_OPTIX)
#include <drjit-core/optix.h>
Expand Down Expand Up @@ -1502,3 +1503,47 @@ int jit_leak_warnings() {
void jit_set_leak_warnings(int value) {
state.leak_warnings = (bool) value;
}

void jit_freeze_start(JitBackend backend, const uint32_t *inputs,
uint32_t n_inputs) {
lock_guard guard(state.lock);
return jitc_freeze_start(backend, inputs, n_inputs);
}

Recording *jit_freeze_stop(JitBackend backend, const uint32_t *outputs,
uint32_t n_outputs) {
lock_guard guard(state.lock);
return jitc_freeze_stop(backend, outputs, n_outputs);
}

bool jit_freeze_pause(JitBackend backend) {
lock_guard guard(state.lock);
return jitc_freeze_pause(backend);
}

bool jit_freeze_resume(JitBackend backend) {
lock_guard guard(state.lock);
return jitc_freeze_resume(backend);
}

void jit_freeze_abort(JitBackend backend) {
lock_guard guard(state.lock);
return jitc_freeze_abort(backend);
}

void jit_freeze_replay(Recording *recording, const uint32_t *inputs,
uint32_t *outputs) {
lock_guard guard(state.lock);
jitc_freeze_replay(recording, inputs, outputs);
}

int jit_freeze_dry_run(Recording *recording, const uint32_t *inputs,
uint32_t *outputs) {
lock_guard guard(state.lock);
return jitc_freeze_dry_run(recording, inputs, outputs);
}

void jit_freeze_destroy(Recording *recording) {
lock_guard guard(state.lock);
jitc_freeze_destroy(recording);
}
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "internal.h"
#include "cuda_ts.h"
#include "llvm_ts.h"
#include "record_ts.h"
#include "malloc.h"
#include "internal.h"
#include "log.h"
Expand Down
Loading

0 comments on commit 8bff20e

Please sign in to comment.