NVIDIA / jitify

A single-header C++ library for simplifying the use of CUDA Runtime Compilation (NVRTC).
BSD 3-Clause "New" or "Revised" License
518 stars 64 forks source link

Is it possible to create program from cuBin or PTX? #106

Open FdyCN opened 2 years ago

FdyCN commented 2 years ago

Hi guys, i used jitify.hpp in my project, and it works just fine. However, i still have a question: according to this: https://github.com/NVIDIA/jitify/blob/b22bf7d1dce113c8f67d195c7e6e497858b6fdb8/jitify.hpp#L3507 seems it's no way to create progtam from cuBin or PTX? or how can i create a CUFunction by giving cuBin or PTX? Thank you very much!

benbarsdell commented 2 years ago

In the jitify2 API (under development) you can do this: https://github.com/NVIDIA/jitify/blob/ca7f794/jitify2.hpp#L2153

FdyCN commented 2 years ago

In the jitify2 API (under development) you can do this: https://github.com/NVIDIA/jitify/blob/ca7f794/jitify2.hpp#L2153

@benbarsdell Thx a lot, glad to hear that. i reviewed this branch. and is this tool necessary? https://github.com/NVIDIA/jitify/blob/jitify2/jitify2_preprocess.cpp Must i use this tool to pre-build or pre-compiling obj when i have some headers dependencies in my kernel source?Can cuBin( PTX ) carry these dependencies( it can be regard as another kind of pre-build)?

I appreciate and wait for jitify2 : )

benbarsdell commented 1 year ago

Sorry I missed this. You don't have to use jitify2_preprocess, other workflows are possible. If you are starting from ptx/cubin, you can create a CompiledProgramData object directly from ptx or cubin and then just link and execute it.