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

Codegen_C for user_context #7031

Merged
merged 2 commits into from
Sep 20, 2022
Merged

Codegen_C for user_context #7031

merged 2 commits into from
Sep 20, 2022

Conversation

steven-johnson
Copy link
Contributor

While adding a user_context to the async_parallel generator for other purposes, I found some subtle bugs in Codegen_C regarding possible aliasing and/or const-correctness of the internal 'ucon' arguments when calling or unpacking a closure for async usage. This fixes it.

@@ -2069,7 +2069,12 @@ void CodeGen_C::visit(const Variable *op) {
// This is the name of a global, so we can't modify it.
id = op->name;
} else {
id = print_name(op->name);
// This substitution ensures const correctness for all calls
if (op->name == "__user_context") {
Copy link
Member

Choose a reason for hiding this comment

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

Worth adding a helper function to check if the name is "__user_context?

@steven-johnson
Copy link
Contributor Author

Failures are unrelated, merging

@steven-johnson steven-johnson merged commit 7351070 into main Sep 20, 2022
@steven-johnson steven-johnson deleted the srj/c-ucon branch September 20, 2022 22:52
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
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