Skip to content

Commit ba14651

Browse files
committed
Revert "SWDEV-489106 - Hip changes for Linker APIs"
This reverts commit 2b80843. Reason for revert: <Merge with other two patches after build issue fixed> Change-Id: I007755e2c258bea3acf4c4cad33cb86ba8a5566d
1 parent f05d536 commit ba14651

File tree

3 files changed

+74
-288
lines changed

3 files changed

+74
-288
lines changed

include/hip/hip_runtime_api.h

Lines changed: 23 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ THE SOFTWARE.
3333
#include <string.h> // for getDeviceProp
3434
#include <hip/hip_version.h>
3535
#include <hip/hip_common.h>
36-
#include <hip/linker_types.h>
3736

3837
enum {
3938
HIP_SUCCESS = 0,
@@ -626,7 +625,6 @@ typedef struct hipIpcEventHandle_st {
626625
} hipIpcEventHandle_t;
627626
typedef struct ihipModule_t* hipModule_t;
628627
typedef struct ihipModuleSymbol_t* hipFunction_t;
629-
typedef struct ihipLinkState_t* hipLinkState_t;
630628
/**
631629
* HIP memory pool
632630
*/
@@ -1139,6 +1137,29 @@ typedef struct hipMemPoolPtrExportData {
11391137
unsigned char reserved[64];
11401138
} hipMemPoolPtrExportData;
11411139

1140+
/**
1141+
* hipJitOption
1142+
*/
1143+
typedef enum hipJitOption {
1144+
hipJitOptionMaxRegisters = 0,
1145+
hipJitOptionThreadsPerBlock,
1146+
hipJitOptionWallTime,
1147+
hipJitOptionInfoLogBuffer,
1148+
hipJitOptionInfoLogBufferSizeBytes,
1149+
hipJitOptionErrorLogBuffer,
1150+
hipJitOptionErrorLogBufferSizeBytes,
1151+
hipJitOptionOptimizationLevel,
1152+
hipJitOptionTargetFromContext,
1153+
hipJitOptionTarget,
1154+
hipJitOptionFallbackStrategy,
1155+
hipJitOptionGenerateDebugInfo,
1156+
hipJitOptionLogVerbose,
1157+
hipJitOptionGenerateLineInfo,
1158+
hipJitOptionCacheMode,
1159+
hipJitOptionSm3xOpt,
1160+
hipJitOptionFastCompile,
1161+
hipJitOptionNumOptions
1162+
} hipJitOption;
11421163
/**
11431164
* @warning On AMD devices and some Nvidia devices, these hints and controls are ignored.
11441165
*/
@@ -5877,86 +5898,6 @@ hipError_t hipModuleLoadData(hipModule_t* module, const void* image);
58775898
*/
58785899
hipError_t hipModuleLoadDataEx(hipModule_t* module, const void* image, unsigned int numOptions,
58795900
hipJitOption* options, void** optionValues);
5880-
/**
5881-
* @brief Completes the linking of the given program.
5882-
* @param [in] state hip link state
5883-
* @param [in] type Type of the input data or bitcode
5884-
* @param [in] data Input data which is null terminated
5885-
* @param [in] size Size of the input data
5886-
* @param [in] name Optional name for this input
5887-
* @param [in] numOptions Size of the options
5888-
* @param [in] options Array of options applied to this input
5889-
* @param [in] optionValues Array of option values cast to void*
5890-
*
5891-
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidHandle
5892-
*
5893-
* If adding the file fails, it will
5894-
* @return #hipErrorInvalidConfiguration
5895-
*
5896-
* @see hipError_t
5897-
*/
5898-
hipError_t hipLinkAddData(hipLinkState_t state, hipJitInputType type, void* data, size_t size,
5899-
const char* name, unsigned int numOptions, hipJitOption* options,
5900-
void** optionValues);
5901-
5902-
/**
5903-
* @brief Adds a file with bit code to be linked with options
5904-
* @param [in] state hip link state
5905-
* @param [in] type Type of the input data or bitcode
5906-
* @param [in] path Path to the input file where bitcode is present
5907-
* @param [in] numOptions Size of the options
5908-
* @param [in] options Array of options applied to this input
5909-
* @param [in] optionValues Array of option values cast to void*
5910-
*
5911-
* @returns #hipSuccess, #hipErrorInvalidValue
5912-
*
5913-
* If adding the file fails, it will
5914-
* @return #hipErrorInvalidConfiguration
5915-
*
5916-
* @see hipError_t
5917-
*/
5918-
hipError_t hipLinkAddFile(hipLinkState_t state, hipJitInputType type, const char* path, unsigned int numOptions,
5919-
hipJitOption* options, void** optionValues);
5920-
5921-
/**
5922-
* @brief Completes the linking of the given program.
5923-
* @param [in] state hip link state
5924-
* @param [out] hipBinOut Upon success, points to the output binary
5925-
* @param [out] sizeOut Size of the binary is stored (optional)
5926-
*
5927-
* @returns #hipSuccess #hipErrorInvalidValue
5928-
*
5929-
* If adding the data fails, it will
5930-
* @return #hipErrorInvalidConfiguration
5931-
*
5932-
* @see hipError_t
5933-
*/
5934-
5935-
hipError_t hipLinkComplete(hipLinkState_t state, void** hipBinOut, size_t* sizeOut);
5936-
5937-
/**
5938-
* @brief Creates the link instance via hip APIs.
5939-
* @param [in] numOptions Number of options
5940-
* @param [in] option Array of options
5941-
* @param [in] optionValues Array of option values cast to void*
5942-
* @param [out] stateOut hip link state created upon success
5943-
*
5944-
* @returns #hipSuccess #hipErrorInvalidValue #hipErrorInvalidConfiguration
5945-
*
5946-
* @see hipSuccess
5947-
*/
5948-
hipError_t hipLinkCreate(unsigned int numOptions, hipJitOption* options,
5949-
void** optionValues, hipLinkState_t* stateOut);
5950-
/**
5951-
* @brief Deletes the link instance via hip APIs.
5952-
* @param [in] state link state instance
5953-
*
5954-
* @returns #hipSuccess #hipErrorInvalidValue
5955-
*
5956-
* @see hipSuccess
5957-
*/
5958-
hipError_t hipLinkDestroy(hipLinkState_t state);
5959-
59605901
/**
59615902
* @brief launches kernel f with launch parameters and shared memory on stream with arguments passed
59625903
* to kernelparams or extra

include/hip/hiprtc.h

Lines changed: 51 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ THE SOFTWARE.
2222
#pragma once
2323

2424
#include <hip/hip_common.h>
25-
#include <hip/linker_types.h>
2625

2726
#if !defined(__HIP_PLATFORM_AMD__) && defined(__HIP_PLATFORM_NVIDIA__)
2827
#include <hip/nvidia_detail/nvidia_hiprtc.h>
@@ -42,7 +41,7 @@ extern "C" {
4241
*
4342
* @addtogroup GlobalDefs
4443
* @{
45-
*
44+
*
4645
*/
4746
/**
4847
* hiprtc error code
@@ -57,90 +56,66 @@ typedef enum hiprtcResult {
5756
HIPRTC_ERROR_COMPILATION = 6, ///< Compilation error
5857
HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7, ///< Failed in builtin operation
5958
HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8, ///< No name expression after compilation
60-
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9, ///< No lowered names before compilation
59+
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9, ///< No lowered names before compilation
6160
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10, ///< Invalid name expression
6261
HIPRTC_ERROR_INTERNAL_ERROR = 11, ///< Internal error
6362
HIPRTC_ERROR_LINKING = 100 ///< Error in linking
6463
} hiprtcResult;
64+
6565
/**
6666
* hiprtc JIT option
6767
*/
68-
#define hiprtcJIT_option hipJitOption
69-
#define HIPRTC_JIT_MAX_REGISTERS hipJitOptionMaxRegisters ///< CUDA Only Maximum registers may be used in a
70-
///< thread, passed to compiler
71-
#define HIPRTC_JIT_THREADS_PER_BLOCK hipJitOptionThreadsPerBlock ///< CUDA Only Number of thread per block
72-
#define HIPRTC_JIT_WALL_TIME hipJitOptionWallTime ///< CUDA Only Value for total wall clock time
73-
#define HIPRTC_JIT_INFO_LOG_BUFFER hipJitOptionInfoLogBuffer ///< CUDA Only Pointer to the buffer with
74-
///< logged information
75-
#define HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES hipJitOptionInfoLogBufferSizeBytes ///< CUDA Only Size of the buffer
76-
///< in bytes for logged info
77-
#define HIPRTC_JIT_ERROR_LOG_BUFFER hipJitOptionErrorLogBuffer ///< CUDA Only Pointer to the buffer
78-
///< with logged error(s)
79-
#define HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES hipJitOptionErrorLogBufferSizeBytes ///< CUDA Only Size of the buffer in
80-
///< bytes for logged error(s)
81-
#define HIPRTC_JIT_OPTIMIZATION_LEVEL hipJitOptionOptimizationLevel ///< Value of optimization level for
82-
///< generated codes, acceptable
83-
///< options -O0, -O1, -O2, -O3
84-
#define HIPRTC_JIT_TARGET_FROM_HIPCONTEXT hipJitOptionTargetFromContext ///< CUDA Only The target context,
85-
///< which is the default
86-
#define HIPRTC_JIT_TARGET hipJitOptionTarget ///< CUDA Only JIT target
87-
#define HIPRTC_JIT_FALLBACK_STRATEGY hipJitOptionFallbackStrategy ///< CUDA Only Fallback strategy
88-
#define HIPRTC_JIT_GENERATE_DEBUG_INFO hipJitOptionGenerateDebugInfo ///< CUDA Only Generate debug information
89-
#define HIPRTC_JIT_LOG_VERBOSE hipJitOptionLogVerbose ///< CUDA Only Generate log verbose
90-
#define HIPRTC_JIT_GENERATE_LINE_INFO hipJitOptionGenerateLineInfo ///< CUDA Only Generate line number information
91-
#define HIPRTC_JIT_CACHE_MODE hipJitOptionCacheMode ///< CUDA Only Set cache mode
92-
#define HIPRTC_JIT_NEW_SM3X_OPT hipJitOptionSm3xOpt ///< @deprecated CUDA Only New SM3X option.
93-
#define HIPRTC_JIT_FAST_COMPILE hipJitOptionFastCompile ///< CUDA Only Set fast compile
94-
#define HIPRTC_JIT_GLOBAL_SYMBOL_NAMES hipJitOptionGlobalSymbolNames ///< CUDA Only Array of device symbol names to be
95-
///< relocated to the host
96-
#define HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS hipJitOptionGlobalSymbolAddresses ///< CUDA Only Array of host addresses to be
97-
///< relocated to the device
98-
#define HIPRTC_JIT_GLOBAL_SYMBOL_COUNT hipJitOptionGlobalSymbolCount ///< CUDA Only Number of symbol count.
99-
#define HIPRTC_JIT_LTO hipJitOptionLto ///< @deprecated CUDA Only Enable link-time
100-
///< optimization for device code
101-
#define HIPRTC_JIT_FTZ hipJitOptionFtz ///< @deprecated CUDA Only Set
102-
///< single-precision denormals.
103-
#define HIPRTC_JIT_PREC_DIV hipJitOptionPrecDiv ///< @deprecated CUDA Only Set
104-
///< single-precision floating-point division
105-
///< and reciprocals
106-
#define HIPRTC_JIT_PREC_SQRT hipJitOptionPrecSqrt ///< @deprecated CUDA Only Set
107-
///< single-precision floating-point
108-
///< square root
109-
#define HIPRTC_JIT_FMA hipJitOptionFma ///< @deprecated CUDA Only Enable
110-
///< floating-point multiplies and
111-
///< adds/subtracts operations
112-
#define HIPRTC_JIT_POSITION_INDEPENDENT_CODE hipJitOptionPositionIndependentCode ///< CUDA Only Generates
113-
///< Position Independent code
114-
#define HIPRTC_JIT_MIN_CTA_PER_SM hipJitOptionMinCTAPerSM ///< CUDA Only Hints to JIT compiler
115-
///< the minimum number of CTAs frin
116-
///< kernel's grid to be mapped to SM
117-
#define HIPRTC_JIT_MAX_THREADS_PER_BLOCK hipJitOptionMaxThreadsPerBlock ///< CUDA only Maximum number of
118-
///< threads in a thread block
119-
#define HIPRTC_JIT_OVERRIDE_DIRECT_VALUES hipJitOptionOverrideDirectiveValues ///< CUDA only Override Directive
120-
///< Values
121-
#define HIPRTC_JIT_NUM_OPTIONS hipJitOptionNumOptions ///< Number of options
122-
#define HIPRTC_JIT_IR_TO_ISA_OPT_EXT hipJitOptionIRtoISAOptExt ///< HIP Only Linker options to be
123-
///< passed on to compiler
124-
#define HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT hipJitOptionIRtoISAOptCountExt ///< HIP Only Count of linker options
125-
///< to be passed on to
68+
69+
typedef enum hiprtcJIT_option {
70+
HIPRTC_JIT_MAX_REGISTERS = 0, ///< CUDA Only Maximum registers may be used in a thread, passed to compiler
71+
HIPRTC_JIT_THREADS_PER_BLOCK, ///< CUDA Only Number of thread per block
72+
HIPRTC_JIT_WALL_TIME, ///< CUDA Only Value for total wall clock time
73+
HIPRTC_JIT_INFO_LOG_BUFFER, ///< CUDA Only Pointer to the buffer with logged information
74+
HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES, ///< CUDA Only Size of the buffer in bytes for logged info
75+
HIPRTC_JIT_ERROR_LOG_BUFFER, ///< CUDA Only Pointer to the buffer with logged error(s)
76+
HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, ///< CUDA Only Size of the buffer in bytes for logged error(s)
77+
HIPRTC_JIT_OPTIMIZATION_LEVEL, ///< Value of optimization level for generated codes, acceptable options -O0, -O1, -O2, -O3
78+
HIPRTC_JIT_TARGET_FROM_HIPCONTEXT, ///< CUDA Only The target context, which is the default
79+
HIPRTC_JIT_TARGET, ///< CUDA Only JIT target
80+
HIPRTC_JIT_FALLBACK_STRATEGY, ///< CUDA Only Fallback strategy
81+
HIPRTC_JIT_GENERATE_DEBUG_INFO, ///< CUDA Only Generate debug information
82+
HIPRTC_JIT_LOG_VERBOSE, ///< CUDA Only Generate log verbose
83+
HIPRTC_JIT_GENERATE_LINE_INFO, ///< CUDA Only Generate line number information
84+
HIPRTC_JIT_CACHE_MODE, ///< CUDA Only Set cache mode
85+
HIPRTC_JIT_NEW_SM3X_OPT, ///< @deprecated CUDA Only New SM3X option.
86+
HIPRTC_JIT_FAST_COMPILE, ///< CUDA Only Set fast compile
87+
HIPRTC_JIT_GLOBAL_SYMBOL_NAMES, ///< CUDA Only Array of device symbol names to be relocated to the host
88+
HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS, ///< CUDA Only Array of host addresses to be relocated to the device
89+
HIPRTC_JIT_GLOBAL_SYMBOL_COUNT, ///< CUDA Only Number of symbol count.
90+
HIPRTC_JIT_LTO, ///< @deprecated CUDA Only Enable link-time optimization for device code
91+
HIPRTC_JIT_FTZ, ///< @deprecated CUDA Only Set single-precision denormals.
92+
HIPRTC_JIT_PREC_DIV, ///< @deprecated CUDA Only Set single-precision floating-point division and
93+
///< reciprocals
94+
HIPRTC_JIT_PREC_SQRT, ///< @deprecated CUDA Only Set single-precision floating-point square root
95+
HIPRTC_JIT_FMA, ///< @deprecated CUDA Only Enable floating-point multiplies and adds/subtracts operations
96+
HIPRTC_JIT_NUM_OPTIONS, ///< Number of options
97+
HIPRTC_JIT_IR_TO_ISA_OPT_EXT = 10000, ///< Linker options to be passed on to compiler
98+
/// @note Only supported for the AMD platform.
99+
HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT, ///< Count of linker options to be passed on to
100+
///< compiler @note Only supported for the AMD platform
101+
} hiprtcJIT_option;
102+
126103
/**
127104
* hiprtc JIT input type
128105
*/
129-
#define hiprtcJITInputType hipJitInputType
130-
#define HIPRTC_JIT_INPUT_CUBIN hipJitInputCubin ///< Cuda only Input Cubin
131-
#define HIPRTC_JIT_INPUT_PTX hipJitInputPtx ///< Cuda only Input PTX
132-
#define HIPRTC_JIT_INPUT_FATBINARY hipJitInputFatBinary ///< Cuda Only Input FAT Binary
133-
#define HIPRTC_JIT_INPUT_OBJECT hipJitInputObject ///< Cuda Only Host Object with embedded device code
134-
#define HIPRTC_JIT_INPUT_LIBRARY hipJitInputLibrary ///< Cuda Only Archive of Host Objects with embedded device code
135-
#define HIPRTC_JIT_INPUT_NVVM hipJitInputNvvm ///< @deprecated CUDA only High Level intermediate code for LTO
136-
#define HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES hipJitNumLegacyInputTypes ///< Count of Legacy Input Types
137-
#define HIPRTC_JIT_INPUT_LLVM_BITCODE hipJitInputLLVMBitcode ///< HIP Only LLVM Bitcode or IR assembly
138-
#define HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE hipJitInputLLVMBundledBitcode ///< HIP Only LLVM Clang Bundled Code
139-
#define HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE hipJitInputLLVMArchivesOfBundledBitcode ///< HIP Only LLVM
140-
///< Archives of
141-
///< Bundled Bitcode
142-
#define HIPRTC_JIT_INPUT_SPIRV hipJitInputSpirv ///< HIP Only SPIRV Code Object
143-
#define HIPRTC_JIT_NUM_INPUT_TYPES hipJitNumInputTypes ///< Count of Input Types
106+
typedef enum hiprtcJITInputType {
107+
HIPRTC_JIT_INPUT_CUBIN = 0, ///< Input cubin
108+
HIPRTC_JIT_INPUT_PTX, ///< Input PTX
109+
HIPRTC_JIT_INPUT_FATBINARY, ///< Input fat binary
110+
HIPRTC_JIT_INPUT_OBJECT, ///< Input object
111+
HIPRTC_JIT_INPUT_LIBRARY, ///< Input library
112+
HIPRTC_JIT_INPUT_NVVM, ///< Input NVVM
113+
HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES, ///< Number of legacy input type
114+
HIPRTC_JIT_INPUT_LLVM_BITCODE = 100, ///< LLVM bitcode or IR assembly
115+
HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE = 101, ///< LLVM bundled bitcode
116+
HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE = 102, ///< LLVM archives of boundled bitcode
117+
HIPRTC_JIT_NUM_INPUT_TYPES = (HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES + 3)
118+
} hiprtcJITInputType;
144119
/**
145120
* @}
146121
*/

0 commit comments

Comments
 (0)