/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-5.5.0/include/hip/hiprtc.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-5.5.0/include/hip/hiprtc.h Source File#

HIP Runtime API Reference: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-5.5.0/include/hip/hiprtc.h Source File
hiprtc.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2015 - 2021 Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 #pragma once
23 
24 #include <hip/hip_common.h>
25 
26 #if !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
27  #include <hip/nvidia_detail/nvidia_hiprtc.h>
28 #elif (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
29 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 #include <stdlib.h>
41 
42 #if !defined(_WIN32)
43 #pragma GCC visibility push (default)
44 #endif
45 
52 typedef enum hiprtcResult {
67 
68 typedef enum hiprtcJIT_option {
96 
97 typedef enum hiprtcJITInputType {
110 
111 typedef struct ihiprtcLinkState* hiprtcLinkState;
112 
124 const char* hiprtcGetErrorString(hiprtcResult result);
125 
133 hiprtcResult hiprtcVersion(int* major, int* minor);
134 
135 typedef struct _hiprtcProgram* hiprtcProgram;
136 
149  const char* name_expression);
150 
165  int numOptions,
166  const char** options);
167 
188  const char* src,
189  const char* name,
190  int numHeaders,
191  const char** headers,
192  const char** includeNames);
193 
205 
224  const char* name_expression,
225  const char** lowered_name);
226 
237 
248  size_t* logSizeRet);
249 
260 
270 hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog, size_t* codeSizeRet);
271 
282 
293 hiprtcResult hiprtcGetBitcodeSize(hiprtcProgram prog, size_t* bitcode_size);
294 
304 hiprtcResult hiprtcLinkCreate(unsigned int num_options, hiprtcJIT_option* option_ptr,
305  void** option_vals_pptr, hiprtcLinkState* hip_link_state_ptr);
306 
322  const char* file_path, unsigned int num_options,
323  hiprtcJIT_option* options_ptr, void** option_values);
324 
340  void* image, size_t image_size, const char* name,
341  unsigned int num_options, hiprtcJIT_option* options_ptr,
342  void** option_values);
343 
356 hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void** bin_out, size_t* size_out);
357 
371 
372 #if !defined(_WIN32)
373 #pragma GCC visibility pop
374 #endif
375 
376 #ifdef __cplusplus
377 }
378 #endif /* __cplusplus */
379 // doxygen end HIPrtc feature
383 #else
384 #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
385 #endif
hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram prog, size_t *logSizeRet)
Gets the size of log generated by the runtime compilation program instance.
hiprtcResult hiprtcAddNameExpression(hiprtcProgram prog, const char *name_expression)
Adds the given name exprssion to the runtime compilation program.
hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void **bin_out, size_t *size_out)
Completes the linking of the given program.
hiprtcResult hiprtcLinkAddFile(hiprtcLinkState hip_link_state, hiprtcJITInputType input_type, const char *file_path, unsigned int num_options, hiprtcJIT_option *options_ptr, void **option_values)
Adds a file with bit code to be linked with options.
hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog, const char *name_expression, const char **lowered_name)
Gets the lowered (mangled) name from an instance of hiprtcProgram with the given input parameters,...
const char * hiprtcGetErrorString(hiprtcResult result)
Returns text string message to explain the error which occurred.
hiprtcResult hiprtcCreateProgram(hiprtcProgram *prog, const char *src, const char *name, int numHeaders, const char **headers, const char **includeNames)
Creates an instance of hiprtcProgram with the given input parameters, and sets the output hiprtcProgr...
hiprtcResult hiprtcLinkCreate(unsigned int num_options, hiprtcJIT_option *option_ptr, void **option_vals_pptr, hiprtcLinkState *hip_link_state_ptr)
Creates the link instance via hiprtc APIs.
hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog, size_t *codeSizeRet)
Gets the size of compilation binary by the runtime compilation program instance.
hiprtcResult hiprtcLinkDestroy(hiprtcLinkState hip_link_state)
Deletes the link instance via hiprtc APIs.
hiprtcResult hiprtcGetProgramLog(hiprtcProgram prog, char *log)
Gets the log generated by the runtime compilation program instance.
hiprtcResult hiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char **options)
Compiles the given runtime compilation program.
hiprtcResult hiprtcLinkAddData(hiprtcLinkState hip_link_state, hiprtcJITInputType input_type, void *image, size_t image_size, const char *name, unsigned int num_options, hiprtcJIT_option *options_ptr, void **option_values)
Completes the linking of the given program.
hiprtcResult hiprtcGetBitcodeSize(hiprtcProgram prog, size_t *bitcode_size)
Gets the size of compiled bitcode by the runtime compilation program instance.
hiprtcResult hiprtcGetBitcode(hiprtcProgram prog, char *bitcode)
Gets the pointer of compiled bitcode by the runtime compilation program instance.
hiprtcJITInputType
Definition: hiprtc.h:97
hiprtcResult
Definition: hiprtc.h:52
hiprtcResult hiprtcDestroyProgram(hiprtcProgram *prog)
Destroys an instance of given hiprtcProgram.
struct ihiprtcLinkState * hiprtcLinkState
Definition: hiprtc.h:111
hiprtcResult hiprtcGetCode(hiprtcProgram prog, char *code)
Gets the pointer of compilation binary by the runtime compilation program instance.
struct _hiprtcProgram * hiprtcProgram
Definition: hiprtc.h:135
hiprtcResult hiprtcVersion(int *major, int *minor)
Sets the parameters as major and minor version.
hiprtcJIT_option
Definition: hiprtc.h:68
@ HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES
Definition: hiprtc.h:104
@ HIPRTC_JIT_INPUT_CUBIN
Definition: hiprtc.h:98
@ HIPRTC_JIT_INPUT_PTX
Definition: hiprtc.h:99
@ HIPRTC_JIT_INPUT_FATBINARY
Definition: hiprtc.h:100
@ HIPRTC_JIT_INPUT_LIBRARY
Definition: hiprtc.h:102
@ HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE
Definition: hiprtc.h:106
@ HIPRTC_JIT_INPUT_NVVM
Definition: hiprtc.h:103
@ HIPRTC_JIT_INPUT_LLVM_BITCODE
Definition: hiprtc.h:105
@ HIPRTC_JIT_INPUT_OBJECT
Definition: hiprtc.h:101
@ HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE
Definition: hiprtc.h:107
@ HIPRTC_JIT_NUM_INPUT_TYPES
Definition: hiprtc.h:108
@ HIPRTC_ERROR_PROGRAM_CREATION_FAILURE
Definition: hiprtc.h:55
@ HIPRTC_ERROR_INVALID_PROGRAM
Definition: hiprtc.h:57
@ HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION
Definition: hiprtc.h:61
@ HIPRTC_ERROR_INVALID_OPTION
Definition: hiprtc.h:58
@ HIPRTC_ERROR_INVALID_INPUT
Definition: hiprtc.h:56
@ HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID
Definition: hiprtc.h:63
@ HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION
Definition: hiprtc.h:62
@ HIPRTC_SUCCESS
Definition: hiprtc.h:53
@ HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE
Definition: hiprtc.h:60
@ HIPRTC_ERROR_INTERNAL_ERROR
Definition: hiprtc.h:64
@ HIPRTC_ERROR_COMPILATION
Definition: hiprtc.h:59
@ HIPRTC_ERROR_OUT_OF_MEMORY
Definition: hiprtc.h:54
@ HIPRTC_ERROR_LINKING
Definition: hiprtc.h:65
@ HIPRTC_JIT_FAST_COMPILE
Definition: hiprtc.h:85
@ HIPRTC_JIT_INFO_LOG_BUFFER
Definition: hiprtc.h:72
@ HIPRTC_JIT_WALL_TIME
Definition: hiprtc.h:71
@ HIPRTC_JIT_ERROR_LOG_BUFFER
Definition: hiprtc.h:74
@ HIPRTC_JIT_GENERATE_LINE_INFO
Definition: hiprtc.h:82
@ HIPRTC_JIT_TARGET
Definition: hiprtc.h:78
@ HIPRTC_JIT_LOG_VERBOSE
Definition: hiprtc.h:81
@ HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES
Definition: hiprtc.h:73
@ HIPRTC_JIT_PREC_DIV
Definition: hiprtc.h:91
@ HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES
Definition: hiprtc.h:75
@ HIPRTC_JIT_GENERATE_DEBUG_INFO
Definition: hiprtc.h:80
@ HIPRTC_JIT_THREADS_PER_BLOCK
Definition: hiprtc.h:70
@ HIPRTC_JIT_MAX_REGISTERS
Definition: hiprtc.h:69
@ HIPRTC_JIT_NUM_OPTIONS
Definition: hiprtc.h:94
@ HIPRTC_JIT_NEW_SM3X_OPT
Definition: hiprtc.h:84
@ HIPRTC_JIT_TARGET_FROM_HIPCONTEXT
Definition: hiprtc.h:77
@ HIPRTC_JIT_OPTIMIZATION_LEVEL
Definition: hiprtc.h:76
@ HIPRTC_JIT_GLOBAL_SYMBOL_NAMES
Definition: hiprtc.h:86
@ HIPRTC_JIT_FTZ
Definition: hiprtc.h:90
@ HIPRTC_JIT_GLOBAL_SYMBOL_COUNT
Definition: hiprtc.h:88
@ HIPRTC_JIT_CACHE_MODE
Definition: hiprtc.h:83
@ HIPRTC_JIT_FALLBACK_STRATEGY
Definition: hiprtc.h:79
@ HIPRTC_JIT_PREC_SQRT
Definition: hiprtc.h:92
@ HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS
Definition: hiprtc.h:87
@ HIPRTC_JIT_LTO
Definition: hiprtc.h:89
@ HIPRTC_JIT_FMA
Definition: hiprtc.h:93