Support Jitify ?
See original GitHub issueThis is more for my own little curiosity than a feature request, but I thought it’s worth discussing.
It is not possible to compile Thrust/CUB code in NVRTC because many system headers are missing, which was why @emcastillo struggled in #2629 and we still have to keep a copy of our own Thrust complex headers. Jitify claims to provide an easy solution to address this.
I have been looking into jitify’s implementation lately, and I think the key idea is to:
- Recursively find out what header (and its absolute path) should be included (by repeating compiling -> inspecting error log)
- Fix the headers: for example, provide some stubs to patch a few C++
std
functions or system headers so that they can work as__device__
functions, remove static variables, fixpragma
, etc
Since we have most of the toolchain in place (compile/launch/CUDA API/etc), especially #3319 is now merged, I think it is not super difficult to address this. I can think of two design choices:
- Wrap jitify in
cupy.cuda.jitify
: Ideally, we still use our NVRTC wrapper to do compilation, and only take all these lookup implementations as-is so we don’t reinvent the wheel. Unfortunately it is currently not possible, as many logics are baked in jitify’s public APIs, and it requires some refactoring on the their side for us to reuse. - Implement the compile-error search loop by ourselves in
cupy/cuda/compiler.py
: This would require kinda reimplementing what’s done in jitify, but only for a small part (I hope). The pro is jitify doesn’t need to be a dependency and we just reuse what’s already available (very important for code maintenance), and the cons are that it takes more effort and that it needs to copy a significant amount of code from jitify (mainly those code patches).
I think a few RAPIDS libraries like cuDF use jitify. I will dig into how they use it…
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (10 by maintainers)
Top Results From Across the Web
NVIDIA/jitify: A single-header C++ library for ... - GitHub
Support for CUDA versions 7.0, 7.5, 8.0, 9.x, 10.x, on both Linux and Windows; Convenient parallel_for function and lambda support; *New* jitify::experimental ...
Read more >Combined Python/CUDA JIT for Flexible Acceleration in RAPIDS
Our framework uses the Numba Python compiler and Jitify CUDA just-in-time (JIT) compilation library to provide cuDF users the flexibility of Python with...
Read more >cupy/community - Gitter
CUDA 11.1 support has been added so now you can use CuPy with your GeForce RTX ... Python to CUDA, NVIDIA Jitify support,...
Read more >Check that `name_expressions` is iterable - Stack Overflow
When trying out the new jitify support planned for CuPy v9.x, I found that the name_expressions named argument to cupy.
Read more >User-Defined Kernels — CuPy 11.4.0 documentation
Accessing texture (surface) memory in RawKernel is supported via CUDA ... In this case, try enabling CuPy's Jitify support by setting jitify=True when ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@harrism just to note that https://github.com/NVIDIA/jitify/pull/39 has been merged.
@leofang if you’re just wanting some of the headers provided by Jitify, you might be better looking at using libcu++'s headers: https://github.com/NVIDIA/libcudacxx/tree/main/include/cuda/std.
These are more fully featured, and are being continually expanded to provide more coverage of the the C++ standard library, as well as some C headers.