Repository navigation
Support for NVRTC kernels - #138
Merged
Merged
Conversation
Signed-off-by: Tim Moon <tmoon@nvidia.com>
NVRTC gives compilation errors at runtime. Everything else compiles and passes tests as expected. Signed-off-by: Tim Moon <tmoon@nvidia.com>
NVRTC kernel compiles, runs, and passes tests with FP32. Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Added utility header for CUDA Runtime API. Optimized concat_strings function. Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
…UDA header dir Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
ptrendx
reviewed
Apr 9, 2023
| # See LICENSE for license information. | ||
|
|
||
| # Function to convert file to C++ header with string | ||
| function(convert_file_to_string_header file_ string_header string_name) |
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Member
Author
|
Evaluating FP8 transposes on an H100 SXM for square matrices with nice dims (power of two or halfway between powers of two) and ugly dims (primes 20, 40, ..., 400): The NVRTC kernel gets better performance than the baseline with small sizes (dim<2k), although we are clearly hitting up against kernel launch overheads. I do observe a ~1% perf regression at large scale though. We see the generalized implementation gets much worse perf than the NVRTC kernel, likely due to the large amount of bounds checking, but the baseline implementation doesn't support these sizes at all. |
nouiz
reviewed
Apr 11, 2023
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Review suggestion from @nouiz Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Member
Author
|
/te-ci |
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Member
Author
|
/te-ci |
ptrendx
reviewed
May 16, 2023
ptrendx
reviewed
May 16, 2023
ptrendx
reviewed
May 16, 2023
Check build-time CUDA include path for run-time CUDA headers. Handle case where CUDA context is initially uninitialized. Signed-off-by: Tim Moon <tmoon@nvidia.com>
Member
Author
|
/te-ci |
4 of 13 tasks
xiaoteng-cui-mt
pushed a commit
to MooreThreads/MT-TransformerEngine
that referenced
this pull request
Oct 9, 2026
* Initial implementation of NVRTC infrastructure Signed-off-by: Tim Moon <tmoon@nvidia.com> * Initial NVRTC impl for transpose NVRTC gives compilation errors at runtime. Everything else compiles and passes tests as expected. Signed-off-by: Tim Moon <tmoon@nvidia.com> * Debug NVRTC transpose impl NVRTC kernel compiles, runs, and passes tests with FP32. Signed-off-by: Tim Moon <tmoon@nvidia.com> * Use variadic template for kernel arguments in RTC kernel launch func Signed-off-by: Tim Moon <tmoon@nvidia.com> * Refactoring Added utility header for CUDA Runtime API. Optimized concat_strings function. Signed-off-by: Tim Moon <tmoon@nvidia.com> * Add helper function for regex substitutions in strings Signed-off-by: Tim Moon <tmoon@nvidia.com> * Add option to disable NVRTC support Signed-off-by: Tim Moon <tmoon@nvidia.com> * Add support for header includes in NVRTC kernels Signed-off-by: Tim Moon <tmoon@nvidia.com> * Access lazily-initialized CUDA driver lib and add option to specify CUDA header dir Signed-off-by: Tim Moon <tmoon@nvidia.com> * Configure NVRTC transpose kernel with simple perf model Signed-off-by: Tim Moon <tmoon@nvidia.com> * Revert change to tests Signed-off-by: Tim Moon <tmoon@nvidia.com> * Style fixes Signed-off-by: Tim Moon <tmoon@nvidia.com> * Add prime-valued test cases Signed-off-by: Tim Moon <tmoon@nvidia.com> * Fix multiple definition error Signed-off-by: Tim Moon <tmoon@nvidia.com> * Optimize NVRTC transpose kernel for small data sizes Signed-off-by: Tim Moon <tmoon@nvidia.com> * Mention NVRTC in docs Signed-off-by: Tim Moon <tmoon@nvidia.com> * Add unit tests for NVRTC and string utils Signed-off-by: Tim Moon <tmoon@nvidia.com> * Add comment in install docs about NVRTC Review suggestion from @nouiz Signed-off-by: Tim Moon <tmoon@nvidia.com> * Debug perf model for RTC transpose kernel Signed-off-by: Tim Moon <tmoon@nvidia.com> * Remove NVRTC discussion from docs Signed-off-by: Tim Moon <tmoon@nvidia.com> * Require CUDA headers unless NVRTC is explicitly disabled Signed-off-by: Tim Moon <tmoon@nvidia.com> * Use diagonal coords in transpose kernel to avoid partition camping Signed-off-by: Tim Moon <tmoon@nvidia.com> * Use std::call_once for thread-safety Signed-off-by: Tim Moon <tmoon@nvidia.com> * Minor fixes Signed-off-by: Tim Moon <tmoon@nvidia.com> * Debug CMake error Signed-off-by: Tim Moon <tmoon@nvidia.com> * Remove unnecessary call_once Signed-off-by: Tim Moon <tmoon@nvidia.com> * Remove diagonal coordinates from transpose kernel Signed-off-by: Tim Moon <tmoon@nvidia.com> * Use size_t indices instead of int Signed-off-by: Tim Moon <tmoon@nvidia.com> * Review suggestions from @ptrendx Check build-time CUDA include path for run-time CUDA headers. Handle case where CUDA context is initially uninitialized. Signed-off-by: Tim Moon <tmoon@nvidia.com> --------- Signed-off-by: Tim Moon <tmoon@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR adds basic support for run-time compilation of kernels with the goals of reducing binary size, reducing compilation time, and enabling more configurable kernel optimizations.
Changes:
transposeusing similar perf optimizations as Use 4B vector loads/stores in cast-transpose kernel for small matrices #101Tasks:
Future work: