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

Make HALIDE_REGISTER_GENERATOR work with multiple template args #6556

Merged
merged 5 commits into from
Jan 14, 2022

Conversation

abadams
Copy link
Member

@abadams abadams commented Jan 12, 2022

Currently the macro uses the type in a way that fails if it's enclosed in parens, which is necessary if the type name contains internal commas due to template usage.

Comment on lines +16 to +20
// A major downside of templated generators is that because we use CRTP, you
// must manually import names of types from the base class. For Input and
// Output you can also just use these equivalent globally-scoped names:
GeneratorInput<Buffer<T1>> input{"input", 2};
GeneratorOutput<Buffer<T2>> output{"output", 2};
Copy link
Member

Choose a reason for hiding this comment

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

I helped someone with this exact issue on StackOverflow not too long ago... https://stackoverflow.com/a/70071173/2137996

Maybe it would be helpful to document an example of this somewhere?

@steven-johnson
Copy link
Contributor

Windows failures:

C:\build_bot\worker\halide-testbranch-main-llvm14-x86-32-windows-cmake\halide-source\test\generator\templated_generator.cpp(34): error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
C:\build_bot\worker\halide-testbranch-main-llvm14-x86-32-windows-cmake\halide-source\test\generator\templated_generator.cpp(35): error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax

@steven-johnson
Copy link
Contributor

failures are unrelated, good to land

@abadams abadams merged commit e581669 into master Jan 14, 2022
@alexreinking alexreinking deleted the abadams/templated_generator_macro branch January 14, 2022 19:43
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.

3 participants