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

Add support for the PTX compilation API #385

Closed
eyalroz opened this issue Jul 16, 2022 · 1 comment
Closed

Add support for the PTX compilation API #385

eyalroz opened this issue Jul 16, 2022 · 1 comment

Comments

@eyalroz
Copy link
Owner

eyalroz commented Jul 16, 2022

Somehow, NVIDIA's separate library for compiling PTX code into SASS escaped me...

It's documented at:

https://docs.nvidia.com/cuda/ptx-compiler-api/index.html

and we should definitely add support for it.

There's a "handle" type, similar to an NVRTC "program"; and the functions are:

Functions:

  • nvPTXCompilerCompile ( nvPTXCompilerHandle compiler, int numCompileOptions, const char** compileOptions )
    Compile a PTX program with the given compiler options.
  • nvPTXCompilerCreate ( nvPTXCompilerHandle* compiler, size_t ptxCodeLen, const char* ptxCode )
    Obtains the handle to an instance of the PTX compiler initialized with the given PTX program ptxCode.
  • nvPTXCompilerDestroy ( nvPTXCompilerHandle* compiler )
    Destroys and cleans the already created PTX compiler.
  • nvPTXCompilerGetCompiledProgram ( nvPTXCompilerHandle compiler, void* binaryImage )
    Obtains the image of the compiled program.
  • nvPTXCompilerGetCompiledProgramSize ( nvPTXCompilerHandle compiler, size_t* binaryImageSize )
    Obtains the size of the image of the compiled program.
  • nvPTXCompilerGetErrorLog ( nvPTXCompilerHandle compiler, char* errorLog )
    Query the error message that was seen previously for the handle.
  • nvPTXCompilerGetErrorLogSize ( nvPTXCompilerHandle compiler, size_t* errorLogSize )
    Query the size of the error message that was seen previously for the handle.
  • nvPTXCompilerGetInfoLog ( nvPTXCompilerHandle compiler, char* infoLog )
    Query the information message that was seen previously for the handle.
  • nvPTXCompilerGetInfoLogSize ( nvPTXCompilerHandle compiler, size_t* infoLogSize )
    Query the size of the information message that was seen previously for the handle.

and a version function:

  • nvPTXCompileResult nvPTXCompilerGetVersion] ( unsigned int* major, unsigned int* minor )

Need to think about where that's going to go, namespace-wise (and reconsider the same for NVRTC - if it even has a version number).

@eyalroz
Copy link
Owner Author

eyalroz commented Jul 16, 2022

We could have a single interface for CUDA C++ and for PTX, and this makes extra sense because both can be compiled into SASS; but - the options for PTX compilations are not quite the same PTX, CUDA C++.

eyalroz added a commit that referenced this issue Jul 22, 2022
…interface for NVRTC programs.

Split the `program_t` class in two: A builder-ish `program_t` and a `compilation_output_t` type, produced by compilation of a program. The former lets you easily add or change settings, the latter holds all of the post-compilation methods for locating named globals and getting logs, PTX and cubin. This split should later also help us introduce the PTX compilation mechanism.
eyalroz added a commit that referenced this issue Jul 22, 2022
…interface for NVRTC programs.

Split the `program_t` class in two: A builder-ish `program_t` and a `compilation_output_t` type, produced by compilation of a program. The former lets you easily add or change settings, the latter holds all of the post-compilation methods for locating named globals and getting logs, PTX and cubin. This split should later also help us introduce the PTX compilation mechanism.
eyalroz added a commit that referenced this issue Jul 22, 2022
…interface for NVRTC programs.

Split the `program_t` class in two: A builder-ish `program_t` and a `compilation_output_t` type, produced by compilation of a program. The former lets you easily add or change settings, the latter holds all of the post-compilation methods for locating named globals and getting logs, PTX and cubin. This split should later also help us introduce the PTX compilation mechanism.
eyalroz added a commit that referenced this issue Jul 22, 2022
…interface for NVRTC programs.

