Skip to content

Enable restore_tracker usage in device kernels - #1893

Merged
vgvassilev merged 1 commit into
vgvassilev:masterfrom
Vedant2005goyal:RestoreTracker_Device
Jul 21, 2026
Merged

Enable restore_tracker usage in device kernels#1893
vgvassilev merged 1 commit into
vgvassilev:masterfrom
Vedant2005goyal:RestoreTracker_Device

Conversation

@Vedant2005goyal

@Vedant2005goyal Vedant2005goyal commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This PR enables clad::restore_tracker to work correctly inside GPU kernels. The previous implementation relied on STL containers such as std::vector and std::map, which are not supported in device code, causing compilation failures or runtime crashes when restore_tracker was used within GPU kernels.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

#include <utility>
#include <vector>
#ifndef Max_Records
#define Max_Records 64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: macro 'Max_Records' used to declare a constant; consider using a 'constexpr' constant [cppcoreguidelines-macro-usage]

#define Max_Records 64
        ^

#define Max_Records 64
#endif
#ifndef Max_Bytes
#define Max_Bytes 1024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: macro 'Max_Bytes' used to declare a constant; consider using a 'constexpr' constant [cppcoreguidelines-macro-usage]

#define Max_Bytes 1024
        ^

@Vedant2005goyal
Vedant2005goyal force-pushed the RestoreTracker_Device branch from 26a3dce to cea09e7 Compare July 15, 2026 14:55
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Vedant2005goyal
Vedant2005goyal force-pushed the RestoreTracker_Device branch 2 times, most recently from 26fbae1 to 5a37280 Compare July 20, 2026 05:05
@vgvassilev

Copy link
Copy Markdown
Owner

Can we explain in the commit message the idea of that change. Also maybe update the pr description.

@Vedant2005goyal
Vedant2005goyal force-pushed the RestoreTracker_Device branch 2 times, most recently from 345a235 to 29376ac Compare July 20, 2026 17:14
@Vedant2005goyal

Copy link
Copy Markdown
Contributor Author

Can we explain in the commit message the idea of that change. Also maybe update the pr description.

Done

@vgvassilev

Copy link
Copy Markdown
Owner

Let’s add a test that did not work with cuda in the past and now passes.

@Vedant2005goyal
Vedant2005goyal force-pushed the RestoreTracker_Device branch from 29376ac to 071f30b Compare July 21, 2026 11:08

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Lgtm!

Replace the STL-based implementation of clad::restore_tracker with a
device-compatible implementation. The previous implementation relied on
std::vector and std::map, which are unavailable in device code,
preventing restore_tracker from being used inside GPU kernels.
@Vedant2005goyal
Vedant2005goyal force-pushed the RestoreTracker_Device branch from 071f30b to 6425961 Compare July 21, 2026 16:44
@vgvassilev
vgvassilev merged commit cf64927 into vgvassilev:master Jul 21, 2026
40 checks passed
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