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

Introducing Module::load_from_bytes() #58

Open
vmx opened this issue Aug 11, 2021 · 2 comments
Open

Introducing Module::load_from_bytes() #58

vmx opened this issue Aug 11, 2021 · 2 comments

Comments

@vmx
Copy link
Contributor

vmx commented Aug 11, 2021

It's currently possible to directly embed a CUDA module via Module::load_from_string(). It is using a CStr, which is meant for a list on nul-terminated bytes (strings) and not for binary data.

Hence I propose introducing Module::load_from_bytes(), which does the same thing, the only difference will be that the input will be a byte slice &[u8]. You can then use the include_bytes! macro to include the module.

I would even remove the Module::load_from_string() and only have Module:load_from_bytes(), but I'd leave this decision to the maintainers.

I'm happy to do a PR, if that's a feature that would be accepted.

@vmx
Copy link
Contributor Author

vmx commented Aug 11, 2021

I forgot to mention that the inlcude_str! macro has additional restrictions, the input needs to be valid UTF-8, which leads to problems as described in issue #47.

@vmx
Copy link
Contributor Author

vmx commented Aug 23, 2021

The implementation could look like this: vmx@2c39a40

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

No branches or pull requests

1 participant