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

Generate PTX artifacts #26

Open
graphicsMan opened this issue Nov 3, 2022 · 7 comments
Open

Generate PTX artifacts #26

graphicsMan opened this issue Nov 3, 2022 · 7 comments

Comments

@graphicsMan
Copy link

Hi. Is there a way to use rules_cuda to generate PTX? For example, this is useful for OptiX programming.

@ryanleary
Copy link
Collaborator

Can you share more about what you'd then do with them?

It'd be pretty easy to keep around the intermediate ptx files, but I want to better understand the workflow to see if what you really need is a different set of rules (if you intend to modify the ptx and continue compilation, etc)

@graphicsMan
Copy link
Author

Sure. Currently I'm using Buck, BTW, not Bazel, so concepts are close but not 1:1. I have an offline process using a simple Makefile to build PTX output. via nvcc Then I use filegroups to make those available to other targets, and I use that to set an environment variable for where to find the PTX files, which I then pass to OptiX functions.

@cloudhan
Copy link
Collaborator

cloudhan commented Nov 4, 2022

This is quite reasonable usage, it just skip the stage1 compilation and only use the stage2 compilation. But this does not fit well into the actions.compile design. Becase it support generate multiple virtual archs.

@graphicsMan
Copy link
Author

Is that something you'd consider adding, either as a separate rule or as some kind of setting for an existing rule? Agreed, it would be ideal to be also able to select the generated archs.

@cloudhan
Copy link
Collaborator

cloudhan commented Nov 4, 2022

It seems that what we need is actions.ptxas, that is, a new rule that calls ptxas directly, instead of trying to mold it into actions.compile. If it is the case, then the problem will be much easier. Then all you need is to feed the generated objects into a cuda_library.

Maybe do it in the future.

@graphicsMan
Copy link
Author

Sounds great. Thanks for considering it.

@cloudhan
Copy link
Collaborator

cloudhan commented Nov 8, 2022

Oops, I took it as generate from PTX. But OP is requiring generate to PTX. That is, we need to extend actions.compile to support produce ptx. But as well as add actions.ptxas to support consuming it after all.

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

No branches or pull requests

3 participants