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

Fix passing of jit_opt_level #55897

Closed
wants to merge 1 commit into from
Closed

Conversation

Flamefire
Copy link
Collaborator

The jit_opt_level must be passed as void* directly not by reference.
This avoids failures and miscompilations as the level will be kind of random instead of one of the valid values.

Fixes #52147
See the issue for more details

@facebook-github-bot facebook-github-bot added oncall: jit Add this issue/PR to JIT oncall triage queue cla signed labels Apr 13, 2021
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Apr 13, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 3a71e8b (more details on the Dr. CI page):


Commit 3a71e8b was recently pushed. Waiting for builds...


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

The jit_opt_level must be passed as void* directly not by reference.
This avoids failures and miscompilations as the level will be kind of
random instead of one of the valid values.
Fixes pytorch#52147
@mruberry mruberry added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 11, 2021
@@ -322,7 +322,7 @@ NvrtcFunction nvrtcCompile(
if (val <= 4 && val >= 0) {
jit_opt_level = static_cast<uint32_t>(val);
options.push_back(CU_JIT_OPTIMIZATION_LEVEL);
option_vals.emplace_back(&jit_opt_level);
option_vals.emplace_back((void*)jit_opt_level);
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably a good idea to static_cast<uintptr_t>(val) up above to guarantee that this cast to void * is all good.

Copy link
Contributor

@bertmaher bertmaher left a comment

Choose a reason for hiding this comment

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

Nice catch by the way! Kinda surprising this wasn't noticed before.

@Flamefire
Copy link
Collaborator Author

Looks like this bug was already fixed once by cfaecaf, then reintroduced by cfaecaf and resolved again by 127c940

So closing this

@Flamefire Flamefire closed this Nov 16, 2021
@Flamefire Flamefire deleted the jitOptLevel branch March 21, 2024 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed oncall: jit Add this issue/PR to JIT oncall triage queue open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pointer passed where number is expected for PYTORCH_CUDA_FUSER_JIT_OPT_LEVEL leading to crash
5 participants