Split the `program_t` class in two: A builder-ish `program_t` and a `compilation_output_t` type, produced by compilation of a program. The former lets you easily add or change settings, the latter holds all of the post-compilation methods for locating named globals and getting logs, PTX and cubin. This split should later also help us introduce the PTX compilation mechanism.
eyalroz added a commit that referenced this issue Jul 22, 2022
…interface for NVRTC programs.

Split the `program_t` class in two: A builder-ish `program_t` and a `compilation_output_t` type, produced by compilation of a program. The former lets you easily add or change settings, the latter holds all of the post-compilation methods for locating named globals and getting logs, PTX and cubin. This split should later also help us introduce the PTX compilation mechanism.
eyalroz added a commit that referenced this issue Jul 22, 2022
…interface for NVRTC programs.

Split the `program_t` class in two: A builder-ish `program_t` and a `compilation_output_t` type, produced by compilation of a program. The former lets you easily add or change settings, the latter holds all of the post-compilation methods for locating named globals and getting logs, PTX and cubin. This split should later also help us introduce the PTX compilation mechanism.
eyalroz added a commit that referenced this issue Aug 27, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Aug 27, 2022
…sing the version number accordingly to 0.6.0.

* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Aug 30, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Aug 30, 2022
…sing the version number accordingly to 0.6.0.

* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Sep 9, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Sep 9, 2022
…sing the version number accordingly to 0.6.0.

* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Sep 10, 2022
…sing the version number accordingly to 0.6.0.

* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Sep 10, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Sep 10, 2022
…sing the version number accordingly to 0.6.0.

* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 8, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Oct 8, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 8, 2022
eyalroz added a commit that referenced this issue Oct 8, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Oct 8, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 8, 2022
eyalroz added a commit that referenced this issue Oct 8, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Oct 8, 2022
… versions.

Caveat: For now, it's only avaialble as a static library - so that's what we have to find.
eyalroz added a commit that referenced this issue Oct 8, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 10, 2022
eyalroz added a commit that referenced this issue Oct 10, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Oct 10, 2022
… versions.

Caveat: For now, it's only avaialble as a static library - so that's what we have to find.
eyalroz added a commit that referenced this issue Oct 10, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 10, 2022
eyalroz added a commit that referenced this issue Oct 17, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Oct 17, 2022
… versions.

Caveat: For now, it's only avaialble as a static library - so that's what we have to find.
eyalroz added a commit that referenced this issue Oct 17, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 17, 2022
eyalroz added a commit that referenced this issue Oct 25, 2022
* `nvrtc.hpp`
* `nvrtc` directory
* `nvrtc` `CMakeLists.txt` target

All renamed to account for how, soon, we'll have more than one kind of real-time compilation.
eyalroz added a commit that referenced this issue Oct 25, 2022
… versions.

Caveat: For now, it's only avaialble as a static library - so that's what we have to find.
eyalroz added a commit that referenced this issue Oct 25, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 25, 2022
eyalroz added a commit that referenced this issue Oct 25, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 25, 2022
eyalroz added a commit that referenced this issue Oct 27, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 27, 2022
eyalroz added a commit that referenced this issue Oct 28, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 28, 2022
eyalroz added a commit that referenced this issue Oct 28, 2022
eyalroz added a commit that referenced this issue Oct 28, 2022
eyalroz added a commit that referenced this issue Oct 28, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 28, 2022
eyalroz added a commit that referenced this issue Oct 28, 2022
* Now using a `source_kind_t` enum with one value for PTX and another for CUDA C++
* Added some error-reporting machinery using `source_kind_t` for code utilizing NVRTC and the PTX compiler (eac of which having their own error codes)
* Templated RTC-related class: `compilation_options_t`, `program_t`, `compilation_output_t`
* Added a dependency on the `nvptxcompiler` library (with allowance for when only the static version is available)
* Added another example program - another variant of `vectorAdd`, very similar to vectorAdd_nvrtc, except that it uses a PTX source and PTX compilation to get an executable kernel
eyalroz added a commit that referenced this issue Oct 28, 2022
eyalroz added a commit that referenced this issue Oct 29, 2022
eyalroz added a commit that referenced this issue Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant