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 visibility of impl fns getting dropped by the cube macro #212

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

jbelanich
Copy link
Contributor

Problem The cube macro wasn't carrying over the visibility of impl fn items in its code generation for the _expand version of fns. While this doesn't cause issues for within-module references to those fns, it does cause compilation errors like "__expand_{fn_name} is private" if you try to reference those fns from outside the module. See the PR's added test in crates/cubecl-core/tests/frontend/cube_impl.rs for an example exercising this behavior.

Proposed solution Add vis to KernelFn, and output tokens for that vis during token generation. In most code paths, vis is populated with the source ImplItem's visibility. However, in Launch's code path we set KernelFn to have pub visibility to match existing behavior.

Copy link
Member

@nathanielsimard nathanielsimard left a comment

Choose a reason for hiding this comment

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

LGTM

@nathanielsimard nathanielsimard merged commit 1226222 into tracel-ai:main Oct 29, 2024
5 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.

2 participants