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

CUDA Function Decorators Give Warnings #5187

Closed
cliffburdick opened this issue Jul 16, 2018 · 5 comments · Fixed by #5288
Closed

CUDA Function Decorators Give Warnings #5187

cliffburdick opened this issue Jul 16, 2018 · 5 comments · Fixed by #5288
Assignees

Comments

@cliffburdick
Copy link

cliffburdick commented Jul 16, 2018

Subject: When compiling the markup files for CUDA code, I see the warnings.

Problem

The sphinx compiler shows:

Invalid definition: Expected identifier in nested name, got keyword: void [error at 15]
global void TL::est(float * a)

I'm guessing this is because the parser doesn't recognize the device and global decorators since it's cuda-specific. Is there a workaround for this? There should be two underscores on global and device, but github's markdown seems to make it bold.

@jakobandersen
Copy link
Contributor

jakobandersen commented Jul 17, 2018

I assume this is with the C++ domain?
In that case, it is possible to tell Sphinx that global should be treated as a valid attribute: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-cpp_id_attributes.
That is, in conf.py insert something like: cpp_id_attributes = ["__global__", "__device__"]

(Perhaps we should improve the documentation to make this much clearer.)

@cliffburdick
Copy link
Author

cliffburdick commented Jul 17, 2018

Thanks @jakobandersen! That seemed to work for that case. Do you know if there's a way to fix it within the function definition itself on C++ functions that use restrict? Here's an example:

If declarator-id:
Invalid definition: Expecting "," or ")" in parameters_and_qualifiers, got "a". [error at 72]
global void TL::est2(float*restrict a)

It looks similar to this issue:

#2682

But cpp_paren_attributes still gives the errors

@dabe5
Copy link

dabe5 commented Jul 26, 2018

Namaste

@dabe5
Copy link

dabe5 commented Jul 26, 2018

Kolkata

@jakobandersen
Copy link
Contributor

The cpp_paren_attributes is for custom attributes that takes an argument, so that is not the right one to use here. Attributes are only parsed in a few places, and as part of declarators was not one of them. On master, which will become version 1.8, it should work now. You just have to add __restrict__ to cpp_id_attributes as well.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants