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

Refine CUDA documentation. #799

Merged
merged 1 commit into from
Apr 24, 2023
Merged

Conversation

dot-asm
Copy link
Contributor

@dot-asm dot-asm commented Mar 22, 2023

Original wording gives an impression that user-provided flags are prefixed with -Xcompiler, which is not the case. -Xcompiler is added only to internally generated flags.

@dot-asm
Copy link
Contributor Author

dot-asm commented Mar 22, 2023

Just in case. One can wonder if it would be more appropriate to prefix user-provided flags with -Xcompiler on user's behalf. As opposed to documenting it as suggested. Problem is that we don't want to break build scripts that had to figure out the current state of affairs and explicitly prefix their flags. Though it's not impossible to take a note if build script has passed -Xcompiler and add one if deemed necessary. "Deemed necessary" refers to the fact that it's not really appropriate to prefix all flags, only those not recognized by nvcc. For example, it would be inappropriate to prefix -std=c++NN, because it's meaningful to both CUDA and host compiler.

src/lib.rs Outdated
Comment on lines 646 to 647
/// `.flag("-Xcompiler").flag("-fpermissive")`. Consult Nvidia
/// documentation for further information.
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be great if we could also link to it.

Suggested change
/// `.flag("-Xcompiler").flag("-fpermissive")`. Consult Nvidia
/// documentation for further information.
/// `.flag("-Xcompiler").flag("-fpermissive")`. See the Nvidia
/// documentation for more information.

src/lib.rs Outdated
/// "-Xcompiler" flags.
/// Enabling CUDA will invoke the CUDA compiler, NVCC. While NVCC accepts
/// most common compiler flags, e.g. `-std=c++17`, some project-specific
/// flags might have to prefixed with "-Xcompiler" flag, for example as
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// flags might have to prefixed with "-Xcompiler" flag, for example as
/// flags might have to be prefixed with "-Xcompiler" flag, for example as

src/lib.rs Outdated
/// CUDA sources since NVCC only accepts a limited set of GNU-like flags,
/// while the rest must be prefixed with the `-Xcompiler` flag to get passed
/// to the underlying C++ compiler.
/// Nvidia compiler accepts only most common compiler flags like `-D`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Nvidia compiler accepts only most common compiler flags like `-D`,
/// Nvidia compiler accepts only the most common compiler flags like `-D`,

Original wording gives an impression that user-provided flags are
prefixed with -Xcompiler, which is not the case. -Xcompiler is
added only to internally generated flags.
@dot-asm
Copy link
Contributor Author

dot-asm commented Apr 24, 2023

Resolved the nits and re-based just in case.

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

Thank you!

@JohnTitor JohnTitor merged commit 20de748 into rust-lang:main Apr 24, 2023
16 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.

None yet

2 participants