Skip to content

refactor(cust_raw): Parse macro function renames in cuda headers. #187

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

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

jorge-ortega
Copy link
Collaborator

Adds a custom bindgen callback that prevents function renames due to macro defines while still linking to the intend function after macro expansion. It does this by tracking macros when generating the bindings, so that it can change the name of the function back to what it was before the macro changed and link to the macro expanded function name. Doing so helps prevents breaking changes across CUDA versions when generating the bindings, and generates function bindings that match those used in Nvidia's CUDA documentation.

misc.: optix-sys rebuilds if related optix environment variables change.
misc.: unpin cc and jobserver from add example.

@jorge-ortega jorge-ortega force-pushed the function-renames branch 8 times, most recently from 3b73676 to 39bd57e Compare April 3, 2025 07:29
@jorge-ortega
Copy link
Collaborator Author

TBH I don't know why Windows with v12 is passing when we never set LIBCLANG_PATH or installed Clang...

@adamcavendish
Copy link
Contributor

TBH I don't know why Windows with v12 is passing when we never set LIBCLANG_PATH or installed Clang...

Maybe it uses visual studio toolchains?

@adamcavendish
Copy link
Contributor

A heads-up that I'm also working on a change to use prebuilt container images that contains NVidia toolchains so I might conflict with your github actions changes.

Adds a custom bindgen callback that prevents function renames due to macro defines while still linking to the intend function after macro expansion. It does this by tracking macros when generating the bindings, so that it can change the name of the function back to what it was before the macro changed and link to the macro expanded function name. Doing so helps prevents breaking changes across CUDA versions when generating the bindings, and generates function bindings that match those used in Nvidia's CUDA documentation.

misc.: optix-sys rebuilds if related optix environment variables change.
misc.: unpin cc and jobserver from add example.
@jorge-ortega
Copy link
Collaborator Author

Leaving this open in case anyone has comments and will merge in the morning unless @LegNeato beats me to it. I'll have additional changes to add move coverage of the sdk to try match what cudarc offers.

@jorge-ortega
Copy link
Collaborator Author

Linking #166

@jorge-ortega jorge-ortega merged commit 295459d into main Apr 4, 2025
12 checks passed
@jorge-ortega jorge-ortega deleted the function-renames branch April 4, 2025 17:42
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