SWDEV-427855 - Revert "SWDEV-427855 - hipamd change for profiler and TF fix"

This reverts commit 7478e90727.

Reason for revert: <Need rocprofiler changes to avoid PSDB failures>

Change-Id: I856b7ea30744f1b7bb099b6adbce2155201be539


[ROCm/clr commit: 57cb840058]
This commit is contained in:
Rahul Garg
2023-11-16 00:20:54 -05:00
parent 7478e90727
commit e1889b77b4
10 changed files with 381 additions and 538 deletions
+8 -18
View File
@@ -212,12 +212,12 @@ if(USE_PROF_API)
set(PROF_API_STR "${PROJECT_BINARY_DIR}/include/hip/amd_detail/hip_prof_str.h")
set(PROF_API_STR_IN "${CMAKE_SOURCE_DIR}/hipamd/include/hip/amd_detail/hip_prof_str.h")
set(PROF_API_HDR "${HIP_COMMON_INCLUDE_DIR}/hip/hip_runtime_api.h")
set(PROF_GL_HDR "${CMAKE_SOURCE_DIR}/hipamd/include/hip/amd_detail/amd_hip_gl_interop.h")
set(PROF_API_DEPRECATED "${HIP_COMMON_INCLUDE_DIR}/hip/hip_deprecated.h")
set(PROF_API_SRC "${CMAKE_CURRENT_SOURCE_DIR}")
set(PROF_API_GEN "${CMAKE_CURRENT_SOURCE_DIR}/hip_prof_gen.py")
set(PROF_API_LOG "${PROJECT_BINARY_DIR}/hip_prof_gen.log.txt")
set(PROF_API_NEWHDR "${PROJECT_BINARY_DIR}/new_header.h")
set(PROF_API_NEWHDR_GEN "${CMAKE_CURRENT_SOURCE_DIR}/hip_find_defs.py")
set(PROF_API_DEPRECATED "${CMAKE_CURRENT_SOURCE_DIR}/hip_device_deprecated.cpp")
find_package(Python3 COMPONENTS Interpreter REQUIRED)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import CppHeaderParser"
@@ -231,29 +231,19 @@ if(USE_PROF_API)
")
endif()
add_custom_command(OUTPUT ${PROF_API_NEWHDR}.i
COMMAND ${CMAKE_COMMAND} -E cat ${PROF_API_HDR} ${PROF_GL_HDR} > ${PROF_API_NEWHDR}
COMMAND ${CMAKE_C_COMPILER}
"-D$<JOIN:$<TARGET_PROPERTY:amdhip64,COMPILE_DEFINITIONS>,;-D>"
"-I$<JOIN:$<TARGET_PROPERTY:amdhip64,INCLUDE_DIRECTORIES>,;-I>"
"-DHIP_INCLUDE_HIP_HIP_RUNTIME_PT_API_H=1"
${c_flags}
$<TARGET_PROPERTY:amdhip64,COMPILE_OPTIONS>
${CPP_EXTRA_C_FLAGS}
-E ${PROF_API_NEWHDR} -o ${PROF_API_NEWHDR}.i
COMMAND_EXPAND_LISTS VERBATIM
IMPLICIT_DEPENDS C ${PROF_API_HDR} ${PROF_GL_HDR} ${PROF_API_DEPRECATED}
DEPENDS ${PROF_API_HDR} ${PROF_GL_HDR} ${PROF_API_DEPRECATED}
add_custom_command(OUTPUT ${PROF_API_NEWHDR}
COMMAND ${Python3_EXECUTABLE} ${PROF_API_NEWHDR_GEN} --output ${PROF_API_NEWHDR} --deprecated ${PROF_API_DEPRECATED} ${PROF_API_HDR}
DEPENDS ${PROF_API_NEWHDR_GEN} ${PROF_API_HDR}
COMMENT "Generating new header from hip_runtime_api.h")
add_custom_command(OUTPUT ${PROF_API_STR}
COMMAND ${Python3_EXECUTABLE} ${PROF_API_GEN} -v -t --priv ${PROF_API_NEWHDR}.i ${PROF_API_SRC} ${PROF_API_STR_IN} ${PROF_API_STR}
DEPENDS ${PROF_API_STR_IN} ${PROF_API_NEWHDR}.i ${PROF_API_GEN}
COMMAND ${Python3_EXECUTABLE} ${PROF_API_GEN} -v -t --priv ${PROF_API_NEWHDR} ${PROF_API_SRC} ${PROF_API_STR_IN} ${PROF_API_STR}
DEPENDS ${PROF_API_STR_IN} ${PROF_API_NEWHDR} ${PROF_API_GEN}
COMMENT "Generating profiling primitives: ${PROF_API_STR}")
add_custom_target(gen-prof-api-str-header ALL
DEPENDS ${PROF_API_STR}
SOURCES ${PROF_API_NEWHDR}.i)
SOURCES ${PROF_API_NEWHDR})
set_target_properties(amdhip64 PROPERTIES PUBLIC_HEADER ${PROF_API_STR})
-3
View File
@@ -1,7 +1,5 @@
EXPORTS
hipChooseDevice
hipChooseDeviceR0000
hipChooseDeviceR0600
hipCtxCreate
hipCtxDestroy
hipCtxDisablePeerAccess
@@ -65,7 +63,6 @@ hipFuncSetSharedMemConfig
hipGetDevice
hipGetDeviceCount
hipGetDeviceProperties
hipGetDevicePropertiesR0000
hipGetDevicePropertiesR0600
hipGetErrorName
hipGetErrorString
+93 -19
View File
@@ -19,7 +19,6 @@
THE SOFTWARE. */
#include <hip/hip_runtime.h>
#include <hip/hip_deprecated.h>
#include "hip_internal.hpp"
#include "hip_mempool_impl.hpp"
@@ -276,7 +275,7 @@ hipError_t hipDeviceGetUuid(hipUUID* uuid, hipDevice_t device) {
HIP_RETURN(hipSuccess);
}
hipError_t ihipGetDeviceProperties(hipDeviceProp_tR0600* props, int device) {
hipError_t ihipGetDeviceProperties(hipDeviceProp_tR0600* props, hipDevice_t device) {
if (props == nullptr) {
return hipErrorInvalidValue;
}
@@ -460,27 +459,107 @@ hipError_t ihipGetDeviceProperties(hipDeviceProp_tR0600* props, int device) {
return hipSuccess;
}
hipError_t hipGetDevicePropertiesR0600(hipDeviceProp_tR0600* prop, int device) {
HIP_INIT_API(hipGetDevicePropertiesR0600, prop, device);
hipError_t hipGetDevicePropertiesR0600(hipDeviceProp_tR0600* props, hipDevice_t device) {
HIP_INIT_API(hipGetDevicePropertiesR0600, props, device);
HIP_RETURN(ihipGetDeviceProperties(prop, device));
HIP_RETURN(ihipGetDeviceProperties(props, device));
}
hipError_t hipGetDevicePropertiesR0000(hipDeviceProp_tR0000* prop, int device) {
HIP_INIT_API(hipGetDevicePropertiesR0000, prop, device);
extern "C" typedef struct hipDeviceProp_t {
char name[256]; ///< Device name.
size_t totalGlobalMem; ///< Size of global memory region (in bytes).
size_t sharedMemPerBlock; ///< Size of shared memory region (in bytes).
int regsPerBlock; ///< Registers per block.
int warpSize; ///< Warp size.
int maxThreadsPerBlock; ///< Max work items per work group or workgroup max size.
int maxThreadsDim[3]; ///< Max number of threads in each dimension (XYZ) of a block.
int maxGridSize[3]; ///< Max grid dimensions (XYZ).
int clockRate; ///< Max clock frequency of the multiProcessors in khz.
int memoryClockRate; ///< Max global memory clock frequency in khz.
int memoryBusWidth; ///< Global memory bus width in bits.
size_t totalConstMem; ///< Size of shared memory region (in bytes).
int major; ///< Major compute capability. On HCC, this is an approximation and features may
///< differ from CUDA CC. See the arch feature flags for portable ways to query
///< feature caps.
int minor; ///< Minor compute capability. On HCC, this is an approximation and features may
///< differ from CUDA CC. See the arch feature flags for portable ways to query
///< feature caps.
int multiProcessorCount; ///< Number of multi-processors (compute units).
int l2CacheSize; ///< L2 cache size.
int maxThreadsPerMultiProcessor; ///< Maximum resident threads per multi-processor.
int computeMode; ///< Compute mode.
int clockInstructionRate; ///< Frequency in khz of the timer used by the device-side "clock*"
///< instructions. New for HIP.
hipDeviceArch_t arch; ///< Architectural feature flags. New for HIP.
int concurrentKernels; ///< Device can possibly execute multiple kernels concurrently.
int pciDomainID; ///< PCI Domain ID
int pciBusID; ///< PCI Bus ID.
int pciDeviceID; ///< PCI Device ID.
size_t maxSharedMemoryPerMultiProcessor; ///< Maximum Shared Memory Per Multiprocessor.
int isMultiGpuBoard; ///< 1 if device is on a multi-GPU board, 0 if not.
int canMapHostMemory; ///< Check whether HIP can map host memory
int gcnArch; ///< DEPRECATED: use gcnArchName instead
char gcnArchName[256]; ///< AMD GCN Arch Name.
int integrated; ///< APU vs dGPU
int cooperativeLaunch; ///< HIP device supports cooperative launch
int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple
///< devices
int maxTexture1DLinear; ///< Maximum size for 1D textures bound to linear memory
int maxTexture1D; ///< Maximum number of elements in 1D images
int maxTexture2D[2]; ///< Maximum dimensions (width, height) of 2D images, in image elements
int maxTexture3D[3]; ///< Maximum dimensions (width, height, depth) of 3D images, in image
///< elements
unsigned int* hdpMemFlushCntl; ///< Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register
unsigned int* hdpRegFlushCntl; ///< Addres of HDP_REG_COHERENCY_FLUSH_CNTL register
size_t memPitch; ///< Maximum pitch in bytes allowed by memory copies
size_t textureAlignment; ///< Alignment requirement for textures
size_t texturePitchAlignment; ///< Pitch alignment requirement for texture references bound to
///< pitched memory
int kernelExecTimeoutEnabled; ///< Run time limit for kernels executed on the device
int ECCEnabled; ///< Device has ECC support enabled
int tccDriver; ///< 1:If device is Tesla device using TCC driver, else 0
int cooperativeMultiDeviceUnmatchedFunc; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched functions
int cooperativeMultiDeviceUnmatchedGridDim; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched grid dimensions
int cooperativeMultiDeviceUnmatchedBlockDim; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched block dimensions
int cooperativeMultiDeviceUnmatchedSharedMem; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched shared memories
int isLargeBar; ///< 1: if it is a large PCI bar device, else 0
int asicRevision; ///< Revision of the GPU in this device
int managedMemory; ///< Device supports allocating managed memory on this system
int directManagedMemAccessFromHost; ///< Host can directly access managed memory on the device
///< without migration
int concurrentManagedAccess; ///< Device can coherently access managed memory concurrently with
///< the CPU
int pageableMemoryAccess; ///< Device supports coherently accessing pageable memory
///< without calling hipHostRegister on it
int pageableMemoryAccessUsesHostPageTables; ///< Device accesses pageable memory via the host's
///< page tables
} hipDeviceProp_t;
if (prop == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
extern "C" hipError_t hipGetDeviceProperties(hipDeviceProp_t* props, hipDevice_t device) {
// Removing this API from tracing.
// This API is now in backwards compatibility mode and is not callable from newly compiled apps.
HIP_INIT_VOID();
if (props == nullptr) {
return hipErrorInvalidValue;
}
if (unsigned(device) >= g_devices.size()) {
HIP_RETURN(hipErrorInvalidDevice);
return hipErrorInvalidDevice;
}
auto* deviceHandle = g_devices[device]->devices()[0];
constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
constexpr auto uint16_max = static_cast<uint64_t>(std::numeric_limits<uint16_t>::max()) + 1;
hipDeviceProp_tR0000 deviceProps = {0};
hipDeviceProp_t deviceProps = {0};
const auto& info = deviceHandle->info();
const auto& isa = deviceHandle->isa();
@@ -567,11 +646,6 @@ hipError_t hipGetDevicePropertiesR0000(hipDeviceProp_tR0000* prop, int device) {
deviceProps.pageableMemoryAccess = info.hmmCpuMemoryAccessible_;
deviceProps.pageableMemoryAccessUsesHostPageTables = info.hostUnifiedMemory_;
*prop = deviceProps;
HIP_RETURN(hipSuccess);
}
extern "C" hipError_t hipGetDeviceProperties(hipDeviceProp_tR0000* props, hipDevice_t device);
hipError_t hipGetDeviceProperties(hipDeviceProp_tR0000* props, hipDevice_t device) {
return hipGetDevicePropertiesR0000(props, device);
}
*props = deviceProps;
return hipSuccess;
}
@@ -0,0 +1,83 @@
// This file will add older hip functions used in the versioning system
// Find the deprecated functions and structs in hip_device.cpp
// This struct is also kept in hip_device.cpp
extern "C" typedef struct hipDeviceProp_t {
char name[256]; ///< Device name.
size_t totalGlobalMem; ///< Size of global memory region (in bytes).
size_t sharedMemPerBlock; ///< Size of shared memory region (in bytes).
int regsPerBlock; ///< Registers per block.
int warpSize; ///< Warp size.
int maxThreadsPerBlock; ///< Max work items per work group or workgroup max size.
int maxThreadsDim[3]; ///< Max number of threads in each dimension (XYZ) of a block.
int maxGridSize[3]; ///< Max grid dimensions (XYZ).
int clockRate; ///< Max clock frequency of the multiProcessors in khz.
int memoryClockRate; ///< Max global memory clock frequency in khz.
int memoryBusWidth; ///< Global memory bus width in bits.
size_t totalConstMem; ///< Size of shared memory region (in bytes).
int major; ///< Major compute capability. On HCC, this is an approximation and features may
///< differ from CUDA CC. See the arch feature flags for portable ways to query
///< feature caps.
int minor; ///< Minor compute capability. On HCC, this is an approximation and features may
///< differ from CUDA CC. See the arch feature flags for portable ways to query
///< feature caps.
int multiProcessorCount; ///< Number of multi-processors (compute units).
int l2CacheSize; ///< L2 cache size.
int maxThreadsPerMultiProcessor; ///< Maximum resident threads per multi-processor.
int computeMode; ///< Compute mode.
int clockInstructionRate; ///< Frequency in khz of the timer used by the device-side "clock*"
///< instructions. New for HIP.
hipDeviceArch_t arch; ///< Architectural feature flags. New for HIP.
int concurrentKernels; ///< Device can possibly execute multiple kernels concurrently.
int pciDomainID; ///< PCI Domain ID
int pciBusID; ///< PCI Bus ID.
int pciDeviceID; ///< PCI Device ID.
size_t maxSharedMemoryPerMultiProcessor; ///< Maximum Shared Memory Per Multiprocessor.
int isMultiGpuBoard; ///< 1 if device is on a multi-GPU board, 0 if not.
int canMapHostMemory; ///< Check whether HIP can map host memory
int gcnArch; ///< DEPRECATED: use gcnArchName instead
char gcnArchName[256]; ///< AMD GCN Arch Name.
int integrated; ///< APU vs dGPU
int cooperativeLaunch; ///< HIP device supports cooperative launch
int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple
///< devices
int maxTexture1DLinear; ///< Maximum size for 1D textures bound to linear memory
int maxTexture1D; ///< Maximum number of elements in 1D images
int maxTexture2D[2]; ///< Maximum dimensions (width, height) of 2D images, in image elements
int maxTexture3D[3]; ///< Maximum dimensions (width, height, depth) of 3D images, in image
///< elements
unsigned int* hdpMemFlushCntl; ///< Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register
unsigned int* hdpRegFlushCntl; ///< Addres of HDP_REG_COHERENCY_FLUSH_CNTL register
size_t memPitch; ///< Maximum pitch in bytes allowed by memory copies
size_t textureAlignment; ///< Alignment requirement for textures
size_t texturePitchAlignment; ///< Pitch alignment requirement for texture references bound to
///< pitched memory
int kernelExecTimeoutEnabled; ///< Run time limit for kernels executed on the device
int ECCEnabled; ///< Device has ECC support enabled
int tccDriver; ///< 1:If device is Tesla device using TCC driver, else 0
int cooperativeMultiDeviceUnmatchedFunc; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched functions
int cooperativeMultiDeviceUnmatchedGridDim; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched grid dimensions
int cooperativeMultiDeviceUnmatchedBlockDim; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched block dimensions
int cooperativeMultiDeviceUnmatchedSharedMem; ///< HIP device supports cooperative launch on
///< multiple
/// devices with unmatched shared memories
int isLargeBar; ///< 1: if it is a large PCI bar device, else 0
int asicRevision; ///< Revision of the GPU in this device
int managedMemory; ///< Device supports allocating managed memory on this system
int directManagedMemAccessFromHost; ///< Host can directly access managed memory on the device
///< without migration
int concurrentManagedAccess; ///< Device can coherently access managed memory concurrently with
///< the CPU
int pageableMemoryAccess; ///< Device supports coherently accessing pageable memory
///< without calling hipHostRegister on it
int pageableMemoryAccessUsesHostPageTables; ///< Device accesses pageable memory via the host's
///< page tables
} hipDeviceProp_t;
extern "C" hipError_t hipGetDeviceProperties(hipDeviceProp_t* props, hipDevice_t device);
+10 -36
View File
@@ -22,33 +22,23 @@
#include "hip_internal.hpp"
#undef hipChooseDevice
#undef hipDeviceProp_t
hipError_t hipChooseDevice(int* device, const hipDeviceProp_t* properties) {
HIP_INIT_API(hipChooseDevice, device, properties);
template <typename DeviceProp>
hipError_t ihipChooseDevice(int* device, const DeviceProp* properties) {
if (device == nullptr || properties == nullptr) {
return hipErrorInvalidValue;
HIP_RETURN(hipErrorInvalidValue);
}
*device = 0;
cl_uint maxMatchedCount = 0;
int count = 0;
IHIP_RETURN_ONFAIL(ihipDeviceGetCount(&count));
HIP_RETURN_ONFAIL(ihipDeviceGetCount(&count));
for (cl_int i = 0; i < count; ++i) {
DeviceProp currentProp = {0};
hipDeviceProp_t currentProp = {0};
cl_uint validPropCount = 0;
cl_uint matchedCount = 0;
hipError_t err = hipSuccess;
if constexpr (std::is_same_v<DeviceProp, hipDeviceProp_tR0600>){
err = ihipGetDeviceProperties(&currentProp, i);
}
else {
err = hipGetDevicePropertiesR0000(&currentProp, i);
}
hipError_t err = ihipGetDeviceProperties(&currentProp, i);
if (properties->major != 0) {
validPropCount++;
if (currentProp.major >= properties->major) {
@@ -140,25 +130,9 @@ hipError_t ihipChooseDevice(int* device, const DeviceProp* properties) {
}
}
return hipSuccess;
}
hipError_t hipChooseDeviceR0600(int* device, const hipDeviceProp_tR0600* properties) {
HIP_INIT_API(hipChooseDeviceR0600, device, properties);
HIP_RETURN(ihipChooseDevice(device, properties));
}
hipError_t hipChooseDeviceR0000(int* device, const hipDeviceProp_tR0000* properties) {
HIP_INIT_API(hipChooseDeviceR0000, device, properties);
HIP_RETURN(ihipChooseDevice(device, properties));
HIP_RETURN(hipSuccess);
}
extern "C" hipError_t hipChooseDevice(int* device, const hipDeviceProp_tR0000* properties);
hipError_t hipChooseDevice(int* device, const hipDeviceProp_tR0000* properties) {
return hipChooseDeviceR0000(device, properties);
}
hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device) {
HIP_INIT_API(hipDeviceGetAttribute, pi, attr, device);
@@ -174,7 +148,7 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
}
// FIXME: should we cache the props, or just select from deviceHandle->info_?
hipDeviceProp_tR0600 prop = {0};
hipDeviceProp_t prop = {0};
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, device));
constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
@@ -466,7 +440,7 @@ hipError_t hipDeviceGetByPCIBusId(int* device, const char* pciBusIdstr) {
HIP_RETURN_ONFAIL(ihipDeviceGetCount(&count));
for (cl_int i = 0; i < count; i++) {
hipDevice_t dev;
hipDeviceProp_tR0600 prop;
hipDeviceProp_t prop;
HIP_RETURN_ONFAIL(ihipDeviceGet(&dev, i));
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, dev));
@@ -506,7 +480,7 @@ hipError_t hipDeviceGetLimit(size_t* pValue, hipLimit_t limit) {
switch (limit) {
case hipLimitMallocHeapSize:
hipDeviceProp_tR0600 prop;
hipDeviceProp_t prop;
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, ihipGetDevice()));
*pValue = prop.totalGlobalMem;
break;
@@ -535,7 +509,7 @@ hipError_t hipDeviceGetPCIBusId(char* pciBusId, int len, int device) {
HIP_RETURN(hipErrorInvalidValue);
}
hipDeviceProp_tR0600 prop;
hipDeviceProp_t prop;
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, device));
snprintf(pciBusId, len, "%04x:%02x:%02x.0", prop.pciDomainID, prop.pciBusID, prop.pciDeviceID);
+83
View File
@@ -0,0 +1,83 @@
import getopt, sys, os
def write_new_header():
arg_list = sys.argv[1:] # Files to read is dictated by arguments
optlist, files_to_read = getopt.getopt(arg_list, "od", ["output=", "deprecated="])
write_header = ''
deprecated_functions = ''
for arg, value in optlist:
if arg in ["-o", "--output"]:
write_header = value
elif arg in ["-p", "--deprecated"]:
deprecated_functions = value
print(optlist)
if len(write_header) == 0:
print("hip_find_defs.py Command Line argument parsing incorrectly!")
return
new_header_file = open(write_header, 'w')
version_define_map = {}
struct_mode = False
struct_string = ''
struct_name = ''
struct_depth = 0
for the_file in files_to_read:
header = open(the_file, 'r')
header_lines = header.readlines()
for line in header_lines:
#reading a struct
if struct_mode:
struct_string += line
if '{' in line:
struct_depth += 1
elif '}' in line:
struct_depth -= 1
if struct_depth == 0:
struct_mode = False
if struct_name in version_define_map:
#new_header_file.write('\n')
#new_header_file.write(getOlderStruct(struct_name, version_define_map[struct_name], hip_device))
new_header_file.write(struct_string.replace(struct_name, version_define_map[struct_name]))
else:
new_header_file.write(struct_string)
continue
#finding defines used for versioning
if "#define" in line:
line_split = line.split()
if len(line_split) == 3 and line_split[1] in line_split[2] and line_split[2][-1].isnumeric():
version_define_map[line_split[1]] = line_split[2]
continue
#Looking for struct
if "typedef struct" in line and '{' in line:
struct_mode = True
struct_string = line
struct_depth = 1
struct_name = line.replace('{', '').split()[-1]
continue
#Looking for a typical function signature
if '(' in line and ')' in line and len(line.split('(')[0].split(' ')) == 2:
function_name = line.split('(')[0].split(' ')[1]
#If this function is one of the version functions, write the versioned function too
if function_name in version_define_map:
duplicate_line = line.replace(function_name, version_define_map[function_name])
new_header_file.write(duplicate_line)
continue
new_header_file.write(line)
header.close()
if os.path.exists(deprecated_functions):
deprecated_file = open(deprecated_functions, 'r')
new_header_file.write(deprecated_file.read())
new_header_file.close()
write_new_header()
-1
View File
@@ -20,7 +20,6 @@
#include "top.hpp"
#include "hip/hip_runtime.h"
#include "hip/hip_gl_interop.h"
#include "hip_internal.hpp"
#include "platform/interop_gl.hpp"
#include "cl_common.hpp"
+1 -4
View File
@@ -1,7 +1,6 @@
hip_4.2 {
global:
hipChooseDevice;
hipChooseDeviceR0000;
hipCtxCreate;
hipCtxDestroy;
hipCtxDisablePeerAccess;
@@ -63,7 +62,6 @@ global:
hipGetDevice;
hipGetDeviceCount;
hipGetDeviceProperties;
hipGetDevicePropertiesR0000;
hipGetErrorName;
hipGetErrorString;
hipGetLastError;
@@ -532,8 +530,7 @@ local:
hip_6.0 {
global:
hipChooseDeviceR0600;
hipGetDevicePropertiesR0600;
local:
*;
} hip_5.6;
} hip_5.6;
+1 -22
View File
@@ -393,10 +393,6 @@ def generate_prof_header(f, api_map, callback_ids, opts_map):
f.write('#define _HIP_PROF_STR_H\n');
f.write('#define HIP_PROF_VER 1\n')
f.write('\n#include <hip/hip_runtime_api.h>\n')
f.write('#include <hip/hip_deprecated.h>\n')
f.write('#include "amd_hip_gl_interop.h"\n')
# Check for non-public API
for name in sorted(opts_map.keys()):
if not name in api_map:
@@ -406,9 +402,6 @@ def generate_prof_header(f, api_map, callback_ids, opts_map):
priv_lst.append(name)
message("Private: " + name)
f.write('\n#define HIP_API_ID_CONCAT_HELPER(a,b) a##b\n');
f.write('#define HIP_API_ID_CONCAT(a,b) HIP_API_ID_CONCAT_HELPER(a,b)\n');
# Generating the callbacks ID enumaration
f.write('\n// HIP API callbacks ID enumeration\n')
f.write('enum hip_api_id_t {\n')
@@ -417,7 +410,6 @@ def generate_prof_header(f, api_map, callback_ids, opts_map):
cb_id_map = {}
last_cb_id = 0
versioned_functions = set()
for name, cb_id in callback_ids:
if not name in api_map:
f.write(' HIP_API_ID_RESERVED_' + str(cb_id) + ' = ' + str(cb_id) + ',\n')
@@ -425,30 +417,18 @@ def generate_prof_header(f, api_map, callback_ids, opts_map):
f.write(' HIP_API_ID_' + name + ' = ' + str(cb_id) + ',\n')
cb_id_map[name] = cb_id
if cb_id > last_cb_id: last_cb_id = cb_id
m = re.match(r'(.*)R[0-9][0-9][0-9][0-9]$', name)
if m: versioned_functions.add(m.group(1))
for name in sorted(api_map.keys()):
if not name in cb_id_map:
last_cb_id += 1
f.write(' HIP_API_ID_' + name + ' = ' + str(last_cb_id) + ',\n')
m = re.match(r'(.*)R[0-9][0-9][0-9][0-9]$', name)
if m: versioned_functions.add(m.group(1))
f.write(' HIP_API_ID_LAST = ' + str(last_cb_id) + ',\n')
f.write('\n')
for name in sorted(versioned_functions):
f.write(' HIP_API_ID_' + name + ' = ' + 'HIP_API_ID_CONCAT(HIP_API_ID_,' + name + '),\n')
f.write('\n')
for name in sorted(priv_lst):
f.write(' HIP_API_ID_' + name + ' = HIP_API_ID_NONE,\n')
f.write('};\n')
f.write('\n#undef HIP_API_ID_CONCAT_HELPER\n');
f.write('#undef HIP_API_ID_CONCAT\n');
# Generating the method to return API name by ID
f.write('\n// Return the HIP API string for a given callback ID\n')
f.write('static inline const char* hip_api_name(const uint32_t id) {\n')
@@ -678,6 +658,7 @@ api_map = {
'hipGetErrorString': '',
'hipMallocHost': '',
'hipModuleLoadDataEx': '',
'hipGetDeviceProperties': '',
'hipConfigureCall': '',
'hipHccModuleLaunchKernel': '',
'hipExtModuleLaunchKernel': '',
@@ -707,8 +688,6 @@ for enum in cppHeader.enums:
continue
if value['name'] == 'HIP_API_ID_LAST':
break
if type(value['value']) == str:
continue
m = re.match(r'HIP_API_ID_(\S*)', value['name'])
if m:
api_callback_ids.append((m.group(1), value['value']))