-
Notifications
You must be signed in to change notification settings - Fork 230
Make {Program,Linker}Options.as_bytes a public API with backend-specific option handling
#1355
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
base: main
Are you sure you want to change the base?
Make {Program,Linker}Options.as_bytes a public API with backend-specific option handling
#1355
Conversation
Co-authored-by: leofang <[email protected]>
…bytes always return list[bytes], remove _as_bytes Co-authored-by: leofang <[email protected]>
Co-authored-by: leofang <[email protected]>
Co-authored-by: leofang <[email protected]>
Co-authored-by: leofang <[email protected]>
|
pre-commit.ci autofix |
|
/ok to test 7b1ecbb |
|
mdboom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this as_bytes and not as_str? I understand the underlying C++ code probably disallows anything that isn't 7-bit ASCII, but bytes in Python are really intended for binary encoded things, not text like this. You can see even in these tests how that makes the code more cumbersome than it needs to be (explicitly decoding the result in order to use it).
Is this just backward compatibility? Maybe then we have to_str and a to_bytes that simply calls to_str and encodes the result, and then mark to_bytes as deprecated...
|
Python users don't need any of these. We already take good care of them. Also This API is needed by cccl-python because they want to pass it to the C level. Give them a list of bytes is appropriate because they can then do a zero-copy conversion to |
…vrtc_options Co-authored-by: leofang <[email protected]>
{Program,Linker}Options.as_bytes a public API with backend-specific option handling
|
/ok to test 15f4b6a |
Description
Close #1327.
Close #1341.
This pull request refactors the way linker options are handled in the CUDA core experimental linker module, improving code organization and maintainability. The main change is the replacement of the
formatted_optionsandoption_keysattributes with dedicated methods for preparing options for different backends. Additionally, new program options are documented, and logging access is improved.Refactoring and Backend Separation:
LinkerOptionsclass to use_prepare_nvjitlink_optionsand_prepare_driver_optionsmethods for constructing options, instead of maintainingformatted_optionsandoption_keysas persistent attributes. This makes the code cleaner and backend-specific logic more explicit. [1] [2] [3]as_bytesmethod toLinkerOptionsto provide a backend-specific way to get encoded options, with validation and error handling for backend selection.Linker Initialization and Logging Improvements:
Linkerclass to use the new option preparation methods during initialization, storing the options in the_MembersNeededForFinalizestructure for later access (e.g., for logs), and ensuring correct log buffer usage for both backends. [1] [2] [3] [4]Program Options Documentation:
ProgramOptionsto include several new options related to compiler caching, time tracing, random seeds, fast compilation modes, and precompiled header (PCH) support for NVRTC, improving clarity for users.Minor Code Maintenance:
CUDAErrorin_program.pyto ensure error handling consistency.Checklist