Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frozen ThreadState #107

Open
wants to merge 50 commits into
base: master
Choose a base branch
from

Conversation

DoeringChristian
Copy link
Contributor

@DoeringChristian DoeringChristian commented Oct 23, 2024

This PR implements the Freezing feature in drjit-core (depends on #106).

It makes the following changes:

  • Adds the freezing api to jit.h, including the following functions: jit_freeze_start, jit_freeze_stop, jit_freeze_replay, jit_freeze_dry_run, jit_freeze_pause, jit_freeze_resume, jit_freeze_abort and jit_freeze_destroy as well as the Recording struct.
  • Adds the implementation of the RecordThreadState, a wrapper around either the CUDA or LLVM ThreadState for freezing them.

@DoeringChristian DoeringChristian force-pushed the frozen-threadstate branch 3 times, most recently from 288194d to bb38a86 Compare October 23, 2024 13:23
@DoeringChristian DoeringChristian marked this pull request as ready for review October 25, 2024 10:58
@DoeringChristian
Copy link
Contributor Author

@merlinND, could you please do a preliminary pass over this PR, to catch some obvious mistakes of mine. Note, this also includes the commit from #106, which I'll remove when that gets merged.

Copy link
Member

@merlinND merlinND left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review part 1. It's mostly about documentation / comments / docstrings to make everything super clear.

It's great that you already created unit tests at the drjit-core level!

I still have to look at the big record_ts.* files.

src/init.cpp Outdated Show resolved Hide resolved
tests/vcall.cpp Outdated Show resolved Hide resolved
tests/vcall.cpp Outdated Show resolved Hide resolved
tests/vcall.cpp Outdated Show resolved Hide resolved
tests/vcall.cpp Outdated Show resolved Hide resolved
tests/record.cpp Outdated Show resolved Hide resolved
tests/record.cpp Outdated Show resolved Hide resolved
tests/record.cpp Outdated Show resolved Hide resolved
tests/record.cpp Outdated Show resolved Hide resolved
tests/record.cpp Outdated Show resolved Hide resolved
Copy link
Member

@merlinND merlinND left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review part 2

src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.h Outdated Show resolved Hide resolved
Copy link
Member

@merlinND merlinND left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review part 3.
It's a partial review of record_ts.cpp, but unfortunately I won't have time to review the rest of the file, there's too much code.

this->init = rv.init;

if (init == RecordVarInit::Captured) {
// copy the variable, so that it isn't changed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that always match the behavior of no-recording?
I.e. if there are captured variables and I run the code with / without recording, would I always get the same result?

src/record_ts.h Outdated Show resolved Hide resolved
src/record_ts.cpp Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
src/record_ts.cpp Outdated Show resolved Hide resolved
@DoeringChristian DoeringChristian force-pushed the frozen-threadstate branch 2 times, most recently from 6439c0b to 64a3dd7 Compare November 7, 2024 12:18
@@ -0,0 +1,709 @@
/** Frozen function backend
*
* This file implements the backend for the `FrozenFunction` feature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants