Skip to content

Hot reload fixes #382

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Hot reload fixes #382

wants to merge 3 commits into from

Conversation

tunabrain
Copy link
Collaborator

This fixes a couple of issues with hot reload:

  1. Lookup modules are not reloaded after a hot reload, and trying to create an NDBuffer or Tensor after a hot reload has taken place will fail. The fix is to add a hot reload hook for lookup modules.

  2. Changing a loaded module, then e.g. evaluating a cell in Jupyter will still run the old shader code. The hot reload trigger runs on dispatch, and the shader is reloaded only after the next dispatch. This can be confusing when things don't run in a loop, e.g. in an interactive environment, as you need to run a cell twice to see the reloaded code. The fix is to re-add a jupyer hook that triggers a hot reload check before jupyter cells are evaluated.

This exposes hot reload functionality on the device. Input on how to expose this differently is welcome!

@tunabrain tunabrain requested a review from a team as a code owner July 28, 2025 22:13
Copy link
Contributor

@ccummingsNV ccummingsNV left a comment

Choose a reason for hiding this comment

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

Seems sensible - just a naming issue then should be good to go

D_NA(Device, set_hot_reload_delay)
);
device.def(
"hot_reload",
Copy link
Contributor

Choose a reason for hiding this comment

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

This check should be called be something like "hot_reload_update" or "hot_reload_check". i.e. it shouldn't imply a hot reload will occur when you call it, because it might do nothing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good! PR adjusted to include this change.

@tunabrain tunabrain force-pushed the dev/bbitterli/hot-reload-fixes branch from 4c8b5fe to 7c5e4c4 Compare July 29, 2025 18:53
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.

2 participants