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

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

HIP Runtime API Reference: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hip/checkouts/docs-6.1.0/include/hip/hiprtc.h Source File
hiprtc.h
Go to the documentation of this file.
1/*
2Copyright (c) 2015 - 2023 Advanced Micro Devices, Inc. All rights reserved.
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22#pragma once
23
24#include <hip/hip_common.h>
25
26#if !defined(__HIP_PLATFORM_AMD__) && defined(__HIP_PLATFORM_NVIDIA__)
27#include <hip/nvidia_detail/nvidia_hiprtc.h>
28#elif defined(__HIP_PLATFORM_AMD__) && !defined(__HIP_PLATFORM_NVIDIA__)
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34#include <stdlib.h>
35
36#if !defined(_WIN32)
37#pragma GCC visibility push(default)
38#endif
39
64
102
127typedef struct ihiprtcLinkState* hiprtcLinkState;
142
153hiprtcResult hiprtcVersion(int* major, int* minor);
154
159typedef struct _hiprtcProgram* hiprtcProgram;
160
174 const char* name_expression);
175
191 int numOptions,
192 const char** options);
193
215 const char* src,
216 const char* name,
217 int numHeaders,
218 const char** headers,
219 const char** includeNames);
220
232
251 const char* name_expression,
252 const char** lowered_name);
253
264
275 size_t* logSizeRet);
276
287
298
309
321
334hiprtcResult hiprtcLinkCreate(unsigned int num_options, hiprtcJIT_option* option_ptr,
335 void** option_vals_pptr, hiprtcLinkState* hip_link_state_ptr);
336
356 const char* file_path, unsigned int num_options,
357 hiprtcJIT_option* options_ptr, void** option_values);
358
380 void* image, size_t image_size, const char* name,
381 unsigned int num_options, hiprtcJIT_option* options_ptr,
382 void** option_values);
383
398hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void** bin_out, size_t* size_out);
399
410
411#if !defined(_WIN32)
412#pragma GCC visibility pop
413#endif
414
415#ifdef __cplusplus
416}
417#endif /* __cplusplus */
418
419#else
420#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
421#endif
hiprtcJITInputType
Definition hiprtc.h:106
hiprtcResult
Definition hiprtc.h:49
hiprtcJIT_option
Definition hiprtc.h:69
@ HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES
Number of legacy input type.
Definition hiprtc.h:113
@ HIPRTC_JIT_INPUT_CUBIN
Input cubin.
Definition hiprtc.h:107
@ HIPRTC_JIT_INPUT_PTX
Input PTX.
Definition hiprtc.h:108
@ HIPRTC_JIT_INPUT_FATBINARY
Input fat binary.
Definition hiprtc.h:109
@ HIPRTC_JIT_INPUT_LIBRARY
Input library.
Definition hiprtc.h:111
@ HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE
LLVM bundled bitcode.
Definition hiprtc.h:115
@ HIPRTC_JIT_INPUT_NVVM
Input NVVM.
Definition hiprtc.h:112
@ HIPRTC_JIT_INPUT_LLVM_BITCODE
LLVM bitcode or IR assembly.
Definition hiprtc.h:114
@ HIPRTC_JIT_INPUT_OBJECT
Input object.
Definition hiprtc.h:110
@ HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE
LLVM archives of boundled bitcode.
Definition hiprtc.h:116
@ HIPRTC_JIT_NUM_INPUT_TYPES
Definition hiprtc.h:117
@ HIPRTC_ERROR_PROGRAM_CREATION_FAILURE
Failed to create program.
Definition hiprtc.h:52
@ HIPRTC_ERROR_INVALID_PROGRAM
Invalid program.
Definition hiprtc.h:54
@ HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION
No name expression after compilation.
Definition hiprtc.h:58
@ HIPRTC_ERROR_INVALID_OPTION
Invalid option.
Definition hiprtc.h:55
@ HIPRTC_ERROR_INVALID_INPUT
Invalid input.
Definition hiprtc.h:53
@ HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID
Invalid name expression.
Definition hiprtc.h:60
@ HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION
No lowered names before compilation.
Definition hiprtc.h:59
@ HIPRTC_SUCCESS
Success.
Definition hiprtc.h:50
@ HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE
Failed in builtin operation.
Definition hiprtc.h:57
@ HIPRTC_ERROR_INTERNAL_ERROR
Internal error.
Definition hiprtc.h:61
@ HIPRTC_ERROR_COMPILATION
Compilation error.
Definition hiprtc.h:56
@ HIPRTC_ERROR_OUT_OF_MEMORY
Out of memory.
Definition hiprtc.h:51
@ HIPRTC_ERROR_LINKING
Error in linking.
Definition hiprtc.h:62
@ HIPRTC_JIT_FAST_COMPILE
CUDA Only Set fast compile.
Definition hiprtc.h:86
@ HIPRTC_JIT_INFO_LOG_BUFFER
CUDA Only Pointer to the buffer with logged information.
Definition hiprtc.h:73
@ HIPRTC_JIT_WALL_TIME
CUDA Only Value for total wall clock time.
Definition hiprtc.h:72
@ HIPRTC_JIT_ERROR_LOG_BUFFER
CUDA Only Pointer to the buffer with logged error(s)
Definition hiprtc.h:75
@ HIPRTC_JIT_GENERATE_LINE_INFO
CUDA Only Generate line number information.
Definition hiprtc.h:83
@ HIPRTC_JIT_IR_TO_ISA_OPT_EXT
Definition hiprtc.h:97
@ HIPRTC_JIT_TARGET
CUDA Only JIT target.
Definition hiprtc.h:79
@ HIPRTC_JIT_LOG_VERBOSE
CUDA Only Generate log verbose.
Definition hiprtc.h:82
@ HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES
CUDA Only Size of the buffer in bytes for logged info.
Definition hiprtc.h:74
@ HIPRTC_JIT_PREC_DIV
Definition hiprtc.h:92
@ HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES
CUDA Only Size of the buffer in bytes for logged error(s)
Definition hiprtc.h:76
@ HIPRTC_JIT_GENERATE_DEBUG_INFO
CUDA Only Generate debug information.
Definition hiprtc.h:81
@ HIPRTC_JIT_THREADS_PER_BLOCK
CUDA Only Number of thread per block.
Definition hiprtc.h:71
@ HIPRTC_JIT_MAX_REGISTERS
CUDA Only Maximum registers may be used in a thread, passed to compiler.
Definition hiprtc.h:70
@ HIPRTC_JIT_NUM_OPTIONS
Number of options.
Definition hiprtc.h:96
@ HIPRTC_JIT_NEW_SM3X_OPT
Definition hiprtc.h:85
@ HIPRTC_JIT_TARGET_FROM_HIPCONTEXT
CUDA Only The target context, which is the default.
Definition hiprtc.h:78
@ HIPRTC_JIT_OPTIMIZATION_LEVEL
Value of optimization level for generated codes, acceptable options -O0, -O1, -O2,...
Definition hiprtc.h:77
@ HIPRTC_JIT_GLOBAL_SYMBOL_NAMES
CUDA Only Array of device symbol names to be relocated to the host.
Definition hiprtc.h:87
@ HIPRTC_JIT_FTZ
Definition hiprtc.h:91
@ HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT
Definition hiprtc.h:99
@ HIPRTC_JIT_GLOBAL_SYMBOL_COUNT
CUDA Only Number of symbol count.
Definition hiprtc.h:89
@ HIPRTC_JIT_CACHE_MODE
CUDA Only Set cache mode.
Definition hiprtc.h:84
@ HIPRTC_JIT_FALLBACK_STRATEGY
CUDA Only Fallback strategy.
Definition hiprtc.h:80
@ HIPRTC_JIT_PREC_SQRT
Definition hiprtc.h:94
@ HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS
CUDA Only Array of host addresses to be relocated to the device.
Definition hiprtc.h:88
@ HIPRTC_JIT_LTO
Definition hiprtc.h:90
@ HIPRTC_JIT_FMA
Definition hiprtc.h:95
__DEVICE__ double log(double __x)
Returns the natural logarithm of x.
Definition __clang_hip_math.h:958
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 hiprtcDestroyProgram(hiprtcProgram *prog)
Destroys an instance of given hiprtcProgram.
hiprtcResult hiprtcGetCode(hiprtcProgram prog, char *code)
Gets the pointer of compilation binary by the runtime compilation program instance.
hiprtcResult hiprtcVersion(int *major, int *minor)
Sets the parameters as major and minor version.
hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram prog, size_t *logSizeRet)
Gets the size of log generated by the runtime compilation program instance.
hiprtcResult hiprtcGetBitcode(hiprtcProgram prog, char *bitcode)
Gets the pointer of compiled bitcode by the runtime compilation program instance.
struct ihiprtcLinkState * hiprtcLinkState
Definition hiprtc.h:127
struct _hiprtcProgram * hiprtcProgram
Definition hiprtc.h:159