Merge master into amd-master-next

Change-Id: I3fc1dc0c860d627053537581e75561e8a7efe327


[ROCm/hip commit: 2689246de6]
This commit is contained in:
root
2020-04-26 22:19:37 +00:00
197 changed files with 2609 additions and 23111 deletions
+16 -5
View File
@@ -114,6 +114,8 @@ if(NOT DEFINED ENV{HIP_RUNTIME})
set(HIP_RUNTIME "HCC" CACHE STRING "HIP Runtime")
elseif (HIP_PLATFORM STREQUAL "vdi")
set(HIP_RUNTIME "VDI" CACHE STRING "HIP Runtime")
elseif (HIP_PLATFORM STREQUAL "nvcc")
set(HIP_RUNTIME "CUDA" CACHE STRING "HIP Runtime")
endif()
endif()
add_to_config(_buildInfo HIP_RUNTIME)
@@ -401,7 +403,9 @@ if(HIP_PLATFORM STREQUAL "hcc")
file(WRITE "${PROJECT_BINARY_DIR}/.hipInfo" ${_buildInfo})
endif()
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "vdi")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lpl_ca)
endif()
# Generate .hipVersion
file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})
@@ -430,7 +434,12 @@ endif()
#############################
# Install hip_hcc if platform is hcc
if(HIP_PLATFORM STREQUAL "hcc")
install(TARGETS hip_hcc_static hip_hcc hiprtc DESTINATION lib)
install(TARGETS hip_hcc_static hip_hcc hiprtc DESTINATION lib)
endif()
# Install .hipInfo
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "vdi")
install(FILES ${PROJECT_BINARY_DIR}/.hipInfo DESTINATION lib)
endif()
# Install .hipInfo
@@ -454,9 +463,7 @@ endif()
#############################
if(HIP_PLATFORM STREQUAL "hcc")
install(TARGETS hip_hcc_static hip_hcc host device EXPORT hip-targets DESTINATION ${LIB_INSTALL_DIR})
# ToDo: The cmake generated target files are not working. We have to install manually created ones
# for now. Should fix this and remove target files under packaging.
#install(EXPORT hip-targets DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} NAMESPACE hip::)
install(EXPORT hip-targets DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} NAMESPACE hip::)
elseif( HIP_PLATFORM STREQUAL "vdi")
# install(TARGETS hip_on_vdi host device EXPORT hip-targets DESTINATION ${LIB_INSTALL_DIR})
endif()
@@ -632,8 +639,12 @@ if(${RUN_HIT} EQUAL 0)
include_directories(${HIP_SRC_PATH}/tests/src)
hit_add_directory_recursive(${HIP_SRC_PATH}/tests/src "directed_tests")
# Add unit tests
include_directories(${HIP_SRC_PATH}/tests/unit)
hit_add_directory_recursive(${HIP_SRC_PATH}/tests/unit "unit_tests")
# Add top-level tests to build_tests
add_custom_target(build_tests DEPENDS directed_tests)
add_custom_target(build_tests DEPENDS directed_tests unit_tests)
# Add custom target: check
add_custom_target(check COMMAND "${CMAKE_COMMAND}" --build . --target test DEPENDS build_tests)
+4 -4
View File
@@ -295,13 +295,13 @@ def docker_upload_dockerhub( String local_org, String image_name, String remote_
String build_config = 'Release'
String job_name = env.JOB_NAME.toLowerCase( )
// The following launches 3 builds in parallel: rocm-head, rocm-3.1.x and cuda-10.x
parallel rocm_3_1:
// The following launches 3 builds in parallel: rocm-head, rocm-3.3.x and cuda-10.x
parallel rocm_3_3:
{
node('hip-rocm')
{
String hcc_ver = 'rocm-3.1.x'
String from_image = 'ci_test_nodes/rocm-3.1.x/ubuntu-16.04:latest'
String hcc_ver = 'rocm-3.3.x'
String from_image = 'ci_test_nodes/rocm-3.3.x/ubuntu-16.04:latest'
String inside_args = '--device=/dev/kfd --device=/dev/dri --group-add=video'
// Checkout source code, dependencies and version files
+3 -3
View File
@@ -7,7 +7,7 @@ Key features include:
* HIP is very thin and has little or no performance impact over coding directly in CUDA or hcc "HC" mode.
* HIP allows coding in a single-source C++ programming language including features such as templates, C++11 lambdas, classes, namespaces, and more.
* HIP allows developers to use the "best" development environment and tools on each target platform.
* The [HIPIFY](hipify-clang/README.md) tools automatically convert source from CUDA to HIP.
* The [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md) tools automatically convert source from CUDA to HIP.
* Developers can specialize for the platform (CUDA or hcc) to tune for performance or handle tricky cases
New projects can be developed directly in the portable HIP C++ language and can run on either NVIDIA or AMD platforms. Additionally, HIP provides porting tools which make it easy to port existing CUDA codes to the HIP layer, with no loss of performance as compared to the original CUDA application. HIP is not intended to be a drop-in replacement for CUDA, and developers should expect to do some manual coding and performance tuning work to complete the port.
@@ -37,7 +37,7 @@ HIP releases are typically of two types. The tag naming convention is different
- [HIP Profiling ](docs/markdown/hip_profiling.md)
- [HIP Debugging](docs/markdown/hip_debugging.md)
- [HIP Terminology](docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenCL)
- [HIPIFY](hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- Supported CUDA APIs:
* [Runtime API](docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md)
* [Driver API](docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md)
@@ -115,7 +115,7 @@ provides source portability to either platform. HIP provides the _hipcc_ compi
## Examples and Getting Started:
* A sample and [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that uses any of [HIPIFY](hipify-clang/README.md) tools to convert a simple app from CUDA to HIP:
* A sample and [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that uses any of [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md) tools to convert a simple app from CUDA to HIP:
```shell
+249
View File
@@ -0,0 +1,249 @@
#!/usr/bin/perl
use strict;
use File::Copy;
use File::Spec;
use File::Basename;
use File::Which;
use Cwd 'realpath';
use Getopt::Std;
use List::Util qw(max);
sub usage {
print("Usage: $0 [OPTION]... -i <input>\n");
print("Extract the device kernels from an hcc executable.\n\n");
print("-h \t\t\t\tshow this help message\n");
print("-i <input> \t\t\t\tinput file\n");
exit;
}
my $debug = 0;
# use clang offload bundler (instead of "dd")
# to extract device object from the bundle
my $use_clang_offload_bundler = 1;
my %options=();
getopts('hi:', \%options);
if (!%options || defined $options{h}) {
usage();
}
my $input_file;
defined $options{i} || die("input not specified");
$input_file = $options{i};
(-f $input_file) || die("can't find $input_file");
# look for llvm-objdump and clang-offload-bundler
my $tools_path_prefix;
my $llvm_objdump;
my $clang_offload_bundler;
if (defined $ENV{'HCC_HOME'}) {
$tools_path_prefix = File::Spec->catfile($ENV{'HCC_HOME'}, "bin");
$llvm_objdump = File::Spec->catfile($tools_path_prefix, "llvm-objdump");
$clang_offload_bundler = File::Spec->catfile($tools_path_prefix, "clang-offload-bundler");
}
else {
$tools_path_prefix = dirname(realpath($0));
$llvm_objdump = File::Spec->catfile($tools_path_prefix, "llvm-objdump");
$clang_offload_bundler = File::Spec->catfile($tools_path_prefix, "clang-offload-bundler");
if (!(-f $llvm_objdump)) {
$tools_path_prefix = realpath($tools_path_prefix."/../../hcc/bin");
$llvm_objdump = File::Spec->catfile($tools_path_prefix, "llvm-objdump");
$clang_offload_bundler = File::Spec->catfile($tools_path_prefix, "clang-offload-bundler");
}
}
if (!(-f $llvm_objdump)) {
$llvm_objdump = which("llvm-objdump");
if (!(-f $llvm_objdump)) {
die("Can't find llvm-objdump\n");
}
}
if (!(-f $clang_offload_bundler)) {
$clang_offload_bundler = which("clang-offload-bundler");
if (!(-f $clang_offload_bundler)) {
die("Can't find clang-offload-bundler\n");
}
}
# kernel section information for HCC
my $kernel_section_name = ".kernel";
my $kernel_triple = "hcc-amdgcn-amd-amdhsa--";
my $kernel_blob_alignment = 1;
my $kernel_section_size = hex(`objdump -h $input_file | grep $kernel_section_name | awk '{print \$3}'`);
if (!$kernel_section_size) {
# If there isn't a section created by HCC,
# try to detect a kernel section created by HIP-Clang
$kernel_section_name = ".hip_fatbin";
$kernel_triple = "hip-amdgcn-amd-amdhsa-";
$kernel_blob_alignment = 8;
$kernel_section_size = hex(`objdump -h $input_file | grep $kernel_section_name | awk '{print \$3}'`);
$kernel_section_size or die("No kernel section found\n");
}
my $kernel_section_offset = hex(`objdump -h $input_file | grep $kernel_section_name | awk '{print \$6}'`);
my $kernel_section_end = $kernel_section_offset + $kernel_section_size;
if ($debug) {
print "kernel section size: $kernel_section_size\n";
print "kernel section offset: $kernel_section_offset\n";
print "kernel section end: $kernel_section_end\n";
}
# parse kernel bundle header
open INPUT_FP, $input_file || die $!;
binmode INPUT_FP;
my $current_blob_offset = $kernel_section_offset;
my $num_blobs = 0;
#while ($current_blob_offset < $kernel_section_end) {
while(1) {
# adjust the offset to the blob alignment
$current_blob_offset = int(($current_blob_offset + ($kernel_blob_alignment - 1)) / $kernel_blob_alignment) * $kernel_blob_alignment;
if ($debug) {
print "Current blob offset: $current_blob_offset\n";
}
if ($current_blob_offset >= $kernel_section_end) {
if ($debug) {
print "reached end of kernel section\n";
}
last;
}
seek(INPUT_FP, $current_blob_offset, 0);
# skip OFFLOAD_BUNDLER_MAGIC_STR
my $magic_str;
my $read_bytes = read(INPUT_FP, $magic_str, 24);
if (($read_bytes != 24) || ($magic_str ne "__CLANG_OFFLOAD_BUNDLE__")) {
# didn't detect the bundle magic string
if ($debug) {
print "Offload bundle magic string not detected\n";
}
last;
}
# read number of bundles
my $num_bundles;
$read_bytes = read(INPUT_FP, $num_bundles, 8);
$read_bytes == 8 or die("Fail to parse number of bundles\n");
$num_bundles = unpack("Q", $num_bundles);
if ($debug) {
print "Blob $num_blobs, number of bundles: $num_bundles\n";
}
# detected GPU targets
my @asic_target_array;
my $last_bundle_offset = 0;
my $last_bundle_size = 0;
# strings for creating new files
my $file_blob_number = sprintf("%03d", $num_blobs);
my $filename_prefix = "${input_file}-${file_blob_number}";
my $clang_offloadbundler_outputs="-outputs=/dev/null";
my $clang_offloadbundler_targets="-targets=host-x86_64-unknown-linux";
for (my $iter = 0; $iter < $num_bundles; $iter++) {
# read bundle offset
my $offset;
$read_bytes = read(INPUT_FP, $offset, 8);
$read_bytes == 8 or die("Fail to parse bundle offset\n");
$offset = unpack("Q", $offset);
$last_bundle_offset = max($last_bundle_offset, $offset);
# read bundle size
my $size;
$read_bytes = read(INPUT_FP, $size, 8);
$read_bytes == 8 or die("Fail to parse bundle size\n");
$size = unpack("Q", $size);
if ($last_bundle_offset == $offset) {
$last_bundle_size = $size;
}
# read triple size
my $triple_size;
$read_bytes = read(INPUT_FP, $triple_size, 8);
$read_bytes == 8 or die("Fail to parse triple size\n");
$triple_size = unpack("Q", $triple_size);
# triple
my $triple;
$read_bytes = read(INPUT_FP, $triple, $triple_size);
$read_bytes == $triple_size or die("Fail to parse triple\n");
if ($debug) {
print("\t bundle $iter: offset=$offset, size=$size, triple_size=$triple_size, triple=$triple\n");
}
# Only process GPU targets, skip host targets
my $triple_pattern = "^$kernel_triple";
if ($triple =~ /$triple_pattern/) {
my $asic_target = substr($triple, length($kernel_triple));
# augment arguments for clang-offload-bundler
my $hsaco_file_name = "${filename_prefix}-${asic_target}.hsaco";
$clang_offloadbundler_outputs = "${clang_offloadbundler_outputs},${hsaco_file_name}";
$clang_offloadbundler_targets = "${clang_offloadbundler_targets},${triple}";
# add into asic_target_array
$asic_target_array[$#asic_target_array + 1]=$asic_target;
if (!$use_clang_offload_bundler) {
my $offset_for_hsaco = $current_blob_offset + $offset;
my $dd_command ="dd if=${input_file} of=${hsaco_file_name} skip=$offset_for_hsaco count=$size bs=1 status=none";
if ($debug) {
print("extract code bundle with dd: $dd_command\n");
}
system($dd_command) == 0
or die("Fail to extract code bundle with dd\n");
}
} else {
#print("Host target: " . $Triple . "\n");
}
}
# extract the code blob
my $blob_filename = "${filename_prefix}.bundle";
my $write_bytes = $last_bundle_offset + $last_bundle_size;
system("dd if=$input_file of=$blob_filename skip=$current_blob_offset count=$write_bytes bs=1 status=none") == 0
or die("Extracting kernel bundle file failed: $?");
if ($use_clang_offload_bundler) {
# use clang-offload-bundler to unbundle HSACO
my $command = "${clang_offload_bundler} -unbundle -type=o -inputs=${blob_filename} ${clang_offloadbundler_outputs} ${clang_offloadbundler_targets}";
if ($debug) {
print("clang offload bundler command: $command\n");
}
system($command) == 0
or die("Fail to execute clang-offload-bundler");
}
for (my $iter = 0; $iter <= $#asic_target_array; $iter++) {
my $asic_target = $asic_target_array[$iter];
my $hsaco_file_name = "${filename_prefix}-${asic_target}.hsaco";
my $isa_file_name = "${filename_prefix}-${asic_target}.isa";
# use llvm-objdump to dump out GCN ISA
system("$llvm_objdump --disassemble --mcpu=$asic_target $hsaco_file_name > $isa_file_name") == 0 or die("Fail to disassemble AMDGPU ISA for target" . $asic_target);
if ($debug) {
print("Generated GCN ISA for " . $asic_target . " at: " . $isa_file_name . "\n");
}
}
$current_blob_offset = $current_blob_offset + $last_bundle_offset + $last_bundle_size;
$num_blobs++;
}
$num_blobs or die("No device code found.\n");
exit(0);
+3
View File
@@ -351,6 +351,9 @@ my $buildDeps = 0;
my $linkType = 1;
my $setLinkType = 0;
my $coFormatv3 = 1;
if(defined $HIP_COMPILER and $HIP_COMPILER eq "hcc") {
$coFormatv3 = 0;
}
my $funcSupp = 0; # enable function support
my @options = ();
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
$HIP_BASE_VERSION_MAJOR = "3";
$HIP_BASE_VERSION_MINOR = "2";
$HIP_BASE_VERSION_MINOR = "5";
# Need perl > 5.10 to use logic-defined or
use 5.006; use v5.10.1;
+22
View File
@@ -742,8 +742,12 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcurandSetQuasiRandomGeneratorDimensions\b/hiprandSetQuasiRandomGeneratorDimensions/g;
$ft{'library'} += s/\bcurandSetStream\b/hiprandSetStream/g;
$ft{'library'} += s/\bcusparseCaxpyi\b/hipsparseCaxpyi/g;
$ft{'library'} += s/\bcusparseCbsrmv\b/hipsparseCbsrmv/g;
$ft{'library'} += s/\bcusparseCcsr2csc\b/hipsparseCcsr2csc/g;
$ft{'library'} += s/\bcusparseCcsr2hyb\b/hipsparseCcsr2hyb/g;
$ft{'library'} += s/\bcusparseCcsrgeam\b/hipsparseCcsrgeam/g;
$ft{'library'} += s/\bcusparseCcsrgeam2\b/hipsparseCcsrgeam2/g;
$ft{'library'} += s/\bcusparseCcsrgeam2_bufferSizeExt\b/hipsparseCcsrgeam2_bufferSizeExt/g;
$ft{'library'} += s/\bcusparseCcsrgemm\b/hipsparseCcsrgemm/g;
$ft{'library'} += s/\bcusparseCcsrgemm2\b/hipsparseCcsrgemm2/g;
$ft{'library'} += s/\bcusparseCcsrgemm2_bufferSizeExt\b/hipsparseCcsrgemm2_bufferSizeExt/g;
@@ -767,6 +771,7 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseCgthrz\b/hipsparseCgthrz/g;
$ft{'library'} += s/\bcusparseChybmv\b/hipsparseChybmv/g;
$ft{'library'} += s/\bcusparseCnnz\b/hipsparseCnnz/g;
$ft{'library'} += s/\bcusparseCnnz_compress\b/hipsparseCnnz_compress/g;
$ft{'library'} += s/\bcusparseCreate\b/hipsparseCreate/g;
$ft{'library'} += s/\bcusparseCreateCsrgemm2Info\b/hipsparseCreateCsrgemm2Info/g;
$ft{'library'} += s/\bcusparseCreateCsrilu02Info\b/hipsparseCreateCsrilu02Info/g;
@@ -777,8 +782,12 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseCreateMatDescr\b/hipsparseCreateMatDescr/g;
$ft{'library'} += s/\bcusparseCsctr\b/hipsparseCsctr/g;
$ft{'library'} += s/\bcusparseDaxpyi\b/hipsparseDaxpyi/g;
$ft{'library'} += s/\bcusparseDbsrmv\b/hipsparseDbsrmv/g;
$ft{'library'} += s/\bcusparseDcsr2csc\b/hipsparseDcsr2csc/g;
$ft{'library'} += s/\bcusparseDcsr2hyb\b/hipsparseDcsr2hyb/g;
$ft{'library'} += s/\bcusparseDcsrgeam\b/hipsparseDcsrgeam/g;
$ft{'library'} += s/\bcusparseDcsrgeam2\b/hipsparseDcsrgeam2/g;
$ft{'library'} += s/\bcusparseDcsrgeam2_bufferSizeExt\b/hipsparseDcsrgeam2_bufferSizeExt/g;
$ft{'library'} += s/\bcusparseDcsrgemm\b/hipsparseDcsrgemm/g;
$ft{'library'} += s/\bcusparseDcsrgemm2\b/hipsparseDcsrgemm2/g;
$ft{'library'} += s/\bcusparseDcsrgemm2_bufferSizeExt\b/hipsparseDcsrgemm2_bufferSizeExt/g;
@@ -808,6 +817,7 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseDgthrz\b/hipsparseDgthrz/g;
$ft{'library'} += s/\bcusparseDhybmv\b/hipsparseDhybmv/g;
$ft{'library'} += s/\bcusparseDnnz\b/hipsparseDnnz/g;
$ft{'library'} += s/\bcusparseDnnz_compress\b/hipsparseDnnz_compress/g;
$ft{'library'} += s/\bcusparseDroti\b/hipsparseDroti/g;
$ft{'library'} += s/\bcusparseDsctr\b/hipsparseDsctr/g;
$ft{'library'} += s/\bcusparseGetMatDiagType\b/hipsparseGetMatDiagType/g;
@@ -818,8 +828,12 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseGetStream\b/hipsparseGetStream/g;
$ft{'library'} += s/\bcusparseGetVersion\b/hipsparseGetVersion/g;
$ft{'library'} += s/\bcusparseSaxpyi\b/hipsparseSaxpyi/g;
$ft{'library'} += s/\bcusparseSbsrmv\b/hipsparseSbsrmv/g;
$ft{'library'} += s/\bcusparseScsr2csc\b/hipsparseScsr2csc/g;
$ft{'library'} += s/\bcusparseScsr2hyb\b/hipsparseScsr2hyb/g;
$ft{'library'} += s/\bcusparseScsrgeam\b/hipsparseScsrgeam/g;
$ft{'library'} += s/\bcusparseScsrgeam2\b/hipsparseScsrgeam2/g;
$ft{'library'} += s/\bcusparseScsrgeam2_bufferSizeExt\b/hipsparseScsrgeam2_bufferSizeExt/g;
$ft{'library'} += s/\bcusparseScsrgemm\b/hipsparseScsrgemm/g;
$ft{'library'} += s/\bcusparseScsrgemm2\b/hipsparseScsrgemm2/g;
$ft{'library'} += s/\bcusparseScsrgemm2_bufferSizeExt\b/hipsparseScsrgemm2_bufferSizeExt/g;
@@ -848,6 +862,7 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseSgthrz\b/hipsparseSgthrz/g;
$ft{'library'} += s/\bcusparseShybmv\b/hipsparseShybmv/g;
$ft{'library'} += s/\bcusparseSnnz\b/hipsparseSnnz/g;
$ft{'library'} += s/\bcusparseSnnz_compress\b/hipsparseSnnz_compress/g;
$ft{'library'} += s/\bcusparseSroti\b/hipsparseSroti/g;
$ft{'library'} += s/\bcusparseSsctr\b/hipsparseSsctr/g;
$ft{'library'} += s/\bcusparseXbsrilu02_zeroPivot\b/hipsparseXbsrilu02_zeroPivot/g;
@@ -858,6 +873,8 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseXcscsort\b/hipsparseXcscsort/g;
$ft{'library'} += s/\bcusparseXcscsort_bufferSizeExt\b/hipsparseXcscsort_bufferSizeExt/g;
$ft{'library'} += s/\bcusparseXcsr2coo\b/hipsparseXcsr2coo/g;
$ft{'library'} += s/\bcusparseXcsrgeam2Nnz\b/hipsparseXcsrgeam2Nnz/g;
$ft{'library'} += s/\bcusparseXcsrgeamNnz\b/hipsparseXcsrgeamNnz/g;
$ft{'library'} += s/\bcusparseXcsrgemm2Nnz\b/hipsparseXcsrgemm2Nnz/g;
$ft{'library'} += s/\bcusparseXcsrgemmNnz\b/hipsparseXcsrgemmNnz/g;
$ft{'library'} += s/\bcusparseXcsrilu02_zeroPivot\b/hipsparseXcsrilu02_zeroPivot/g;
@@ -866,8 +883,12 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseXcsrsort_bufferSizeExt\b/hipsparseXcsrsort_bufferSizeExt/g;
$ft{'library'} += s/\bcusparseXcsrsv2_zeroPivot\b/hipsparseXcsrsv2_zeroPivot/g;
$ft{'library'} += s/\bcusparseZaxpyi\b/hipsparseZaxpyi/g;
$ft{'library'} += s/\bcusparseZbsrmv\b/hipsparseZbsrmv/g;
$ft{'library'} += s/\bcusparseZcsr2csc\b/hipsparseZcsr2csc/g;
$ft{'library'} += s/\bcusparseZcsr2hyb\b/hipsparseZcsr2hyb/g;
$ft{'library'} += s/\bcusparseZcsrgeam\b/hipsparseZcsrgeam/g;
$ft{'library'} += s/\bcusparseZcsrgeam2\b/hipsparseZcsrgeam2/g;
$ft{'library'} += s/\bcusparseZcsrgeam2_bufferSizeExt\b/hipsparseZcsrgeam2_bufferSizeExt/g;
$ft{'library'} += s/\bcusparseZcsrgemm\b/hipsparseZcsrgemm/g;
$ft{'library'} += s/\bcusparseZcsrgemm2\b/hipsparseZcsrgemm2/g;
$ft{'library'} += s/\bcusparseZcsrgemm2_bufferSizeExt\b/hipsparseZcsrgemm2_bufferSizeExt/g;
@@ -891,6 +912,7 @@ sub simpleSubstitutions {
$ft{'library'} += s/\bcusparseZgthrz\b/hipsparseZgthrz/g;
$ft{'library'} += s/\bcusparseZhybmv\b/hipsparseZhybmv/g;
$ft{'library'} += s/\bcusparseZnnz\b/hipsparseZnnz/g;
$ft{'library'} += s/\bcusparseZnnz_compress\b/hipsparseZnnz_compress/g;
$ft{'library'} += s/\bcusparseZsctr\b/hipsparseZsctr/g;
$ft{'device_library'} += s/\bcurand\b/hiprand/g;
$ft{'device_library'} += s/\bcurand_discrete\b/hiprand_discrete/g;
+1 -1
View File
@@ -10,7 +10,7 @@
* - HIP is very thin and has little or no performance impact over coding directly in CUDA NVCC or HCC HC mode.
* - HIP allows developers to use the "best" development environment and tools on each target platform.
* - HIP allows coding in a single-source C++ programming language including features such as templates, C++11 lambdas,and more.
* - "hipify" tool automatically converts source from CUDA to HIP.
* - "HIPIFY" tools automatically convert CUDA sources to HIP.
* - Developers can specialize for CUDA or HCC to tune for performance or handle tricky cases with #ifdef.
* - See the @ref API.
@@ -203,10 +203,10 @@
| **CUDA** | **HIP** |**CUDA version\***|
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|`cusparseSbsrmv` | |
|`cusparseDbsrmv` | |
|`cusparseCbsrmv` | |
|`cusparseZbsrmv` | |
|`cusparseSbsrmv` |`hipsparseSbsrmv` |
|`cusparseDbsrmv` |`hipsparseDbsrmv` |
|`cusparseCbsrmv` |`hipsparseCbsrmv` |
|`cusparseZbsrmv` |`hipsparseZbsrmv` |
|`cusparseSbsrxmv` | |
|`cusparseDbsrxmv` | |
|`cusparseCbsrxmv` | |
@@ -349,20 +349,20 @@
| **CUDA** | **HIP** |**CUDA version\***|
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|`cusparseXcsrgeamNnz` | |
|`cusparseScsrgeam` | |
|`cusparseDcsrgeam` | |
|`cusparseCcsrgeam` | |
|`cusparseZcsrgeam` | |
|`cusparseXcsrgeam2Nnz` | | 9.2 |
|`cusparseScsrgeam2` | | 9.2 |
|`cusparseDcsrgeam2` | | 9.2 |
|`cusparseCcsrgeam2` | | 9.2 |
|`cusparseZcsrgeam2` | | 9.2 |
|`cusparseScsrgeam2_bufferSizeExt` | | 9.2 |
|`cusparseDcsrgeam2_bufferSizeExt` | | 9.2 |
|`cusparseCcsrgeam2_bufferSizeExt` | | 9.2 |
|`cusparseZcsrgeam2_bufferSizeExt` | | 9.2 |
|`cusparseXcsrgeamNnz` |`hipsparseXcsrgeamNnz` |
|`cusparseScsrgeam` |`hipsparseScsrgeam` |
|`cusparseDcsrgeam` |`hipsparseDcsrgeam` |
|`cusparseCcsrgeam` |`hipsparseCcsrgeam` |
|`cusparseZcsrgeam` |`hipsparseZcsrgeam` |
|`cusparseXcsrgeam2Nnz` |`hipsparseXcsrgeam2Nnz` | 9.2 |
|`cusparseScsrgeam2` |`hipsparseScsrgeam2` | 9.2 |
|`cusparseDcsrgeam2` |`hipsparseDcsrgeam2` | 9.2 |
|`cusparseCcsrgeam2` |`hipsparseCcsrgeam2` | 9.2 |
|`cusparseZcsrgeam2` |`hipsparseZcsrgeam2` | 9.2 |
|`cusparseScsrgeam2_bufferSizeExt` |`hipsparseScsrgeam2_bufferSizeExt` | 9.2 |
|`cusparseDcsrgeam2_bufferSizeExt` |`hipsparseDcsrgeam2_bufferSizeExt` | 9.2 |
|`cusparseCcsrgeam2_bufferSizeExt` |`hipsparseCcsrgeam2_bufferSizeExt` | 9.2 |
|`cusparseZcsrgeam2_bufferSizeExt` |`hipsparseZcsrgeam2_bufferSizeExt` | 9.2 |
|`cusparseXcsrgemmNnz` |`hipsparseXcsrgemmNnz` |
|`cusparseScsrgemm` |`hipsparseScsrgemm` |
|`cusparseDcsrgemm` |`hipsparseDcsrgemm` |
@@ -378,7 +378,6 @@
|`cusparseCcsrgemm2_bufferSizeExt` |`hipsparseCcsrgemm2_bufferSizeExt` |
|`cusparseZcsrgemm2_bufferSizeExt` |`hipsparseZcsrgemm2_bufferSizeExt` |
## **7. cuSPARSE Preconditioners Reference**
## ***7.1. Incomplete Cholesky Factorization: level 0***
@@ -724,10 +723,10 @@
|`cusparseHpruneCsr2csrNnzByPercentage` | | 9.0 |
|`cusparseSpruneCsr2csrNnzByPercentage` | | 9.0 |
|`cusparseDpruneCsr2csrNnzByPercentage` | | 9.0 |
|`cusparseSnnz_compress` | | 8.0 |
|`cusparseDnnz_compress` | | 8.0 |
|`cusparseCnnz_compress` | | 8.0 |
|`cusparseZnnz_compress` | | 8.0 |
|`cusparseSnnz_compress` |`hipsparseSnnz_compress` | 8.0 |
|`cusparseDnnz_compress` |`hipsparseDnnz_compress` | 8.0 |
|`cusparseCnnz_compress` |`hipsparseCnnz_compress` | 8.0 |
|`cusparseZnnz_compress` |`hipsparseZnnz_compress` | 8.0 |
## **10. cuSPARSE Generic API Reference**
+15 -15
View File
@@ -12,7 +12,7 @@
- [How does HIP compare with OpenCL?](#how-does-hip-compare-with-opencl)
- [How does porting CUDA to HIP compare to porting CUDA to OpenCL?](#how-does-porting-cuda-to-hip-compare-to-porting-cuda-to-opencl)
- [What hardware does HIP support?](#what-hardware-does-hip-support)
- [Does Hipify automatically convert all source code?](#does-hipify-automatically-convert-all-source-code)
- [Do HIPIFY tools automatically convert all source code?](#do-hipify-tools-automatically-convert-all-source-code)
- [What is NVCC?](#what-is-nvcc)
- [What is HCC?](#what-is-hcc)
- [Why use HIP rather than supporting CUDA directly?](#why-use-hip-rather-than-supporting-cuda-directly)
@@ -79,23 +79,23 @@ scan code to identify any unsupported CUDA functions - this is useful for identi
However, we can provide a rough summary of the features included in each CUDA SDK and the support level in HIP. Each bullet below lists the major new language features in each CUDA release and then indicate which are supported/not supported in HIP:
- CUDA 4.0 and earlier :
- CUDA 4.0 and earlier :
- HIP supports CUDA 4.0 except for the limitations described above.
- CUDA 5.0 :
- CUDA 5.0 :
- Dynamic Parallelism (not supported)
- cuIpc functions (under development).
- CUDA 5.5 :
- CUDA 5.5 :
- CUPTI (not directly supported, [AMD GPUPerfAPI](http://developer.amd.com/tools-and-sdks/graphics-development/gpuperfapi/) can be used as an alternative in some cases)
- CUDA 6.0
- CUDA 6.0 :
- Managed memory (under development)
- CUDA 6.5
- CUDA 6.5 :
- __shfl intriniscs (supported)
- CUDA 7.0
- CUDA 7.0 :
- Per-thread-streams (under development)
- C++11 (HCC supports all of C++11, all of C++14 and some C++17 features)
- CUDA 7.5
- CUDA 7.5 :
- float16 (supported)
- CUDA 8.0
- CUDA 8.0 :
- Page Migration including cudaMemAdvise, cudaMemPrefetch, other cudaMem* APIs(not supported)
@@ -108,8 +108,8 @@ The hip interfaces support both ROCm and CUDA paths, with familiar library inter
- [hipfft](https://github.com/ROCmSoftwarePlatform/hcFFT)
- [hipsparse](https://github.com/ROCmSoftwarePlatform/hcSPARSE)
- [hiprng](https://github.com/ROCmSoftwarePlatform/hcrng)
Additionally, some of the cublas routines are automatically converted to hipblas equivalents by the hipify-clang tool. These APIs use cublas or hcblas depending on the platform and replace the need
Additionally, some of the cublas routines are automatically converted to hipblas equivalents by the HIPIFY tools. These APIs use cublas or hcblas depending on the platform and replace the need
to use conditional compilation.
### How does HIP compare with OpenCL?
@@ -126,7 +126,7 @@ HIP offers several benefits over OpenCL:
### How does porting CUDA to HIP compare to porting CUDA to OpenCL?
Both HIP and CUDA are dialects of C++, and thus porting between them is relatively straightforward.
Both dialects support templates, classes, lambdas, and other C++ constructs.
As one example, the hipify tool was originally a Perl script that used simple text conversions from CUDA to HIP.
As one example, the hipify-perl tool was originally a Perl script that used simple text conversions from CUDA to HIP.
HIP and CUDA provide similar math library calls as well. In summary, the HIP philosophy was to make the HIP language close enough to CUDA that the porting effort is relatively simple.
This reduces the potential for error, and also makes it easy to automate the translation. HIP's goal is to quickly get the ported program running on both platforms with little manual intervention,
so that the programmer can focus on performance optimizations.
@@ -140,11 +140,11 @@ The tools also struggle with more complex CUDA applications, in particular, thos
- For AMD platforms, HIP runs on the same hardware that the HCC "hc" mode supports. See the ROCm documentation for the list of supported platforms.
- For Nvidia platforms, HIP requires Unified Memory and should run on any device supporting CUDA SDK 6.0 or newer. We have tested the Nvidia Titan and Tesla K40.
### Does Hipify automatically convert all source code?
Typically, hipify can automatically convert almost all run-time code, and the coordinate indexing device code ( threadIdx.x -> hipThreadIdx_x ).
### Do HIPIFY tools automatically convert all source code?
Typically, HIPIFY tools can automatically convert almost all run-time code, and the coordinate indexing device code ( threadIdx.x -> hipThreadIdx_x ).
Most device code needs no additional conversion since HIP and CUDA have similar names for math and built-in functions.
The hipify-clang tool will automatically modify the kernel signature as needed (automating a step that used to be done manually).
Additional porting may be required to deal with architecture feature queries or with CUDA capabilities that HIP doesn't support.
Additional porting may be required to deal with architecture feature queries or with CUDA capabilities that HIP doesn't support.
In general, developers should always expect to perform some platform-specific tuning and optimization.
### What is NVCC?
@@ -125,7 +125,7 @@ MyKernel<<<dim3(gridDim), dim3(groupDim), 0, 0>>> (a,b,c,n);
```
The hipLaunchKernel macro always starts with the five parameters specified above, followed by the kernel arguments. The Hipify script optionally converts Cuda launch syntax to hipLaunchKernel, including conversion of optional arguments in <<< >>> to the five required hipLaunchKernel parameters. The dim3 constructor accepts zero to three arguments and will by default initialize unspecified dimensions to 1. See [dim3](#dim3). The kernel uses the coordinate built-ins (hipThread*, hipBlock*, hipGrid*) to determine coordinate index and coordinate bounds of the work item thats currently executing. See [Coordinate Built-Ins](#coordinate-builtins).
The hipLaunchKernel macro always starts with the five parameters specified above, followed by the kernel arguments. HIPIFY tools optionally convert Cuda launch syntax to hipLaunchKernel, including conversion of optional arguments in <<< >>> to the five required hipLaunchKernel parameters. The dim3 constructor accepts zero to three arguments and will by default initialize unspecified dimensions to 1. See [dim3](#dim3). The kernel uses the coordinate built-ins (hipThread*, hipBlock*, hipGrid*) to determine coordinate index and coordinate bounds of the work item thats currently executing. See [Coordinate Built-Ins](#coordinate-builtins).
## Kernel-Launch Example
@@ -724,7 +724,7 @@ CUDA defines a __launch_bounds which is also designed to control occupancy:
__launch_bounds(MAX_THREADS_PER_BLOCK, MIN_BLOCKS_PER_MULTIPROCESSOR)
```
- The second parameter __launch_bounds parameters must be converted to the format used __hip_launch_bounds, which uses warps and execution-units rather than blocks and multi-processors ( This conversion is performed automatically by the clang hipify tools.)
- The second parameter __launch_bounds parameters must be converted to the format used __hip_launch_bounds, which uses warps and execution-units rather than blocks and multi-processors (this conversion is performed automatically by hipify tools).
```
MIN_WARPS_PER_EXECUTION_UNIT = (MIN_BLOCKS_PER_MULTIPROCESSOR * MAX_THREADS_PER_BLOCK) / 32
```
@@ -68,8 +68,8 @@ HIP provides a `Ctx` API as a thin layer over the existing Device functions. Thi
The current context is implicitly used by other APIs such as `hipStreamCreate`.
### hipify translation of CUDA Driver API
The hipify tool converts CUDA Driver APIs for streams, events, modules, devices, memory management, context, profiler to the equivalent HIP driver calls. For example, `cuEventCreate` will be translated to `hipEventCreate`.
Hipify also converts error code from the Driver namespace and coding convention to the equivalent HIP error code. Thus, HIP unifies the APIs for these common functions.
The HIPIFY tools convert CUDA Driver APIs for streams, events, modules, devices, memory management, context, profiler to the equivalent HIP driver calls. For example, `cuEventCreate` will be translated to `hipEventCreate`.
HIPIFY tools also convert error codes from the Driver namespace and coding convention to the equivalent HIP error code. Thus, HIP unifies the APIs for these common functions.
The memory copy API requires additional explanation. The CUDA driver includes the memory direction in the name of the API (ie `cuMemcpyH2D`) while the CUDA driver API provides a single memory copy API with a parameter that specifies the direction and additionally supports a "default" direction where the runtime determines the direction automatically.
HIP provides APIs with both styles: for example, `hipMemcpyH2D` as well as `hipMemcpy`.
+16 -16
View File
@@ -1,7 +1,7 @@
# HIP Porting Guide
# HIP Porting Guide
In addition to providing a portable C++ programming environment for GPUs, HIP is designed to ease
the porting of existing CUDA code into the HIP environment. This section describes the available tools
and provides practical suggestions on how to port CUDA code and work through common issues.
and provides practical suggestions on how to port CUDA code and work through common issues.
## Table of Contents
@@ -57,13 +57,13 @@ and provides practical suggestions on how to port CUDA code and work through com
- Starting the port on a Cuda machine is often the easiest approach, since you can incrementally port pieces of the code to HIP while leaving the rest in Cuda. (Recall that on Cuda machines HIP is just a thin layer over Cuda, so the two code types can interoperate on nvcc platforms.) Also, the HIP port can be compared with the original Cuda code for function and performance.
- Once the Cuda code is ported to HIP and is running on the Cuda machine, compile the HIP code using hcc on an AMD machine.
- HIP ports can replace Cuda versions: HIP can deliver the same performance as a native Cuda implementation, with the benefit of portability to both Nvidia and AMD architectures as well as a path to future C++ standard support. You can handle platform-specific features through conditional compilation or by adding them to the open-source HIP infrastructure.
- Use **[bin/hipconvertinplace.sh](https://github.com/ROCm-Developer-Tools/HIP/blob/master/bin/hipconvertinplace.sh)** to hipify all code files in the Cuda source directory.
- Use **[bin/hipconvertinplace-perl.sh](https://github.com/ROCm-Developer-Tools/HIP/blob/master/bin/hipconvertinplace-perl.sh)** to hipify all code files in the Cuda source directory.
### Scanning existing CUDA code to scope the porting effort
The hipexamine.sh tool will scan a source directory to determine which files contain CUDA code and how much of that code can be automatically hipified,
The hipexamine-perl.sh tool will scan a source directory to determine which files contain CUDA code and how much of that code can be automatically hipified,
```
> cd examples/rodinia_3.0/cuda/kmeans
> $HIP_DIR/bin/hipexamine.sh .
> $HIP_DIR/bin/hipexamine-perl.sh.
info: hipify ./kmeans.h =====>
info: hipify ./unistd.h =====>
info: hipify ./kmeans.c =====>
@@ -80,7 +80,7 @@ info: TOTAL-converted 89 CUDA->HIP refs( dev:3 mem:32 kern:2 builtin:37 math:0 s
kernels (1 total) : kmeansPoint(1)
```
hipexamine scans each code file (cpp, c, h, hpp, etc.) found in the specified directory:
hipexamine-perl scans each code file (cpp, c, h, hpp, etc.) found in the specified directory:
* Files with no CUDA code (ie kmeans.h) print one line summary just listing the source file name.
* Files with CUDA code print a summary of what was found - for example the kmeans_cuda_kernel.cu file:
@@ -94,7 +94,7 @@ info: hipify ./kmeans_cuda_kernel.cu =====>
* Warning for code that looks like CUDA API but was not converted (0 in this file).
* Count Lines-of-Code (LOC) - 185 for this file.
* hipexamine also presents a summary at the end of the process for the statistics collected across all files. This has similar format to the per-file reporting, and also includes a list of all kernels which have been called. An example from above:
* hipexamine-perl also presents a summary at the end of the process for the statistics collected across all files. This has similar format to the per-file reporting, and also includes a list of all kernels which have been called. An example from above:
```shell
info: TOTAL-converted 89 CUDA->HIP refs( dev:3 mem:32 kern:2 builtin:37 math:0 stream:0 event:0 err:0 def:0 tex:15 other:0 ) warn:0 LOC:3607
@@ -104,24 +104,24 @@ info: TOTAL-converted 89 CUDA->HIP refs( dev:3 mem:32 kern:2 builtin:37 math:0 s
### Converting a project "in-place"
```shell
> hipify --inplace
> hipify-perl --inplace
```
For each input file FILE, this script will:
- If "FILE.prehip file does not exist, copy the original code to a new file with extension ".prehip". Then Hipify the code file.
- If "FILE.prehip" file exists, hipify FILE.prehip and save to FILE.
- If "FILE.prehip file does not exist, copy the original code to a new file with extension ".prehip". Then hipify the code file.
- If "FILE.prehip" file exists, hipify FILE.prehip and save to FILE.
This is useful for testing improvements to the hipify toolset.
The [hipconvertinplace.sh](https://github.com/ROCm-Developer-Tools/HIP/blob/master/bin/hipconvertinplace.sh) script will perform inplace conversion for all code files in the specified directory.
The [hipconvertinplace-perl.sh](https://github.com/ROCm-Developer-Tools/HIP/blob/master/bin/hipconvertinplace-perl.sh) script will perform inplace conversion for all code files in the specified directory.
This can be quite handy when dealing with an existing CUDA code base since the script preserves the existing directory structure
and filenames - and includes work. After converting in-place, you can review the code to add additional parameters to
directory names.
```shell
> hipconvertinplace.sh MY_SRC_DIR
> hipconvertinplace-perl.sh MY_SRC_DIR
```
### Library Equivalents
@@ -402,11 +402,11 @@ You can capture the hipconfig output and passed it to the standard compiler; bel
CPPFLAGS += $(shell $(HIP_PATH)/bin/hipconfig --cpp_config)
```
nvcc includes some headers by default. However, HIP does not include default headers, and instead all required files must be explicitly included.
Specifically, files that call HIP run-time APIs or define HIP kernels must explicitly include the appropriate HIP headers.
nvcc includes some headers by default. However, HIP does not include default headers, and instead all required files must be explicitly included.
Specifically, files that call HIP run-time APIs or define HIP kernels must explicitly include the appropriate HIP headers.
If the compilation process reports that it cannot find necessary APIs (for example, "error: identifier ‘hipSetDevice’ is undefined"),
ensure that the file includes hip_runtime.h (or hip_runtime_api.h, if appropriate).
The hipify script automatically converts "cuda_runtime.h" to "hip_runtime.h," and it converts "cuda_runtime_api.h" to "hip_runtime_api.h", but it may miss nested headers or macros.
ensure that the file includes hip_runtime.h (or hip_runtime_api.h, if appropriate).
The hipify-perl script automatically converts "cuda_runtime.h" to "hip_runtime.h," and it converts "cuda_runtime_api.h" to "hip_runtime_api.h", but it may miss nested headers or macros.
#### cuda.h
+6 -6
View File
@@ -1,18 +1,18 @@
# Terms used in HIP Documentation
- host, host cpu : Executes the HIP runtime API and is capable of initiating kernel launches to one or more devices.
- default device : Each host thread maintains a "default device".
- host, host cpu : Executes the HIP runtime API and is capable of initiating kernel launches to one or more devices.
- default device : Each host thread maintains a "default device".
Most HIP runtime APIs (including memory allocation, copy commands, kernel launches) do not use accept an explicit device
argument but instead implicitly use the default device.
The default device can be set with hipSetDevice.
- "active host thread" - the thread which is running the HIP APIs.
- "active host thread" - the thread which is running the HIP APIs.
- completion_future becomes ready. "Completes"
- completion_future becomes ready. "Completes".
- hcc = Heterogeneous Compute Compiler (https://bitbucket.org/multicoreware/hcc/wiki/Home).
- hcc = Heterogeneous Compute Compiler (https://bitbucket.org/multicoreware/hcc/wiki/Home).
- hipify - tool to convert CUDA(R) code to portable C++ code.
- hipify tools - tools to convert CUDA(R) code to portable C++ code (https://github.com/ROCm-Developer-Tools/HIPIFY).
- hipconfig - tool to report various configuration properties of the target platform.
- nvcc = nvcc compiler, do not capitalize.
+6 -4
View File
@@ -43,7 +43,7 @@ def filtr_api_args(args_str):
args_str = re.sub(r'\s*$', r'', args_str);
args_str = re.sub(r'\s*,\s*', r',', args_str);
args_str = re.sub(r'\s+', r' ', args_str);
args_str = re.sub(r'void \*', r'void* ', args_str);
args_str = re.sub(r'\s*(\*+)\s*', r'\1 ', args_str);
args_str = re.sub(r'(enum|struct) ', '', args_str);
return args_str
@@ -306,6 +306,7 @@ def generate_prof_header(f, api_map, opts_map):
f.write('// automatically generated sources\n')
f.write('#ifndef _HIP_PROF_STR_H\n');
f.write('#define _HIP_PROF_STR_H\n');
f.write('#define HIP_PROF_VER 1\n')
# Generating dummy macro for non-public API
f.write('\n// Dummy API primitives\n')
@@ -389,7 +390,7 @@ def generate_prof_header(f, api_map, opts_map):
# Generating the method for the API string, name and parameters
f.write('\n')
f.write('#if ENABLE_HIP_API_STRING\n')
f.write('#if HIP_PROF_HIP_API_STRING\n')
f.write('#include <sstream>\n');
f.write('#include <string>\n');
f.write('// HIP API string method, method name and parameters\n')
@@ -410,7 +411,7 @@ def generate_prof_header(f, api_map, opts_map):
f.write(' };\n')
f.write(' return strdup(oss.str().c_str());\n')
f.write('};\n')
f.write('#endif // ENABLE_HIP_API_STRING\n')
f.write('#endif // HIP_PROF_HIP_API_STRING\n')
f.write('#endif // _HIP_PROF_STR_H\n');
@@ -471,7 +472,8 @@ not_found = 0
if len(opts_map) != 0:
for name in api_map.keys():
args_str = api_map[name];
api_map[name] = list_api_args(args_str)
args_list = list_api_args(args_str)
api_map[name] = args_list
if not name in opts_map:
error("implementation not found: " + name)
not_found += 1
-198
View File
@@ -1,198 +0,0 @@
cmake_minimum_required(VERSION 3.5.1)
project(hipify-clang)
if (MSVC AND MSVC_VERSION VERSION_LESS "1900")
message(SEND_ERROR "hipify-clang could be built by Visual Studio 14 2015 or higher.")
return()
endif()
find_package(LLVM REQUIRED)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}:")
message(STATUS " - CMake module path: ${LLVM_CMAKE_DIR}")
message(STATUS " - Include path : ${LLVM_INCLUDE_DIRS}")
message(STATUS " - Binary path : ${LLVM_TOOLS_BINARY_DIR}")
option(HIPIFY_CLANG_TESTS "Build the tests for hipify-clang, if lit is installed" OFF)
list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR})
include(AddLLVM)
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
add_definitions(${LLVM_DEFINITIONS})
file(GLOB_RECURSE HIPIFY_SOURCES src/*.cpp)
file(GLOB_RECURSE HIPIFY_HEADERS src/*.h)
add_llvm_executable(hipify-clang ${HIPIFY_SOURCES} ${HIPIFY_HEADERS})
set(CMAKE_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
set(CMAKE_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
# Link against LLVM and CLANG libraries
target_link_libraries(hipify-clang PRIVATE
clangASTMatchers
clangFrontend
clangTooling
clangParse
clangSerialization
clangSema
clangEdit
clangFormat
clangLex
clangAnalysis
clangDriver
clangAST
clangToolingCore
clangRewrite
clangBasic
LLVMProfileData
LLVMSupport
LLVMMCParser
LLVMMC
LLVMBitReader
LLVMOption
LLVMCore)
if (LLVM_PACKAGE_VERSION VERSION_GREATER "6.0.1")
target_link_libraries(hipify-clang PRIVATE clangToolingInclusions)
endif()
if (LLVM_PACKAGE_VERSION VERSION_GREATER "9.0.1")
target_link_libraries(hipify-clang PRIVATE LLVMFrontendOpenMP)
endif()
if (MSVC)
target_link_libraries(hipify-clang PRIVATE version)
target_compile_options(hipify-clang PRIVATE "/Od /GR- /EHs- /EHc-")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} /SUBSYSTEM:WINDOWS")
set(StdCpp "/std:c++")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fno-rtti -fvisibility-inlines-hidden")
set(StdCpp "-std=c++")
endif()
if (LLVM_PACKAGE_VERSION VERSION_GREATER "9.0")
string(APPEND StdCpp "14")
# MSVC starting from 1900 (VS 2015) supports only the following c++ std values: c++14|c++17|c++latest
elseif (MSVC)
set(StdCpp "")
else()
string(APPEND StdCpp "11")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"")
set(INSTALL_PATH_DOC_STRING "Installation path for hipify-clang")
set(HIPIFY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX})
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(HIPIFY_INSTALL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin" CACHE PATH ${INSTALL_PATH_DOC_STRING} FORCE)
elseif(CMAKE_BUILD_TYPE MATCHES Release)
if (BIN_INSTALL_DIR)
set(HIPIFY_INSTALL_PATH "${BIN_INSTALL_DIR}" CACHE PATH ${INSTALL_PATH_DOC_STRING} FORCE)
else()
set(HIPIFY_INSTALL_PATH "${PROJECT_BINARY_DIR}/bin" CACHE PATH ${INSTALL_PATH_DOC_STRING} FORCE)
endif()
else()
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE specified. Valid values are Debug and Release")
endif()
elseif(BIN_INSTALL_DIR)
set(HIPIFY_INSTALL_PATH "${BIN_INSTALL_DIR}" CACHE PATH ${INSTALL_PATH_DOC_STRING} FORCE)
endif()
install(TARGETS hipify-clang DESTINATION ${HIPIFY_INSTALL_PATH})
install(
DIRECTORY ${LLVM_DIR}/../../clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/
DESTINATION ${HIPIFY_INSTALL_PATH}
COMPONENT clang-resource-headers
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.modulemap"
PATTERN "algorithm"
PATTERN "complex"
PATTERN "new"
PATTERN "ppc_wrappers" EXCLUDE
PATTERN "openmp_wrappers" EXCLUDE)
if (UNIX)
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/hipify-clang)
configure_file(packaging/hipify-clang.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
add_custom_target(pkg_hipify-clang COMMAND ${CMAKE_COMMAND} .
COMMAND rm -rf *.deb *.rpm *.tar.gz
COMMAND make package
COMMAND cp *.deb ${PROJECT_BINARY_DIR}
COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
COMMAND cp *.tar.gz ${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${BUILD_DIR})
file(GENERATE OUTPUT ${PROJECT_BINARY_DIR}/fixnames
CONTENT "pwd; for i in *.deb; do mv \"\$i\" \"\${i/.deb/-amd64.deb}\" ; done
for i in *.rpm ; do mv \$i \${i/.rpm/.x86_64.rpm} ; done")
add_custom_target(package_hipify-clang
COMMAND bash ${PROJECT_BINARY_DIR}/fixnames
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS pkg_hipify-clang)
endif()
if (HIPIFY_CLANG_TESTS)
find_package(PythonInterp 2.7 REQUIRED)
function (require_program PROGRAM_NAME)
find_program(FOUND_${PROGRAM_NAME} ${PROGRAM_NAME})
if (FOUND_${PROGRAM_NAME})
message(STATUS "Found ${PROGRAM_NAME}: ${FOUND_${PROGRAM_NAME}}")
else()
message(SEND_ERROR "Can't find ${PROGRAM_NAME}. Either set HIPIFY_CLANG_TESTS to OFF to disable hipify tests, or install the missing program.")
endif()
endfunction()
require_program(lit)
require_program(FileCheck)
find_package(CUDA REQUIRED)
if ((CUDA_VERSION VERSION_LESS "7.0") OR (LLVM_PACKAGE_VERSION VERSION_LESS "3.8") OR
(CUDA_VERSION VERSION_GREATER "7.5" AND LLVM_PACKAGE_VERSION VERSION_LESS "4.0") OR
(CUDA_VERSION VERSION_GREATER "8.0" AND LLVM_PACKAGE_VERSION VERSION_LESS "6.0") OR
(CUDA_VERSION VERSION_GREATER "9.0" AND LLVM_PACKAGE_VERSION VERSION_LESS "7.0") OR
(CUDA_VERSION VERSION_GREATER "9.2" AND LLVM_PACKAGE_VERSION VERSION_LESS "8.0") OR
(CUDA_VERSION VERSION_GREATER "10.0" AND LLVM_PACKAGE_VERSION VERSION_LESS "9.0") OR
(CUDA_VERSION VERSION_GREATER "10.1" AND LLVM_PACKAGE_VERSION VERSION_LESS "10.0"))
message(SEND_ERROR "CUDA ${CUDA_VERSION} is not supported by LLVM ${LLVM_PACKAGE_VERSION}.")
if (CUDA_VERSION_MAJOR VERSION_LESS "7")
message(STATUS "Please install CUDA 7.0 or higher.")
elseif (CUDA_VERSION_MAJOR VERSION_LESS "8")
message(STATUS "Please install LLVM + clang 3.8 or higher.")
elseif (CUDA_VERSION_MAJOR VERSION_LESS "9")
message(STATUS "Please install LLVM + clang 4.0 or higher.")
elseif (CUDA_VERSION VERSION_EQUAL "9.0")
message(STATUS "Please install LLVM + clang 6.0 or higher.")
elseif (CUDA_VERSION_MAJOR VERSION_LESS "10")
message(STATUS "Please install LLVM + clang 7.0 or higher.")
elseif (CUDA_VERSION VERSION_EQUAL "10.0")
message(STATUS "Please install LLVM + clang 8.0 or higher.")
elseif (CUDA_VERSION VERSION_EQUAL "10.1")
message(STATUS "Please install LLVM + clang 9.0 or higher.")
elseif (CUDA_VERSION VERSION_EQUAL "10.2")
message(STATUS "Please install LLVM + clang 10.0 or higher.")
endif()
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../tests/hipify-clang/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg
@ONLY)
add_lit_testsuite(test-hipify "Running HIPify regression tests"
${CMAKE_CURRENT_LIST_DIR}/../tests/hipify-clang
PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg
ARGS -v
DEPENDS hipify-clang)
add_custom_target(test-hipify-clang)
add_dependencies(test-hipify-clang test-hipify)
set_target_properties(test-hipify-clang PROPERTIES FOLDER "Tests")
endif()
-507
View File
@@ -1,507 +0,0 @@
# HIPIFY
### Tools to translate CUDA source code into portable HIP C++ automatically
## Table of Contents
<!-- toc -->
- [hipify-clang](#clang)
* [Dependencies](#dependencies)
* [Usage](#hipify-clang-usage)
* [Building](#building)
* [Testing](#testing)
* [Linux](#linux)
* [Windows](#windows)
- [hipify-perl](#perl)
* [Usage](#hipify-perl-usage)
* [Building](#hipify-perl-building)
- [Supported CUDA APIs](#cuda-apis)
- [Disclaimer](#disclaimer)
<!-- tocstop -->
## <a name="clang"></a> hipify-clang
`hipify-clang` is a clang-based tool for translation CUDA sources into HIP sources.
It translates CUDA source into an abstract syntax tree, which is being traversed by transformation matchers.
After applying all the matchers, the output HIP source is produced.
**Advantages:**
1. It is a translator; thus, any even very complicated constructs will be parsed successfully, or an error will be reported.
2. It supports clang options like [`-I`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-i-dir), [`-D`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-d-macro), [`--cuda-path`](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-cuda-path), etc.
3. Seamless support of new CUDA versions as it is clang's responsibility.
4. Ease in support.
**Disadvantages:**
1. The main advantage is also the main disadvantage: the input CUDA code should be correct; incorrect code wouldn't be translated to HIP.
2. CUDA should be installed and provided in case of multiple installations by `--cuda-path` option.
3. All the includes and defines should be provided to transform code successfully.
### <a name="dependencies"></a> hipify-clang: dependencies
`hipify-clang` requires:
1. [**LLVM+CLANG**](http://releases.llvm.org) of at least version [3.8.0](http://releases.llvm.org/download.html#3.8.0); the latest stable and recommended release: [**10.0.0**](http://releases.llvm.org/download.html#10.0.0).
2. [**CUDA**](https://developer.nvidia.com/cuda-downloads) of at least version [7.0](https://developer.nvidia.com/cuda-toolkit-70), the latest supported version is [**10.2**](https://developer.nvidia.com/cuda-downloads).
| **LLVM release version** | **CUDA latest supported version** | **Windows** | **Linux** |
|:----------------------------------------------------------:|:------------------------------------------------------------------------:|:-----------:|:---------:|
| [3.8.0](http://releases.llvm.org/download.html#3.8.0) | [7.5](https://developer.nvidia.com/cuda-75-downloads-archive) | + | + |
| [3.8.1](http://releases.llvm.org/download.html#3.8.1) | [7.5](https://developer.nvidia.com/cuda-75-downloads-archive) | + | + |
| [3.9.0](http://releases.llvm.org/download.html#3.9.0) | [7.5](https://developer.nvidia.com/cuda-75-downloads-archive) | + | + |
| [3.9.1](http://releases.llvm.org/download.html#3.9.1) | [7.5](https://developer.nvidia.com/cuda-75-downloads-archive) | + | + |
| [4.0.0](http://releases.llvm.org/download.html#4.0.0) | [8.0](https://developer.nvidia.com/cuda-80-ga2-download-archive) | + | + |
| [4.0.1](http://releases.llvm.org/download.html#4.0.1) | [8.0](https://developer.nvidia.com/cuda-80-ga2-download-archive) | + | + |
| [5.0.0](http://releases.llvm.org/download.html#5.0.0) | [8.0](https://developer.nvidia.com/cuda-80-ga2-download-archive) | + | + |
| [5.0.1](http://releases.llvm.org/download.html#5.0.1) | [8.0](https://developer.nvidia.com/cuda-80-ga2-download-archive) | + | + |
| [5.0.2](http://releases.llvm.org/download.html#5.0.2) | [8.0](https://developer.nvidia.com/cuda-80-ga2-download-archive) | + | + |
| [6.0.0](http://releases.llvm.org/download.html#6.0.0) | [9.0](https://developer.nvidia.com/cuda-90-download-archive) | + | + |
| [6.0.1](http://releases.llvm.org/download.html#6.0.1) | [9.0](https://developer.nvidia.com/cuda-90-download-archive) | + | + |
| [7.0.0](http://releases.llvm.org/download.html#7.0.0) | [9.2](https://developer.nvidia.com/cuda-92-download-archive) | - <br/> not working due to <br/> the clang's bug [38811](https://bugs.llvm.org/show_bug.cgi?id=38811) <br/>+<br/>[patch](patches/patch_for_clang_7.0.0_bug_38811.zip)*</br> | - <br/> not working due to <br/> the clang's bug [36384](https://bugs.llvm.org/show_bug.cgi?id=36384) |
| [7.0.1](http://releases.llvm.org/download.html#7.0.1) | [9.2](https://developer.nvidia.com/cuda-92-download-archive) | - <br/> not working due to <br/> the clang's bug [38811](https://bugs.llvm.org/show_bug.cgi?id=38811) <br/>+<br/>[patch](patches/patch_for_clang_7.0.1_bug_38811.zip)*</br> | - <br/> not working due to <br/> the clang's bug [36384](https://bugs.llvm.org/show_bug.cgi?id=36384) |
| [7.1.0](http://releases.llvm.org/download.html#7.1.0) | [9.2](https://developer.nvidia.com/cuda-92-download-archive) | - <br/> not working due to <br/> the clang's bug [38811](https://bugs.llvm.org/show_bug.cgi?id=38811) <br/>+<br/>[patch](patches/patch_for_clang_7.1.0_bug_38811.zip)*</br> | - <br/> not working due to <br/> the clang's bug [36384](https://bugs.llvm.org/show_bug.cgi?id=36384) |
| [8.0.0](http://releases.llvm.org/download.html#8.0.0) | [10.0](https://developer.nvidia.com/cuda-10.0-download-archive) | - <br/> not working due to <br/> the clang's bug [38811](https://bugs.llvm.org/show_bug.cgi?id=38811) <br/>+<br/>[patch](patches/patch_for_clang_8.0.0_bug_38811.zip)*</br> | + |
| [8.0.1](http://releases.llvm.org/download.html#8.0.1) | [10.0](https://developer.nvidia.com/cuda-10.0-download-archive) | - <br/> not working due to <br/> the clang's bug [38811](https://bugs.llvm.org/show_bug.cgi?id=38811) <br/>+<br/>[patch](patches/patch_for_clang_8.0.1_bug_38811.zip)*</br> | + |
| [9.0.0](http://releases.llvm.org/download.html#9.0.0) | [10.1](https://developer.nvidia.com/cuda-10.1-download-archive-base) | + | + |
| [9.0.1](http://releases.llvm.org/download.html#9.0.1) | [10.1](https://developer.nvidia.com/cuda-10.1-download-archive-base) | + | + |
| [**10.0.0**](http://releases.llvm.org/download.html#10.0.0)| [**10.2**](https://developer.nvidia.com/cuda-downloads) | + <br/> **LATEST STABLE RELEASE** | + <br/> **LATEST STABLE RELEASE** |
`*` Download the patch and unpack it into your `LLVM` distributive directory; a few header files will be overwritten; rebuilding of `LLVM` is not needed.
In most cases, you can get a suitable version of `LLVM+CLANG` with your package manager.
Failing that or having multiple versions of `LLVM`, you can [download a release archive](http://releases.llvm.org/), build or install it, and set
[CMAKE_PREFIX_PATH](https://cmake.org/cmake/help/v3.5/variable/CMAKE_PREFIX_PATH.html) so `cmake` can find it; for instance: `-DCMAKE_PREFIX_PATH=d:\LLVM\10.0.0\dist`
### <a name="hipify-clang-usage"></a> hipify-clang: usage
To process a file, `hipify-clang` needs access to the same headers that would be required to compile it with clang.
For example:
```shell
./hipify-clang square.cu --cuda-path=/usr/local/cuda-10.2 -I /usr/local/cuda-10.2/samples/common/inc
```
`hipify-clang` arguments are given first, followed by a separator `'--'`, and then the arguments you'd pass to `clang` if you
were compiling the input file. For example:
```bash
./hipify-clang cpp17.cu --cuda-path=/usr/local/cuda-10.2 -- -std=c++17
```
The [Clang manual for compiling CUDA](https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code) may be useful.
For a list of `hipify-clang` options, run `hipify-clang --help`.
### <a name="building"></a> hipify-clang: building
Assuming this repository is at `./HIP`:
```bash
cd hipify-clang
mkdir build dist
cd build
cmake \
-DCMAKE_INSTALL_PREFIX=../dist \
-DCMAKE_BUILD_TYPE=Release \
..
make -j install
```
On Windows, the following option should be specified for `cmake` at first place: `-G "Visual Studio 16 2019 Win64"`; the generated `hipify-clang.sln` should be built by `Visual Studio 16 2019` instead of `make.`
Please, see [hipify-clang: Windows](#windows) for the supported tools for building.
Debug build type `-DCMAKE_BUILD_TYPE=Debug` is also supported and tested; `LLVM+CLANG` should be built in `Debug` mode as well.
64-bit build mode (`-Thost=x64` on Windows) is also supported; `LLVM+CLANG` should be built in 64-bit mode as well.
The binary can then be found at `./dist/bin/hipify-clang`.
### <a name="testing"></a> hipify-clang: testing
`hipify-clang` has unit tests using `LLVM` [`lit`](https://llvm.org/docs/CommandGuide/lit.html)/[`FileCheck`](https://llvm.org/docs/CommandGuide/FileCheck.html).
`LLVM+CLANG` should be built from sources, pre-built binaries are not exhaustive for testing.
**LLVM 9.0.1 or older:**
1. download [`LLVM`](http://releases.llvm.org/9.0.1/llvm-9.0.1.src.tar.xz)+[`CLANG`](http://releases.llvm.org/9.0.1/cfe-9.0.1.src.tar.xz) sources;
2. build [`LLVM+CLANG`](http://releases.llvm.org/9.0.0/docs/CMake.html):
**Linux**:
```bash
cmake \
-DCMAKE_INSTALL_PREFIX=../dist \
-DLLVM_SOURCE_DIR=../llvm \
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \
-DCMAKE_BUILD_TYPE=Release \
../llvm
make -j install
```
**Windows**:
```shell
cmake \
-G "Visual Studio 16 2019" \
-A x64 \
-DCMAKE_INSTALL_PREFIX=../dist \
-DLLVM_SOURCE_DIR=../llvm \
-DLLVM_TARGETS_TO_BUILD="NVPTX" \
-DCMAKE_BUILD_TYPE=Release \
-Thost=x64 \
../llvm
```
Run `Visual Studio 16 2019`, open the generated `LLVM.sln`, build all, build project `INSTALL`.
**LLVM 10.0.0 or newer:**
1. download [`LLVM project`](https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-project-10.0.0.tar.xz) sources;
2. build [`LLVM project`](http://llvm.org/docs/CMake.html):
**Linux**:
```bash
cmake \
-DCMAKE_INSTALL_PREFIX=../dist \
-DLLVM_SOURCE_DIR=../llvm-project \
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
-DCMAKE_BUILD_TYPE=Release \
../llvm-project/llvm
make -j install
```
**Windows**:
```shell
cmake \
-G "Visual Studio 16 2019" \
-A x64 \
-DCMAKE_INSTALL_PREFIX=../dist \
-DLLVM_SOURCE_DIR=../llvm-project \
-DLLVM_TARGETS_TO_BUILD="NVPTX" \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
-DCMAKE_BUILD_TYPE=Release \
-Thost=x64 \
../llvm-project/llvm
```
Run `Visual Studio 16 2019`, open the generated `LLVM.sln`, build all, build project `INSTALL`.
3. Ensure [`CUDA`](https://developer.nvidia.com/cuda-toolkit-archive) of minimum version 7.0 is installed.
* Having multiple CUDA installations to choose a particular version the `DCUDA_TOOLKIT_ROOT_DIR` option should be specified:
- ***Linux***: `-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2`
- ***Windows***: `-DCUDA_TOOLKIT_ROOT_DIR="c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2"`
`-DCUDA_SDK_ROOT_DIR="c:/ProgramData/NVIDIA Corporation/CUDA Samples/v10.2"`
4. Ensure [`cuDNN`](https://developer.nvidia.com/rdp/cudnn-archive) of the version corresponding to CUDA's version is installed.
* Path to cuDNN should be specified by the `CUDA_DNN_ROOT_DIR` option:
- ***Linux***: `-DCUDA_DNN_ROOT_DIR=/srv/CUDNN/cudnn-10.2-v7.6.5.32`
- ***Windows***: `-DCUDA_DNN_ROOT_DIR=d:/CUDNN/cudnn-10.2-windows10-x64-v7.6.5.32`
5. Ensure [`CUB`](https://github.com/NVlabs/cub) of the version corresponding to CUDA's version is installed.
* Path to CUB should be specified by the `CUDA_CUB_ROOT_DIR` option:
- ***Linux***: `-DCUDA_CUB_ROOT_DIR=/srv/git/CUB`
- ***Windows***: `-DCUDA_CUB_ROOT_DIR=d:/GIT/cub`
5. Ensure [`python`](https://www.python.org/downloads) of minimum required version 2.7 is installed.
6. Ensure `lit` and `FileCheck` are installed - these are distributed with `LLVM`.
* Install `lit` into `python`:
- ***Linux***: `python /srv/git/LLVM/10.0.0/llvm/utils/lit/setup.py install`
- ***Windows***: `python d:/LLVM/10.0.0/llvm/utils/lit/setup.py install`
* Starting with LLVM 6.0.1 path to `llvm-lit` python script should be specified by the `LLVM_EXTERNAL_LIT` option:
- ***Linux***: `-DLLVM_EXTERNAL_LIT=/srv/git/LLVM/10.0.0/build/bin/llvm-lit`
- ***Windows***: `-DLLVM_EXTERNAL_LIT=d:/LLVM/10.0.0/build/Release/bin/llvm-lit.py`
* `FileCheck`:
- ***Linux***: copy from `/srv/git/LLVM/10.0.0/build/bin/` to `CMAKE_INSTALL_PREFIX/dist/bin`
- ***Windows***: copy from `d:/LLVM/10.0.0/build/Release/bin` to `CMAKE_INSTALL_PREFIX/dist/bin`
- Or specify the path to `FileCheck` in `CMAKE_INSTALL_PREFIX` option
7. Set `HIPIFY_CLANG_TESTS` option turned on: `-DHIPIFY_CLANG_TESTS=1`.
8. Build and run tests:
### <a name="Linux"></a > hipify-clang: Linux
On Linux the following configurations are tested:
Ubuntu 14: LLVM 5.0.0 - 6.0.1, CUDA 7.0 - 9.0, cudnn-5.0.5 - cudnn-7.6.5.32
Ubuntu 16-18: LLVM 8.0.0 - 10.0.0, CUDA 8.0 - 10.2, cudnn-5.1.10 - cudnn-7.6.5.32
Minimum build system requirements for the above configurations:
Python 2.7, cmake 3.5.1, GNU C/C++ 5.4.0.
Here is an example of building `hipify-clang` with testing support on `Ubuntu 16.04`:
```bash
cmake
-DHIPIFY_CLANG_TESTS=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=../dist \
-DCMAKE_PREFIX_PATH=/srv/git/LLVM/10.0.0/dist \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2 \
-DCUDA_DNN_ROOT_DIR=/srv/CUDNN/cudnn-10.2-v7.6.5.32 \
-DCUDA_CUB_ROOT_DIR=/srv/git/CUB \
-DLLVM_EXTERNAL_LIT=/srv/git/LLVM/10.0.0/build/bin/llvm-lit \
..
```
*A corresponding successful output:*
```shell
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM 10.0.0:
-- - CMake module path: /srv/git/LLVM/10.0.0/dist/lib/cmake/llvm
-- - Include path : /srv/git/LLVM/10.0.0/dist/include
-- - Binary path : /srv/git/LLVM/10.0.0/dist/bin
-- Linker detection: GNU ld
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")
-- Found lit: /usr/local/bin/lit
-- Found FileCheck: /srv/git/LLVM/10.0.0/dist/bin/FileCheck
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-10.2 (found version "10.2")
-- Configuring done
-- Generating done
-- Build files have been written to: /srv/git/HIP/hipify-clang/build
```
```shell
make test-hipify
```
*A corresponding successful output:*
```shell
Running HIPify regression tests
========================================
CUDA 10.2 - will be used for testing
LLVM 10.0.0 - will be used for testing
x86_64 - Platform architecture
Linux 5.2.0 - Platform OS
64 - hipify-clang binary bitness
64 - python 2.7.12 binary bitness
========================================
-- Testing: 69 tests, 12 threads --
PASS: hipify :: unit_tests/casts/reinterpret_cast.cu (1 of 69)
PASS: hipify :: unit_tests/device/math_functions.cu (2 of 69)
PASS: hipify :: unit_tests/device/atomics.cu (3 of 69)
PASS: hipify :: unit_tests/headers/headers_test_01.cu (4 of 69)
PASS: hipify :: unit_tests/device/device_symbols.cu (5 of 69)
PASS: hipify :: unit_tests/headers/headers_test_02.cu (6 of 69)
PASS: hipify :: unit_tests/headers/headers_test_03.cu (7 of 69)
PASS: hipify :: unit_tests/headers/headers_test_05.cu (8 of 69)
PASS: hipify :: unit_tests/headers/headers_test_04.cu (9 of 69)
PASS: hipify :: unit_tests/headers/headers_test_07.cu (10 of 69)
PASS: hipify :: unit_tests/headers/headers_test_06.cu (11 of 69)
PASS: hipify :: unit_tests/headers/headers_test_11.cu (12 of 69)
PASS: hipify :: unit_tests/headers/headers_test_10.cu (13 of 69)
PASS: hipify :: unit_tests/headers/headers_test_08.cu (14 of 69)
PASS: hipify :: unit_tests/kernel_launch/kernel_launch_01.cu (15 of 69)
PASS: hipify :: unit_tests/libraries/CAFFE2/caffe2_02.cu (16 of 69)
PASS: hipify :: unit_tests/headers/headers_test_09.cu (17 of 69)
PASS: hipify :: unit_tests/libraries/CAFFE2/caffe2_01.cu (18 of 69)
PASS: hipify :: unit_tests/libraries/cuBLAS/cublas_0_based_indexing.cu (19 of 69)
PASS: hipify :: unit_tests/libraries/cuBLAS/cublas_1_based_indexing.cu (20 of 69)
PASS: hipify :: unit_tests/libraries/CUB/cub_03.cu (21 of 69)
PASS: hipify :: unit_tests/libraries/CUB/cub_01.cu (22 of 69)
PASS: hipify :: unit_tests/libraries/CUB/cub_02.cu (23 of 69)
PASS: hipify :: unit_tests/libraries/cuBLAS/cublas_sgemm_matrix_multiplication.cu (24 of 69)
PASS: hipify :: unit_tests/libraries/cuBLAS/rocBLAS/cublas_0_based_indexing_rocblas.cu (25 of 69)
PASS: hipify :: unit_tests/libraries/cuBLAS/rocBLAS/cublas_1_based_indexing_rocblas.cu (26 of 69)
PASS: hipify :: unit_tests/libraries/cuBLAS/rocBLAS/cublas_sgemm_matrix_multiplication_rocblas.cu (27 of 69)
PASS: hipify :: unit_tests/libraries/cuComplex/cuComplex_Julia.cu (28 of 69)
PASS: hipify :: unit_tests/libraries/cuDNN/cudnn_softmax.cu (29 of 69)
PASS: hipify :: unit_tests/libraries/cuFFT/simple_cufft.cu (30 of 69)
PASS: hipify :: unit_tests/libraries/cuDNN/cudnn_convolution_forward.cu (31 of 69)
PASS: hipify :: unit_tests/libraries/cuRAND/poisson_api_example.cu (32 of 69)
PASS: hipify :: unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp (33 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_01.cu (34 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_02.cu (35 of 69)
PASS: hipify :: unit_tests/libraries/cuRAND/benchmark_curand_kernel.cpp (36 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_03.cu (37 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_04.cu (38 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_05.cu (39 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_06.cu (40 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_07.cu (41 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_08.cu (42 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_09.cu (43 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_10.cu (44 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_11.cu (45 of 69)
PASS: hipify :: unit_tests/namespace/ns_kernel_launch.cu (46 of 69)
PASS: hipify :: unit_tests/libraries/cuSPARSE/cuSPARSE_12.cu (47 of 69)
PASS: hipify :: unit_tests/pp/pp_if_else_conditionals.cu (48 of 69)
PASS: hipify :: unit_tests/pp/pp_if_else_conditionals_01.cu (49 of 69)
PASS: hipify :: unit_tests/pp/pp_if_else_conditionals_01_LLVM_10.cu (50 of 69)
PASS: hipify :: unit_tests/pp/pp_if_else_conditionals_LLVM_10.cu (51 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/11_texture_driver/tex2dKernel.cpp (52 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/0_MatrixTranspose/MatrixTranspose.cpp (53 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp (54 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/1_hipEvent/hipEvent.cpp (55 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/13_occupancy/occupancy.cpp (56 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/2_Profiler/Profiler.cpp (57 of 69)
PASS: hipify :: unit_tests/samples/MallocManaged.cpp (58 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/7_streams/stream.cpp (59 of 69)
PASS: hipify :: unit_tests/samples/2_Cookbook/8_peer2peer/peer2peer.cpp (60 of 69)
PASS: hipify :: unit_tests/samples/allocators.cu (61 of 69)
PASS: hipify :: unit_tests/samples/coalescing.cu (62 of 69)
PASS: hipify :: unit_tests/samples/axpy.cu (63 of 69)
PASS: hipify :: unit_tests/samples/dynamic_shared_memory.cu (64 of 69)
PASS: hipify :: unit_tests/samples/cudaRegister.cu (65 of 69)
PASS: hipify :: unit_tests/samples/intro.cu (66 of 69)
PASS: hipify :: unit_tests/samples/square.cu (67 of 69)
PASS: hipify :: unit_tests/samples/static_shared_memory.cu (68 of 69)
PASS: hipify :: unit_tests/samples/vec_add.cu (69 of 69)
Testing Time: 3.23s
Expected Passes : 69
[100%] Built target test-hipify
```
### <a name="windows"></a > hipify-clang: Windows
*Tested configurations:*
| **LLVM** | **CUDA** | **cuDNN** | **Visual Studio** | **cmake** | **Python** |
|:--------------:|---------:|--------------------:|--------------------------:|----------:|-----------:|
| 5.0.0 - 5.0.2 | 8.0 | 5.1.10 - 7.1.4.18 | 2017.15.5.2 | 3.5.1 | 3.6.4 |
| 6.0.0 - 6.0.1 | 9.0 | 7.0.5.15 - 7.6.5.32 | 2017.15.5.5 | 3.6.0 | 3.7.2 |
| 7.0.0 - 7.1.0 | 9.2 | 7.6.5.32 | 2017.15.9.11 | 3.13.3 | 3.7.3 |
| 8.0.0 - 8.0.1 | 10.0 | 7.6.5.32 | 2017.15.9.15 | 3.14.2 | 3.7.4 |
| 9.0.0 - 9.0.1 | 10.1 | 7.6.5.32 | 2017.15.9.20, 2019.16.4.5 | 3.16.4 | 3.8.0 |
| 10.0.0 | 10.2 | 7.6.5.32 | 2017.15.9.21, 2019.16.5.1 | 3.17.0 | 3.8.2 |
| 11.0.0git | 10.2 | 7.6.5.32 | 2017.15.9.21, 2019.16.5.1 | 3.17.0 | 3.8.2 |
*Building with testing support on `Windows 10` by `Visual Studio 16 2019`:*
```shell
cmake
-G "Visual Studio 16 2019" \
-A x64 \
-DHIPIFY_CLANG_TESTS=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=../dist \
-DCMAKE_PREFIX_PATH=d:/LLVM/10.0.0/dist \
-DCUDA_TOOLKIT_ROOT_DIR="c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2" \
-DCUDA_SDK_ROOT_DIR="c:/ProgramData/NVIDIA Corporation/CUDA Samples/v10.2" \
-DCUDA_DNN_ROOT_DIR=d:/CUDNN/cudnn-10.2-windows10-x64-v7.6.5.32 \
-DCUDA_CUB_ROOT_DIR=d:/GIT/cub \
-DLLVM_EXTERNAL_LIT=d:/LLVM/10.0.0/build/Release/bin/llvm-lit.py \
-Thost=x64
..
```
*A corresponding successful output:*
```shell
-- Found LLVM 10.0.0:
-- - CMake module path: d:/LLVM/10.0.0/dist/lib/cmake/llvm
-- - Include path : d:/LLVM/10.0.0/dist/include
-- - Binary path : d:/LLVM/10.0.0/dist/bin
-- Found PythonInterp: c:/Program Files/Python38/python.exe (found suitable version "3.8.2", minimum required is "3.6")
-- Found lit: c:/Program Files/Python38/Scripts/lit.exe
-- Found FileCheck: d:/LLVM/10.0.0/dist/bin/FileCheck.exe
-- Found CUDA: c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2 (found version "10.2")
-- Configuring done
-- Generating done
-- Build files have been written to: d:/HIP/hipify-clang/build
```
Run `Visual Studio 16 2019`, open the generated `hipify-clang.sln`, build project `test-hipify`.
## <a name="perl"></a> hipify-perl
`hipify-perl` is autogenerated perl-based script which heavily uses regular expressions.
**Advantages:**
1. Ease in use.
2. It doesn't check the input source CUDA code for correctness.
3. It doesn't have dependencies on 3rd party tools, including CUDA.
**Disadvantages:**
1. Current disability (and difficulty in implementing) of transforming the following constructs:
* macros expansion;
* namespaces:
- redefines of CUDA entities in user namespaces;
- using directive;
* templates (some cases);
* device/host function calls distinguishing;
* header files correct injection;
* complicated argument lists parsing.
2. Difficulties in supporting.
### <a name="hipify-perl-usage"></a> hipify-perl: usage
```shell
perl hipify-perl square.cu > square.cu.hip
```
### <a name="hipify-perl-building"></a> hipify-perl: building
To generate `hipify-perl`, run `hipify-clang --perl`. Output directory for the generated `hipify-perl` file might be specified by `--o-hipify-perl-dir` option.
## <a name="cuda-apis"></a> Supported CUDA APIs
- [Runtime API](../docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md)
- [Driver API](../docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md)
- [cuComplex API](../docs/markdown/cuComplex_API_supported_by_HIP.md)
- [cuBLAS](../docs/markdown/CUBLAS_API_supported_by_HIP.md)
- [cuRAND](../docs/markdown/CURAND_API_supported_by_HIP.md)
- [cuDNN](../docs/markdown/CUDNN_API_supported_by_HIP.md)
- [cuFFT](../docs/markdown/CUFFT_API_supported_by_HIP.md)
- [cuSPARSE](../docs/markdown/CUSPARSE_API_supported_by_HIP.md)
## <a name="disclaimer"></a> Disclaimer
The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD's products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale.
AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
Copyright (c) 2014-2020 Advanced Micro Devices, Inc. All rights reserved.
@@ -1,58 +0,0 @@
cmake_minimum_required(VERSION 2.8.3)
project(hipify-clang)
install(PROGRAMS @HIPIFY_INSTALL_PATH@/hipify-clang DESTINATION bin)
install(DIRECTORY @HIPIFY_INSTALL_PATH@/include DESTINATION bin)
# Check if .hipversion exists(only exists when hipify-clang is built with HIP)
if(EXISTS "@HIPIFY_INSTALL_PATH@/.hipVersion")
set(HIP_BUILD "TRUE")
else()
set(HIP_BUILD "FALSE")
endif()
if(${HIP_BUILD})
file(STRINGS @HIPIFY_INSTALL_PATH@/.hipVersion HipVersion)
foreach(NameAndValue ${HipVersion})
# Get variable name
string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
# Get the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
# Assign the vale to the variable
set(${Name} "${Value}")
endforeach()
endif()
#############################
# Packaging steps
#############################
set(CPACK_SET_DESTDIR TRUE)
set(CPACK_INSTALL_PREFIX "/opt/rocm/hip")
set(CPACK_PACKAGE_NAME "hipify-clang")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "hipify-clang: a clang-based tool to translate CUDA source code into portable HIP C++ automatically")
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
set(CPACK_PACKAGE_CONTACT "Mankov Evgeny <Evgeniy.Mankov@amd.com>")
if(${HIP_BUILD})
set(CPACK_PACKAGE_VERSION ${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_MAJOR ${HIP_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${HIP_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${HIP_VERSION_PATCH})
else()
set(CPACK_PACKAGE_VERSION @LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@.@LLVM_VERSION_PATCH@)
set(CPACK_PACKAGE_VERSION_MAJOR @LLVM_VERSION_MAJOR@)
set(CPACK_PACKAGE_VERSION_MINOR @LLVM_VERSION_MINOR@)
set(CPACK_PACKAGE_VERSION_PATCH @LLVM_VERSION_PATCH@)
endif()
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set(CPACK_GENERATOR "TGZ;DEB;RPM")
set(CPACK_BINARY_DEB "ON")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "cuda (>= 7.0)")
set(CPACK_BINARY_RPM "ON")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RPM_PACKAGE_AUTOREQPROV "NO")
set(CPACK_RPM_PACKAGE_REQUIRES "cuda >= 7.0")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt")
set(CPACK_SOURCE_GENERATOR "TGZ")
include(CPack)
-149
View File
@@ -1,149 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "ArgParse.h"
cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options");
cl::opt<std::string> OutputFilename("o",
cl::desc("Output filename"),
cl::value_desc("filename"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> OutputDir("o-dir",
cl::desc("Output directory"),
cl::value_desc("directory"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> GeneratePerl("perl",
cl::desc("Generate hipify-perl"),
cl::value_desc("perl"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> GeneratePython("python",
cl::desc("Generate hipify-python"),
cl::value_desc("python"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> OutputHipifyPerlDir("o-hipify-perl-dir",
cl::desc("Output directory for hipify-perl script"),
cl::value_desc("directory"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> OutputPythonMapDir("o-python-map-dir",
cl::desc("Output directory for Python map"),
cl::value_desc("directory"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> TemporaryDir("temp-dir",
cl::desc("Temporary directory"),
cl::value_desc("directory"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> CudaPath("cuda-path",
cl::desc("CUDA installation path"),
cl::value_desc("directory"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> SaveTemps("save-temps",
cl::desc("Save temporary files"),
cl::value_desc("save-temps"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> Verbose("v",
cl::desc("Show commands to run and use verbose output"),
cl::value_desc("v"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> TranslateToRoc("roc",
cl::desc("Translate to roc instead of hip where it is possible"),
cl::value_desc("roc"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> Inplace("inplace",
cl::desc("Modify input file inplace, replacing input with hipified output, save backup in .prehip file"),
cl::value_desc("inplace"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> NoBackup("no-backup",
cl::desc("Don't create a backup file for the hipified source"),
cl::value_desc("no-backup"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> NoOutput("no-output",
cl::desc("Don't write any translated output to stdout"),
cl::value_desc("no-output"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> PrintStats("print-stats",
cl::desc("Print translation statistics"),
cl::value_desc("print-stats"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> PrintStatsCSV("print-stats-csv",
cl::desc("Print translation statistics in CSV file"),
cl::value_desc("print-stats-csv"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> OutputStatsFilename("o-stats",
cl::desc("Output filename for statistics"),
cl::value_desc("filename"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> Examine("examine",
cl::desc("Combines -no-output and -print-stats options"),
cl::value_desc("examine"),
cl::cat(ToolTemplateCategory));
cl::opt<bool> DashDash(" ",
cl::desc("Separator between hipify-clang and clang options;\ndon't specify if there are no clang options"),
cl::ValueDisallowed,
cl::cat(ToolTemplateCategory));
cl::list<std::string> IncludeDirs("I",
cl::desc("Add directory to include search path"),
cl::value_desc("directory"),
cl::ZeroOrMore,
cl::Prefix,
cl::cat(ToolTemplateCategory));
cl::list<std::string> MacroNames("D",
cl::desc("Define <macro> to <value> or 1 if <value> omitted"),
cl::value_desc("macro>=<value"),
cl::ZeroOrMore,
cl::Prefix,
cl::cat(ToolTemplateCategory));
cl::opt<bool> SkipExcludedPPConditionalBlocks("skip-excluded-preprocessor-conditional-blocks",
cl::desc("Enable default preprocessor behaviour by skipping undefined conditional blocks"),
cl::value_desc("skip-excluded-preprocessor-conditional-blocks"),
cl::cat(ToolTemplateCategory));
cl::opt<std::string> CudaGpuArch("cuda-gpu-arch",
cl::desc("CUDA GPU architecture (e.g. sm_35);\nmay be specified more than once"),
cl::value_desc("value"),
cl::ZeroOrMore,
cl::Prefix,
cl::cat(ToolTemplateCategory));
cl::extrahelp CommonHelp(ct::CommonOptionsParser::HelpMessage);
-55
View File
@@ -1,55 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include "clang/Tooling/CommonOptionsParser.h"
#include "llvm/Support/CommandLine.h"
namespace cl = llvm::cl;
namespace ct = clang::tooling;
extern cl::OptionCategory ToolTemplateCategory;
extern cl::opt<std::string> OutputFilename;
extern cl::opt<std::string> OutputHipifyPerlDir;
extern cl::opt<std::string> OutputPythonMapDir;
extern cl::opt<std::string> OutputDir;
extern cl::opt<std::string> TemporaryDir;
extern cl::opt<std::string> CudaPath;
extern cl::list<std::string> IncludeDirs;
extern cl::list<std::string> MacroNames;
extern cl::opt<bool> Inplace;
extern cl::opt<bool> SaveTemps;
extern cl::opt<bool> GeneratePerl;
extern cl::opt<bool> GeneratePython;
extern cl::opt<bool> Verbose;
extern cl::opt<bool> NoBackup;
extern cl::opt<bool> NoOutput;
extern cl::opt<bool> PrintStats;
extern cl::opt<bool> PrintStatsCSV;
extern cl::opt<std::string> OutputStatsFilename;
extern cl::opt<bool> Examine;
extern cl::extrahelp CommonHelp;
extern cl::opt<bool> TranslateToRoc;
extern cl::opt<bool> DashDash;
extern cl::opt<bool> SkipExcludedPPConditionalBlocks;
extern cl::opt<std::string> CudaGpuArch;
-110
View File
@@ -1,110 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps CUDA header names to HIP header names
const std::map <llvm::StringRef, hipCounter> CUDA_INCLUDE_MAP{
// CUDA includes
{"cuda.h", {"hip/hip_runtime.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_DRIVER}},
{"cuda_runtime.h", {"hip/hip_runtime.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_RUNTIME}},
{"cuda_runtime_api.h", {"hip/hip_runtime_api.h", "", CONV_INCLUDE, API_RUNTIME}},
{"channel_descriptor.h", {"hip/channel_descriptor.h", "", CONV_INCLUDE, API_RUNTIME}},
{"device_functions.h", {"hip/device_functions.h", "", CONV_INCLUDE, API_RUNTIME}},
{"driver_types.h", {"hip/driver_types.h", "", CONV_INCLUDE, API_RUNTIME}},
{"cuda_fp16.h", {"hip/hip_fp16.h", "", CONV_INCLUDE, API_RUNTIME}},
{"cuda_texture_types.h", {"hip/hip_texture_types.h", "", CONV_INCLUDE, API_RUNTIME}},
{"texture_fetch_functions.h", {"", "", CONV_INCLUDE, API_RUNTIME}},
{"vector_types.h", {"hip/hip_vector_types.h", "", CONV_INCLUDE, API_RUNTIME}},
{"cuda_profiler_api.h", {"hip/hip_profile.h", "", CONV_INCLUDE, API_RUNTIME}},
{"cooperative_groups.h", {"hip/hip_cooperative_groups.h", "", CONV_INCLUDE, API_RUNTIME}},
// cuComplex includes
{"cuComplex.h", {"hip/hip_complex.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_COMPLEX}},
// cuBLAS includes
{"cublas.h", {"hipblas.h", "rocblas.h", CONV_INCLUDE_CUDA_MAIN_H, API_BLAS}},
{"cublas_v2.h", {"hipblas.h", "rocblas.h", CONV_INCLUDE_CUDA_MAIN_H, API_BLAS}},
// cuRAND includes
{"curand.h", {"hiprand.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_RAND}},
{"curand_kernel.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_discrete.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_discrete2.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_globals.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_lognormal.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_mrg32k3a.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_mtgp32.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_mtgp32_host.h", {"hiprand_mtgp32_host.h", "", CONV_INCLUDE, API_RAND}},
{"curand_mtgp32_kernel.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_mtgp32dc_p_11213.h", {"rocrand_mtgp32_11213.h", "", CONV_INCLUDE, API_RAND}},
{"curand_normal.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_normal_static.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_philox4x32_x.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_poisson.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_precalc.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
{"curand_uniform.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND}},
// cuDNN includes
{"cudnn.h", {"hipDNN.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_DNN}},
// cuFFT includes
{"cufft.h", {"hipfft.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_FFT}},
// cuSPARSE includes
{"cusparse.h", {"hipsparse.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_SPARSE}},
{"cusparse_v2.h", {"hipsparse.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_SPARSE}},
// CUB includes
{"cub/cub.cuh", {"hipcub/hipcub.hpp", "", CONV_INCLUDE_CUDA_MAIN_H, API_CUB}},
// CAFFE2 includes
{"caffe2/core/common_gpu.h", {"caffe2/core/hip/common_gpu.h", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/core/context_gpu.h", {"caffe2/core/hip/context_gpu.h", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/operators/operator_fallback_gpu.h", {"", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/operators/spatial_batch_norm_op.h", {"caffe2/operators/hip/spatial_batch_norm_op_miopen.hip", "", CONV_INCLUDE, API_CAFFE2}},
{"caffe2/operators/generate_proposals_op_util_nms_gpu.h", {"", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/operators/max_pool_with_index_gpu.h", {"", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/operators/rnn/recurrent_network_executor_gpu.h", {"", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/utils/math/reduce.cuh", {"caffe2/utils/math/hip/reduce.cuh", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/operators/gather_op.cuh", {"caffe2/operators/math/gather_op.cuh", "", CONV_INCLUDE, API_CAFFE2, UNSUPPORTED}},
{"caffe2/core/common_cudnn.h", {"caffe2/core/hip/common_miopen.h", "", CONV_INCLUDE, API_CAFFE2}},
};
const std::map<llvm::StringRef, hipCounter>& CUDA_RENAMES_MAP() {
static std::map<llvm::StringRef, hipCounter> ret;
if (!ret.empty()) {
return ret;
}
// First run, so compute the union map.
ret.insert(CUDA_DRIVER_TYPE_NAME_MAP.begin(), CUDA_DRIVER_TYPE_NAME_MAP.end());
ret.insert(CUDA_DRIVER_FUNCTION_MAP.begin(), CUDA_DRIVER_FUNCTION_MAP.end());
ret.insert(CUDA_RUNTIME_TYPE_NAME_MAP.begin(), CUDA_RUNTIME_TYPE_NAME_MAP.end());
ret.insert(CUDA_RUNTIME_FUNCTION_MAP.begin(), CUDA_RUNTIME_FUNCTION_MAP.end());
ret.insert(CUDA_COMPLEX_TYPE_NAME_MAP.begin(), CUDA_COMPLEX_TYPE_NAME_MAP.end());
ret.insert(CUDA_COMPLEX_FUNCTION_MAP.begin(), CUDA_COMPLEX_FUNCTION_MAP.end());
ret.insert(CUDA_BLAS_TYPE_NAME_MAP.begin(), CUDA_BLAS_TYPE_NAME_MAP.end());
ret.insert(CUDA_BLAS_FUNCTION_MAP.begin(), CUDA_BLAS_FUNCTION_MAP.end());
ret.insert(CUDA_RAND_TYPE_NAME_MAP.begin(), CUDA_RAND_TYPE_NAME_MAP.end());
ret.insert(CUDA_RAND_FUNCTION_MAP.begin(), CUDA_RAND_FUNCTION_MAP.end());
ret.insert(CUDA_DNN_TYPE_NAME_MAP.begin(), CUDA_DNN_TYPE_NAME_MAP.end());
ret.insert(CUDA_DNN_FUNCTION_MAP.begin(), CUDA_DNN_FUNCTION_MAP.end());
ret.insert(CUDA_FFT_TYPE_NAME_MAP.begin(), CUDA_FFT_TYPE_NAME_MAP.end());
ret.insert(CUDA_FFT_FUNCTION_MAP.begin(), CUDA_FFT_FUNCTION_MAP.end());
ret.insert(CUDA_SPARSE_TYPE_NAME_MAP.begin(), CUDA_SPARSE_TYPE_NAME_MAP.end());
ret.insert(CUDA_SPARSE_FUNCTION_MAP.begin(), CUDA_SPARSE_FUNCTION_MAP.end());
ret.insert(CUDA_CAFFE2_TYPE_NAME_MAP.begin(), CUDA_CAFFE2_TYPE_NAME_MAP.end());
ret.insert(CUDA_CAFFE2_FUNCTION_MAP.begin(), CUDA_CAFFE2_FUNCTION_MAP.end());
return ret;
};
-81
View File
@@ -1,81 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include "llvm/ADT/StringRef.h"
#include <set>
#include <map>
#include "Statistics.h"
// Maps CUDA header names to HIP header names
extern const std::map<llvm::StringRef, hipCounter> CUDA_INCLUDE_MAP;
// Maps the names of CUDA DRIVER API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_TYPE_NAME_MAP;
// Maps the names of CUDA DRIVER API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP;
// Maps the names of CUDA RUNTIME API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_TYPE_NAME_MAP;
// Maps the names of CUDA Complex API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_TYPE_NAME_MAP;
// Maps the names of CUDA Complex API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_FUNCTION_MAP;
// Maps the names of CUDA RUNTIME API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_FUNCTION_MAP;
// Maps the names of CUDA BLAS API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_TYPE_NAME_MAP;
// Maps the names of CUDA BLAS API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_FUNCTION_MAP;
// Maps the names of CUDA RAND API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_RAND_TYPE_NAME_MAP;
// Maps the names of CUDA RAND API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_RAND_FUNCTION_MAP;
// Maps the names of CUDA DNN API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_DNN_TYPE_NAME_MAP;
// Maps the names of CUDA DNN API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_DNN_FUNCTION_MAP;
// Maps the names of CUDA FFT API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_FFT_TYPE_NAME_MAP;
// Maps the names of CUDA FFT API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_FFT_FUNCTION_MAP;
// Maps the names of CUDA SPARSE API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_TYPE_NAME_MAP;
// Maps the names of CUDA SPARSE API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP;
// Maps the names of CUDA CAFFE2 API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_CAFFE2_TYPE_NAME_MAP;
// Maps the names of CUDA CAFFE2 API functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_CAFFE2_FUNCTION_MAP;
// Maps the names of CUDA Device functions to the corresponding HIP functions
extern const std::map<llvm::StringRef, hipCounter> CUDA_DEVICE_FUNC_MAP;
// Maps the names of CUDA CUB API types to the corresponding HIP types
extern const std::map<llvm::StringRef, hipCounter> CUDA_CUB_TYPE_NAME_MAP;
/**
* The union of all the above maps, except includes.
*
* This should be used rarely, but is still needed to convert macro definitions (which can
* contain any combination of the above things). AST walkers can usually get away with just
* looking in the lookup table for the type of element they are processing, however, saving
* a great deal of time.
*/
const std::map<llvm::StringRef, hipCounter>& CUDA_RENAMES_MAP();
@@ -1,671 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_FUNCTION_MAP{
// Blas management functions
{"cublasInit", {"hipblasInit", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasShutdown", {"hipblasShutdown", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetVersion", {"hipblasGetVersion", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetError", {"hipblasGetError", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasAlloc", {"hipblasAlloc", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasFree", {"hipblasFree", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSetKernelStream", {"hipblasSetKernelStream", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetAtomicsMode", {"hipblasGetAtomicsMode", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSetAtomicsMode", {"hipblasSetAtomicsMode", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetMathMode", {"hipblasGetMathMode", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSetMathMode", {"hipblasSetMathMode", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Blas logging
{"cublasLogCallback", {"hipblasLogCallback", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasLoggerConfigure", {"hipblasLoggerConfigure", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSetLoggerCallback", {"hipblasSetLoggerCallback", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetLoggerCallback", {"hipblasGetLoggerCallback", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Blas1 (v1) Routines
{"cublasCreate", {"hipblasCreate", "rocblas_create_handle", CONV_LIB_FUNC, API_BLAS}},
{"cublasDestroy", {"hipblasDestroy", "rocblas_destroy_handle", CONV_LIB_FUNC, API_BLAS}},
{"cublasSetStream", {"hipblasSetStream", "rocblas_set_stream", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetStream", {"hipblasGetStream", "rocblas_get_stream", CONV_LIB_FUNC, API_BLAS}},
{"cublasSetPointerMode", {"hipblasSetPointerMode", "rocblas_set_pointer_mode", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetPointerMode", {"hipblasGetPointerMode", "rocblas_get_pointer_mode", CONV_LIB_FUNC, API_BLAS}},
{"cublasSetVector", {"hipblasSetVector", "rocblas_set_vector", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetVector", {"hipblasGetVector", "rocblas_get_vector", CONV_LIB_FUNC, API_BLAS}},
{"cublasSetVectorAsync", {"hipblasSetVectorAsync", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetVectorAsync", {"hipblasGetVectorAsync", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSetMatrix", {"hipblasSetMatrix", "rocblas_set_matrix", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetMatrix", {"hipblasGetMatrix", "rocblas_get_matrix", CONV_LIB_FUNC, API_BLAS}},
{"cublasSetMatrixAsync", {"hipblasSetMatrixAsync", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetMatrixAsync", {"hipblasGetMatrixAsync", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasXerbla", {"hipblasXerbla", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// NRM2
{"cublasSnrm2", {"hipblasSnrm2", "rocblas_snrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasDnrm2", {"hipblasDnrm2", "rocblas_dnrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasScnrm2", {"hipblasScnrm2", "rocblas_scnrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasDznrm2", {"hipblasDznrm2", "rocblas_dznrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasNrm2Ex", {"hipblasNrm2Ex", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// DOT
{"cublasSdot", {"hipblasSdot", "rocblas_sdot", CONV_LIB_FUNC, API_BLAS}},
{"cublasDdot", {"hipblasDdot", "rocblas_ddot", CONV_LIB_FUNC, API_BLAS}},
{"cublasCdotu", {"hipblasCdotu", "rocblas_cdotu", CONV_LIB_FUNC, API_BLAS}},
{"cublasCdotc", {"hipblasCdotc", "rocblas_cdotc", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdotu", {"hipblasZdotu", "rocblas_zdotu", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdotc", {"hipblasZdotc", "rocblas_zdotc", CONV_LIB_FUNC, API_BLAS}},
// SCAL
{"cublasSscal", {"hipblasSscal", "rocblas_sscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasDscal", {"hipblasDscal", "rocblas_dscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasCscal", {"hipblasCscal", "rocblas_cscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasCsscal", {"hipblasCsscal", "rocblas_csscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasZscal", {"hipblasZscal", "rocblas_zscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdscal", {"hipblasZdscal", "rocblas_zdscal", CONV_LIB_FUNC, API_BLAS}},
// AXPY
{"cublasSaxpy", {"hipblasSaxpy", "rocblas_saxpy", CONV_LIB_FUNC, API_BLAS}},
{"cublasDaxpy", {"hipblasDaxpy", "rocblas_daxpy", CONV_LIB_FUNC, API_BLAS}},
{"cublasCaxpy", {"hipblasCaxpy", "rocblas_caxpy", CONV_LIB_FUNC, API_BLAS}},
{"cublasZaxpy", {"hipblasZaxpy", "rocblas_zaxpy", CONV_LIB_FUNC, API_BLAS}},
// COPY
{"cublasScopy", {"hipblasScopy", "rocblas_scopy", CONV_LIB_FUNC, API_BLAS}},
{"cublasDcopy", {"hipblasDcopy", "rocblas_dcopy", CONV_LIB_FUNC, API_BLAS}},
{"cublasCcopy", {"hipblasCcopy", "rocblas_ccopy", CONV_LIB_FUNC, API_BLAS}},
{"cublasZcopy", {"hipblasZcopy", "rocblas_zcopy", CONV_LIB_FUNC, API_BLAS}},
// SWAP
{"cublasSswap", {"hipblasSswap", "rocblas_sswap", CONV_LIB_FUNC, API_BLAS}},
{"cublasDswap", {"hipblasDswap", "rocblas_dswap", CONV_LIB_FUNC, API_BLAS}},
{"cublasCswap", {"hipblasCswap", "rocblas_cswap", CONV_LIB_FUNC, API_BLAS}},
{"cublasZswap", {"hipblasZswap", "rocblas_zswap", CONV_LIB_FUNC, API_BLAS}},
// AMAX
{"cublasIsamax", {"hipblasIsamax", "rocblas_isamax", CONV_LIB_FUNC, API_BLAS}},
{"cublasIdamax", {"hipblasIdamax", "rocblas_idamax", CONV_LIB_FUNC, API_BLAS}},
{"cublasIcamax", {"hipblasIcamax", "rocblas_icamax", CONV_LIB_FUNC, API_BLAS}},
{"cublasIzamax", {"hipblasIzamax", "rocblas_izamax", CONV_LIB_FUNC, API_BLAS}},
// AMIN
{"cublasIsamin", {"hipblasIsamin", "rocblas_isamin", CONV_LIB_FUNC, API_BLAS}},
{"cublasIdamin", {"hipblasIdamin", "rocblas_idamin", CONV_LIB_FUNC, API_BLAS}},
{"cublasIcamin", {"hipblasIcamin", "rocblas_icamin", CONV_LIB_FUNC, API_BLAS}},
{"cublasIzamin", {"hipblasIzamin", "rocblas_izamin", CONV_LIB_FUNC, API_BLAS}},
// ASUM
{"cublasSasum", {"hipblasSasum", "rocblas_sasum", CONV_LIB_FUNC, API_BLAS}},
{"cublasDasum", {"hipblasDasum", "rocblas_dasum", CONV_LIB_FUNC, API_BLAS}},
{"cublasScasum", {"hipblasScasum", "rocblas_scasum", CONV_LIB_FUNC, API_BLAS}},
{"cublasDzasum", {"hipblasDzasum", "rocblas_dzasum", CONV_LIB_FUNC, API_BLAS}},
// ROT
{"cublasSrot", {"hipblasSrot", "rocblas_srot", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrot", {"hipblasDrot", "rocblas_drot", CONV_LIB_FUNC, API_BLAS}},
{"cublasCrot", {"hipblasCrot", "rocblas_crot", CONV_LIB_FUNC, API_BLAS}},
{"cublasCsrot", {"hipblasCsrot", "rocblas_csrot", CONV_LIB_FUNC, API_BLAS}},
{"cublasZrot", {"hipblasZrot", "rocblas_zrot", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdrot", {"hipblasZdrot", "rocblas_zdrot", CONV_LIB_FUNC, API_BLAS}},
// ROTG
{"cublasSrotg", {"hipblasSrotg", "rocblas_srotg", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrotg", {"hipblasDrotg", "rocblas_drotg", CONV_LIB_FUNC, API_BLAS}},
{"cublasCrotg", {"hipblasCrotg", "rocblas_crotg", CONV_LIB_FUNC, API_BLAS}},
{"cublasZrotg", {"hipblasZrotg", "rocblas_zrotg", CONV_LIB_FUNC, API_BLAS}},
// ROTM
{"cublasSrotm", {"hipblasSrotm", "rocblas_srotm", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrotm", {"hipblasDrotm", "rocblas_drotm", CONV_LIB_FUNC, API_BLAS}},
// ROTMG
{"cublasSrotmg", {"hipblasSrotmg", "rocblas_srotmg", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrotmg", {"hipblasDrotmg", "rocblas_drotmg", CONV_LIB_FUNC, API_BLAS}},
// GEMV
{"cublasSgemv", {"hipblasSgemv", "rocblas_sgemv", CONV_LIB_FUNC, API_BLAS}},
// NOTE: there is no such a function in CUDA
{"cublasSgemvBatched", {"hipblasSgemvBatched", "rocblas_sgemv_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgemv", {"hipblasDgemv", "rocblas_dgemv", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemv", {"hipblasCgemv", "rocblas_cgemv", CONV_LIB_FUNC, API_BLAS}},
{"cublasZgemv", {"hipblasZgemv", "rocblas_zgemv", CONV_LIB_FUNC, API_BLAS}},
// GBMV
{"cublasSgbmv", {"hipblasSgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgbmv", {"hipblasDgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgbmv", {"hipblasCgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgbmv", {"hipblasZgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRMV
{"cublasStrmv", {"hipblasStrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtrmv", {"hipblasDtrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtrmv", {"hipblasCtrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrmv", {"hipblasZtrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TBMV
{"cublasStbmv", {"hipblasStbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtbmv", {"hipblasDtbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtbmv", {"hipblasCtbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtbmv", {"hipblasZtbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TPMV
{"cublasStpmv", {"hipblasStpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtpmv", {"hipblasDtpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtpmv", {"hipblasCtpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtpmv", {"hipblasZtpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRSV
{"cublasStrsv", {"hipblasStrsv", "rocblas_strsv", CONV_LIB_FUNC, API_BLAS}},
{"cublasDtrsv", {"hipblasDtrsv", "rocblas_dtrsv", CONV_LIB_FUNC, API_BLAS}},
{"cublasCtrsv", {"hipblasCtrsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrsv", {"hipblasZtrsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TPSV
{"cublasStpsv", {"hipblasStpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtpsv", {"hipblasDtpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtpsv", {"hipblasCtpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtpsv", {"hipblasZtpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TBSV
{"cublasStbsv", {"hipblasStbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtbsv", {"hipblasDtbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtbsv", {"hipblasCtbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtbsv", {"hipblasZtbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYMV/HEMV
{"cublasSsymv", {"hipblasSsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsymv", {"hipblasDsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsymv", {"hipblasCsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsymv", {"hipblasZsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChemv", {"hipblasChemv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhemv", {"hipblasZhemv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SBMV/HBMV
{"cublasSsbmv", {"hipblasSsbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsbmv", {"hpiblasDsbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChbmv", {"hipblasChbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhbmv", {"hipblasZhbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SPMV/HPMV
{"cublasSspmv", {"hipblasSspmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDspmv", {"hipblasDspmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChpmv", {"hipblasChpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhpmv", {"hipblasZhpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// GER
{"cublasSger", {"hipblasSger", "rocblas_sger", CONV_LIB_FUNC, API_BLAS}},
{"cublasDger", {"hipblasDger", "rocblas_dger", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgeru", {"hipblasCgeru", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgerc", {"hipblasCgerc", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgeru", {"hipblasZgeru", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgerc", {"hipblasZgerc", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYR/HER
{"cublasSsyr", {"hipblasSsyr", "rocblas_ssyr", CONV_LIB_FUNC, API_BLAS}},
{"cublasDsyr", {"hipblasDsyr", "rocblas_dsyr", CONV_LIB_FUNC, API_BLAS}},
{"cublasCsyr", {"hipblasCsyr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyr", {"hipblasZsyr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCher", {"hipblasCher", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZher", {"hipblasZher", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SPR/HPR
{"cublasSspr", {"hipblasSspr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDspr", {"hipblasDspr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChpr", {"hipblasChpr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhpr", {"hipblasZhpr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYR2/HER2
{"cublasSsyr2", {"hipblasSsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyr2", {"hipblasDsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyr2", {"hipblasCsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyr2", {"hipblasZsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCher2", {"hipblasCher2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZher2", {"hipblasZher2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SPR2/HPR2
{"cublasSspr2", {"hipblasSspr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDspr2", {"hipblasDspr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChpr2", {"hipblasChpr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhpr2", {"hipblasZhpr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Blas3 (v1) Routines
// GEMM
{"cublasSgemm", {"hipblasSgemm", "rocblas_sgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgemm", {"hipblasDgemm", "rocblas_dgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemm", {"hipblasCgemm", "rocblas_cgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasZgemm", {"hipblasZgemm", "rocblas_zgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasHgemm", {"hipblasHgemm", "rocblas_hgemm", CONV_LIB_FUNC, API_BLAS}},
// BATCH GEMM
{"cublasSgemmBatched", {"hipblasSgemmBatched", "rocblas_sgemm_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgemmBatched", {"hipblasDgemmBatched", "rocblas_dgemm_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasHgemmBatched", {"hipblasHgemmBatched", "rocblas_hgemm_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasSgemmStridedBatched", {"hipblasSgemmStridedBatched", "rocblas_sgemm_strided_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgemmStridedBatched", {"hipblasDgemmStridedBatched", "rocblas_dgemm_strided_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemmBatched", {"hipblasCgemmBatched", "rocblas_cgemm_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemm3mBatched", {"hipblasCgemm3mBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgemmBatched", {"hipblasZgemmBatched", "rocblas_zgemm_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemmStridedBatched", {"hipblasCgemmStridedBatched", "rocblas_cgemm_strided_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemm3mStridedBatched", {"hipblasCgemm3mStridedBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgemmStridedBatched", {"hipblasZgemmStridedBatched", "rocblas_zgemm_strided_batched", CONV_LIB_FUNC, API_BLAS}},
{"cublasHgemmStridedBatched", {"hipblasHgemmStridedBatched", "rocblas_hgemm_strided_batched", CONV_LIB_FUNC, API_BLAS}},
// SYRK
{"cublasSsyrk", {"hipblasSsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyrk", {"hipblasDsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyrk", {"hipblasCsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyrk", {"hipblasZsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HERK
{"cublasCherk", {"hipblasCherk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZherk", {"hipblasZherk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYR2K
{"cublasSsyr2k", {"hipblasSsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyr2k", {"hipblasDsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyr2k", {"hipblasCsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyr2k", {"hipblasZsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYRKX - eXtended SYRK
{"cublasSsyrkx", {"hipblasSsyrkx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyrkx", {"hipblasDsyrkx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyrkx", {"hipblasCsyrkx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyrkx", {"hipblasZsyrkx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HER2K
{"cublasCher2k", {"hipblasCher2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZher2k", {"hipblasZher2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HERKX - eXtended HERK
{"cublasCherkx", {"hipblasCherkx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZherkx", {"hipblasZherkx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYMM
{"cublasSsymm", {"hipblasSsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsymm", {"hipblasDsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsymm", {"hipblasCsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsymm", {"hipblasZsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HEMM
{"cublasChemm", {"hipblasChemm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhemm", {"hipblasZhemm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRSM
{"cublasStrsm", {"hipblasStrsm", "rocblas_strsm", CONV_LIB_FUNC, API_BLAS}},
{"cublasDtrsm", {"hipblasDtrsm", "rocblas_dtrsm", CONV_LIB_FUNC, API_BLAS}},
{"cublasCtrsm", {"hipblasCtrsm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrsm", {"hipblasZtrsm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRMM
{"cublasStrmm", {"hipblasStrmm", "rocblas_strmm", CONV_LIB_FUNC, API_BLAS, HIP_UNSUPPORTED}},
{"cublasDtrmm", {"hipblasDtrmm", "rocblas_dtrmm", CONV_LIB_FUNC, API_BLAS, HIP_UNSUPPORTED}},
{"cublasCtrmm", {"hipblasCtrmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrmm", {"hipblasZtrmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// ------------------------ CUBLAS BLAS - like extension (cublas_api.h)
// GEAM
{"cublasSgeam", {"hipblasSgeam", "rocblas_sgeam", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgeam", {"hipblasDgeam", "rocblas_dgeam", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgeam", {"hipblasCgeam", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgeam", {"hipblasZgeam", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// GETRF - Batched LU
{"cublasSgetrfBatched", {"hipblasSgetrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgetrfBatched", {"hipblasDgetrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgetrfBatched", {"hipblasCgetrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgetrfBatched", {"hipblasZgetrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Batched inversion based on LU factorization from getrf
{"cublasSgetriBatched", {"hipblasSgetriBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgetriBatched", {"hipblasDgetriBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgetriBatched", {"hipblasCgetriBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgetriBatched", {"hipblasZgetriBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Batched solver based on LU factorization from getrf
{"cublasSgetrsBatched", {"hipblasSgetrsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgetrsBatched", {"hipblasDgetrsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgetrsBatched", {"hipblasCgetrsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgetrsBatched", {"hipblasZgetrsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRSM - Batched Triangular Solver
{"cublasStrsmBatched", {"hipblasStrsmBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtrsmBatched", {"hipblasDtrsmBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtrsmBatched", {"hipblasCtrsmBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrsmBatched", {"hipblasZtrsmBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// MATINV - Batched
{"cublasSmatinvBatched", {"hipblasSmatinvBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDmatinvBatched", {"hipblasDmatinvBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCmatinvBatched", {"hipblasCmatinvBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZmatinvBatched", {"hipblasZmatinvBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Batch QR Factorization
{"cublasSgeqrfBatched", {"hipblasSgeqrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgeqrfBatched", {"hipblasDgeqrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgeqrfBatched", {"hipblasCgeqrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgeqrfBatched", {"hipblasZgeqrfBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Least Square Min only m >= n and Non-transpose supported
{"cublasSgelsBatched", {"hipblasSgelsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgelsBatched", {"hipblasDgelsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgelsBatched", {"hipblasCgelsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgelsBatched", {"hipblasZgelsBatched", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// DGMM
{"cublasSdgmm", {"hipblasSdgmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDdgmm", {"hipblasDdgmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCdgmm", {"hipblasCdgmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZdgmm", {"hipblasZdgmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TPTTR - Triangular Pack format to Triangular format
{"cublasStpttr", {"hipblasStpttr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtpttr", {"hipblasDtpttr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtpttr", {"hipblasCtpttr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtpttr", {"hipblasZtpttr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRTTP - Triangular format to Triangular Pack format
{"cublasStrttp", {"hipblasStrttp", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtrttp", {"hipblasDtrttp", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtrttp", {"hipblasCtrttp", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrttp", {"hipblasZtrttp", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Blas2 (v2) Routines
{"cublasCreate_v2", {"hipblasCreate", "rocblas_create_handle", CONV_LIB_FUNC, API_BLAS}},
{"cublasDestroy_v2", {"hipblasDestroy", "rocblas_destroy_handle", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetVersion_v2", {"hipblasGetVersion", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGetProperty", {"hipblasGetProperty", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSetStream_v2", {"hipblasSetStream", "rocblas_set_stream", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetStream_v2", {"hipblasGetStream", "rocblas_get_stream", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetPointerMode_v2", {"hipblasGetPointerMode", "rocblas_set_pointer_mode", CONV_LIB_FUNC, API_BLAS}},
{"cublasSetPointerMode_v2", {"hipblasSetPointerMode", "rocblas_get_pointer_mode", CONV_LIB_FUNC, API_BLAS}},
{"cublasGetCudartVersion", {"hipblasGetCudartVersion", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// GEMV
{"cublasSgemv_v2", {"hipblasSgemv", "rocblas_sgemv", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgemv_v2", {"hipblasDgemv", "rocblas_dgemv", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemv_v2", {"hipblasCgemv", "rocblas_cgemv", CONV_LIB_FUNC, API_BLAS}},
{"cublasZgemv_v2", {"hipblasZgemv", "rocblas_zgemv", CONV_LIB_FUNC, API_BLAS}},
// GBMV
{"cublasSgbmv_v2", {"hipblasSgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDgbmv_v2", {"hipblasDgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgbmv_v2", {"hipblasCgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgbmv_v2", {"hipblasZgbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRMV
{"cublasStrmv_v2", {"hipblasStrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtrmv_v2", {"hipblasDtrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtrmv_v2", {"hipblasCtrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrmv_v2", {"hipblasZtrmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TBMV
{"cublasStbmv_v2", {"hipblasStbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtbmv_v2", {"hipblasDtbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtbmv_v2", {"hipblasCtbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtbmv_v2", {"hipblasZtbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TPMV
{"cublasStpmv_v2", {"hipblasStpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtpmv_v2", {"hipblasDtpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtpmv_v2", {"hipblasCtpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtpmv_v2", {"hipblasZtpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRSV
{"cublasStrsv_v2", {"hipblasStrsv", "rocblas_strsv", CONV_LIB_FUNC, API_BLAS}},
{"cublasDtrsv_v2", {"hipblasDtrsv", "rocblas_dtrsv", CONV_LIB_FUNC, API_BLAS}},
{"cublasCtrsv_v2", {"hipblasCtrsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrsv_v2", {"hipblasZtrsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TPSV
{"cublasStpsv_v2", {"hipblasStpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtpsv_v2", {"hipblasDtpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtpsv_v2", {"hipblasCtpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtpsv_v2", {"hipblasZtpsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TBSV
{"cublasStbsv_v2", {"hipblasStbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDtbsv_v2", {"hipblasDtbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCtbsv_v2", {"hipblasCtbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtbsv_v2", {"hipblasZtbsv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYMV/HEMV
{"cublasSsymv_v2", {"hipblasSsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsymv_v2", {"hipblasDsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsymv_v2", {"hipblasCsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsymv_v2", {"hipblasZsymv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChemv_v2", {"hipblasChemv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhemv_v2", {"hipblasZhemv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SBMV/HBMV
{"cublasSsbmv_v2", {"hipblasSsbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsbmv_v2", {"hpiblasDsbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChbmv_v2", {"hipblasChbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhbmv_v2", {"hipblasZhbmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SPMV/HPMV
{"cublasSspmv_v2", {"hipblasSspmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDspmv_v2", {"hipblasDspmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChpmv_v2", {"hipblasChpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhpmv_v2", {"hipblasZhpmv", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// GER
{"cublasSger_v2", {"hipblasSger", "rocblas_sger", CONV_LIB_FUNC, API_BLAS}},
{"cublasDger_v2", {"hipblasDger", "rocblas_dger", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgeru_v2", {"hipblasCgeru", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgerc_v2", {"hipblasCgerc", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgeru_v2", {"hipblasZgeru", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgerc_v2", {"hipblasZgerc", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYR/HER
{"cublasSsyr_v2", {"hipblasSsyr", "rocblas_ssyr", CONV_LIB_FUNC, API_BLAS}},
{"cublasDsyr_v2", {"hipblasDsyr", "rocblas_dsyr", CONV_LIB_FUNC, API_BLAS}},
{"cublasCsyr_v2", {"hipblasCsyr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyr_v2", {"hipblasZsyr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCher_v2", {"hipblasCher", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZher_v2", {"hipblasZher", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SPR/HPR
{"cublasSspr_v2", {"hipblasSspr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDspr_v2", {"hipblasDspr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChpr_v2", {"hipblasChpr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhpr_v2", {"hipblasZhpr", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYR2/HER2
{"cublasSsyr2_v2", {"hipblasSsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyr2_v2", {"hipblasDsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyr2_v2", {"hipblasCsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyr2_v2", {"hipblasZsyr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCher2_v2", {"hipblasCher2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZher2_v2", {"hipblasZher2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SPR2/HPR2
{"cublasSspr2_v2", {"hipblasSspr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDspr2_v2", {"hipblasDspr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasChpr2_v2", {"hipblasChpr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhpr2_v2", {"hipblasZhpr2", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// Blas3 (v2) Routines
// GEMM
{"cublasSgemm_v2", {"hipblasSgemm", "rocblas_sgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasDgemm_v2", {"hipblasDgemm", "rocblas_dgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasCgemm_v2", {"hipblasCgemm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgemm3m", {"hipblasCgemm3m", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCgemm3mEx", {"hipblasCgemm3mEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZgemm_v2", {"hipblasZgemm", "rocblas_zgemm", CONV_LIB_FUNC, API_BLAS}},
{"cublasZgemm3m", {"hipblasZgemm3m", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
//IO in FP16 / FP32, computation in float
{"cublasSgemmEx", {"hipblasSgemmEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGemmEx", {"hipblasGemmEx", "rocblas_gemm_ex", CONV_LIB_FUNC, API_BLAS}},
{"cublasGemmBatchedEx", {"hipblasGemmBatchedEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasGemmStridedBatchedEx", {"hipblasGemmStridedBatchedEx", "rocblas_gemm_strided_batched_ex", CONV_LIB_FUNC, API_BLAS, HIP_UNSUPPORTED}},
// IO in Int8 complex/cuComplex, computation in cuComplex
{"cublasCgemmEx", {"hipblasCgemmEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasUint8gemmBias", {"hipblasUint8gemmBias", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYRK
{"cublasSsyrk_v2", {"hipblasSsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyrk_v2", {"hipblasDsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyrk_v2", {"hipblasCsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyrk_v2", {"hipblasZsyrk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// IO in Int8 complex/cuComplex, computation in cuComplex
{"cublasCsyrkEx", {"hipblasCsyrkEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// IO in Int8 complex/cuComplex, computation in cuComplex, Gaussian math
{"cublasCsyrk3mEx", {"hipblasCsyrk3mEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HERK
{"cublasCherk_v2", {"hipblasCherk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// IO in Int8 complex/cuComplex, computation in cuComplex
{"cublasCherkEx", {"hipblasCherkEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// IO in Int8 complex/cuComplex, computation in cuComplex, Gaussian math
{"cublasCherk3mEx", {"hipblasCherk3mEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZherk_v2", {"hipblasZherk", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYR2K
{"cublasSsyr2k_v2", {"hipblasSsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsyr2k_v2", {"hipblasDsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsyr2k_v2", {"hipblasCsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsyr2k_v2", {"hipblasZsyr2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HER2K
{"cublasCher2k_v2", {"hipblasCher2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZher2k_v2", {"hipblasZher2k", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// SYMM
{"cublasSsymm_v2", {"hipblasSsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDsymm_v2", {"hipblasDsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasCsymm_v2", {"hipblasCsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZsymm_v2", {"hipblasZsymm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// HEMM
{"cublasChemm_v2", {"hipblasChemm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZhemm_v2", {"hipblasZhemm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRSM
{"cublasStrsm_v2", {"hipblasStrsm", "rocblas_strsm", CONV_LIB_FUNC, API_BLAS}},
{"cublasDtrsm_v2", {"hipblasDtrsm", "rocblas_dtrsm", CONV_LIB_FUNC, API_BLAS}},
{"cublasCtrsm_v2", {"hipblasCtrsm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrsm_v2", {"hipblasZtrsm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// TRMM
{"cublasStrmm_v2", {"hipblasStrmm", "rocblas_strmm", CONV_LIB_FUNC, API_BLAS, HIP_UNSUPPORTED}},
{"cublasDtrmm_v2", {"hipblasDtrmm", "rocblas_dtrmm", CONV_LIB_FUNC, API_BLAS, HIP_UNSUPPORTED}},
{"cublasCtrmm_v2", {"hipblasCtrmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasZtrmm_v2", {"hipblasZtrmm", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
// NRM2
{"cublasSnrm2_v2", {"hipblasSnrm2", "rocblas_snrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasDnrm2_v2", {"hipblasDnrm2", "rocblas_dnrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasScnrm2_v2", {"hipblasScnrm2", "rocblas_scnrm2", CONV_LIB_FUNC, API_BLAS}},
{"cublasDznrm2_v2", {"hipblasDznrm2", "rocblas_dznrm2", CONV_LIB_FUNC, API_BLAS}},
// DOT
{"cublasDotEx", {"hipblasDotEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasDotcEx", {"hipblasDotcEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSdot_v2", {"hipblasSdot", "rocblas_sdot", CONV_LIB_FUNC, API_BLAS}},
{"cublasDdot_v2", {"hipblasDdot", "rocblas_ddot", CONV_LIB_FUNC, API_BLAS}},
{"cublasCdotu_v2", {"hipblasCdotu", "rocblas_cdotu", CONV_LIB_FUNC, API_BLAS}},
{"cublasCdotc_v2", {"hipblasCdotc", "rocblas_cdotc", CONV_LIB_FUNC, API_BLAS,}},
{"cublasZdotu_v2", {"hipblasZdotu", "rocblas_zdotu", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdotc_v2", {"hipblasZdotc", "rocblas_zdotc", CONV_LIB_FUNC, API_BLAS}},
// SCAL
{"cublasScalEx", {"hipblasScalEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSscal_v2", {"hipblasSscal", "rocblas_sscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasDscal_v2", {"hipblasDscal", "rocblas_dscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasCscal_v2", {"hipblasCscal", "rocblas_cscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasCsscal_v2", {"hipblasCsscal", "rocblas_csscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasZscal_v2", {"hipblasZscal", "rocblas_zscal", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdscal_v2", {"hipblasZdscal", "rocblas_zdscal", CONV_LIB_FUNC, API_BLAS}},
// AXPY
{"cublasAxpyEx", {"hipblasAxpyEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSaxpy_v2", {"hipblasSaxpy", "rocblas_saxpy", CONV_LIB_FUNC, API_BLAS}},
{"cublasDaxpy_v2", {"hipblasDaxpy", "rocblas_daxpy", CONV_LIB_FUNC, API_BLAS}},
{"cublasCaxpy_v2", {"hipblasCaxpy", "rocblas_caxpy", CONV_LIB_FUNC, API_BLAS}},
{"cublasZaxpy_v2", {"hipblasZaxpy", "rocblas_zaxpy", CONV_LIB_FUNC, API_BLAS}},
// COPY
{"cublasCopyEx", {"hipblasCopyEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasScopy_v2", {"hipblasScopy", "rocblas_scopy", CONV_LIB_FUNC, API_BLAS}},
{"cublasDcopy_v2", {"hipblasDcopy", "rocblas_dcopy", CONV_LIB_FUNC, API_BLAS}},
{"cublasCcopy_v2", {"hipblasCcopy", "rocblas_ccopy", CONV_LIB_FUNC, API_BLAS}},
{"cublasZcopy_v2", {"hipblasZcopy", "rocblas_zcopy", CONV_LIB_FUNC, API_BLAS}},
// SWAP
{"cublasSwapEx", {"hipblasSwapEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSswap_v2", {"hipblasSswap", "rocblas_sswap", CONV_LIB_FUNC, API_BLAS}},
{"cublasDswap_v2", {"hipblasDswap", "rocblas_dswap", CONV_LIB_FUNC, API_BLAS}},
{"cublasCswap_v2", {"hipblasCswap", "rocblas_cswap", CONV_LIB_FUNC, API_BLAS}},
{"cublasZswap_v2", {"hipblasZswap", "rocblas_zswap", CONV_LIB_FUNC, API_BLAS}},
// AMAX
{"cublasIamaxEx", {"hipblasIamaxEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasIsamax_v2", {"hipblasIsamax", "rocblas_isamax", CONV_LIB_FUNC, API_BLAS}},
{"cublasIdamax_v2", {"hipblasIdamax", "rocblas_idamax", CONV_LIB_FUNC, API_BLAS}},
{"cublasIcamax_v2", {"hipblasIcamax", "rocblas_icamax", CONV_LIB_FUNC, API_BLAS}},
{"cublasIzamax_v2", {"hipblasIzamax", "rocblas_izamax", CONV_LIB_FUNC, API_BLAS}},
// AMIN
{"cublasIaminEx", {"hipblasIaminEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasIsamin_v2", {"hipblasIsamin", "rocblas_isamin", CONV_LIB_FUNC, API_BLAS}},
{"cublasIdamin_v2", {"hipblasIdamin", "rocblas_idamin", CONV_LIB_FUNC, API_BLAS}},
{"cublasIcamin_v2", {"hipblasIcamin", "rocblas_icamin", CONV_LIB_FUNC, API_BLAS}},
{"cublasIzamin_v2", {"hipblasIzamin", "rocblas_izamin", CONV_LIB_FUNC, API_BLAS}},
// ASUM
{"cublasAsumEx", {"hipblasAsumEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSasum_v2", {"hipblasSasum", "rocblas_sasum", CONV_LIB_FUNC, API_BLAS}},
{"cublasDasum_v2", {"hipblasDasum", "rocblas_dasum", CONV_LIB_FUNC, API_BLAS}},
{"cublasScasum_v2", {"hipblasScasum", "rocblas_scasum", CONV_LIB_FUNC, API_BLAS}},
{"cublasDzasum_v2", {"hipblasDzasum", "rocblas_dzasum", CONV_LIB_FUNC, API_BLAS}},
// ROT
{"cublasRotEx", {"hipblasRotEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSrot_v2", {"hipblasSrot", "rocblas_srot", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrot_v2", {"hipblasDrot", "rocblas_drot", CONV_LIB_FUNC, API_BLAS}},
{"cublasCrot_v2", {"hipblasCrot", "rocblas_crot", CONV_LIB_FUNC, API_BLAS}},
{"cublasCsrot_v2", {"hipblasCsrot", "rocblas_csrot", CONV_LIB_FUNC, API_BLAS}},
{"cublasZrot_v2", {"hipblasZrot", "rocblas_zrot", CONV_LIB_FUNC, API_BLAS}},
{"cublasZdrot_v2", {"hipblasZdrot", "rocblas_zdrot", CONV_LIB_FUNC, API_BLAS}},
// ROTG
{"cublasRotgEx", {"hipblasRotgEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSrotg_v2", {"hipblasSrotg", "rocblas_srotg", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrotg_v2", {"hipblasDrotg", "rocblas_drotg", CONV_LIB_FUNC, API_BLAS}},
{"cublasCrotg_v2", {"hipblasCrotg", "rocblas_crotg", CONV_LIB_FUNC, API_BLAS}},
{"cublasZrotg_v2", {"hipblasZrotg", "rocblas_zrotg", CONV_LIB_FUNC, API_BLAS}},
// ROTM
{"cublasRotmEx", {"hipblasRotmEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSrotm_v2", {"hipblasSrotm", "rocblas_srotm", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrotm_v2", {"hipblasDrotm", "rocblas_drotm", CONV_LIB_FUNC, API_BLAS}},
// ROTMG
{"cublasRotmgEx", {"hipblasRotmgEx", "", CONV_LIB_FUNC, API_BLAS, UNSUPPORTED}},
{"cublasSrotmg_v2", {"hipblasSrotmg", "rocblas_srotmg", CONV_LIB_FUNC, API_BLAS}},
{"cublasDrotmg_v2", {"hipblasDrotmg", "rocblas_drotmg", CONV_LIB_FUNC, API_BLAS}},
};
@@ -1,158 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_BLAS_TYPE_NAME_MAP{
// Blas defines
{"CUBLAS_VER_MAJOR", {"HIPBLAS_VER_MAJOR", "", CONV_DEFINE, API_BLAS, HIP_UNSUPPORTED}},
{"CUBLAS_VER_MINOR", {"HIPBLAS_VER_MINOR", "", CONV_DEFINE, API_BLAS, HIP_UNSUPPORTED}},
{"CUBLAS_VER_PATCH", {"HIPBLAS_VER_PATCH", "", CONV_DEFINE, API_BLAS, HIP_UNSUPPORTED}},
{"CUBLAS_VER_BUILD", {"HIPBLAS_VER_BUILD", "", CONV_DEFINE, API_BLAS, HIP_UNSUPPORTED}},
{"CUBLAS_VERSION", {"HIPBLAS_VERSION", "", CONV_DEFINE, API_BLAS, HIP_UNSUPPORTED}},
// Blas operations
{"cublasOperation_t", {"hipblasOperation_t", "rocblas_operation", CONV_TYPE, API_BLAS}},
{"CUBLAS_OP_N", {"HIPBLAS_OP_N", "rocblas_operation_none", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_OP_T", {"HIPBLAS_OP_T", "rocblas_operation_transpose", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_OP_C", {"HIPBLAS_OP_C", "rocblas_operation_conjugate_transpose", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_OP_HERMITAN", {"HIPBLAS_OP_C", "rocblas_operation_conjugate_transpose", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_OP_CONJG", {"HIPBLAS_OP_CONJG", "rocblas_operation_conjugate", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}},
// Blas statuses
{"cublasStatus", {"hipblasStatus_t", "rocblas_status", CONV_TYPE, API_BLAS}},
{"cublasStatus_t", {"hipblasStatus_t", "rocblas_status", CONV_TYPE, API_BLAS}},
{"CUBLAS_STATUS_SUCCESS", {"HIPBLAS_STATUS_SUCCESS", "rocblas_status_success", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_NOT_INITIALIZED", {"HIPBLAS_STATUS_NOT_INITIALIZED", "rocblas_status_invalid_handle", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_ALLOC_FAILED", {"HIPBLAS_STATUS_ALLOC_FAILED", "rocblas_status_memory_error", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_INVALID_VALUE", {"HIPBLAS_STATUS_INVALID_VALUE", "rocblas_status_invalid_pointer", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_MAPPING_ERROR", {"HIPBLAS_STATUS_MAPPING_ERROR", "rocblas_status_internal_error", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_EXECUTION_FAILED", {"HIPBLAS_STATUS_EXECUTION_FAILED", "rocblas_status_internal_error", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_INTERNAL_ERROR", {"HIPBLAS_STATUS_INTERNAL_ERROR", "rocblas_status_internal_error", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_NOT_SUPPORTED", {"HIPBLAS_STATUS_NOT_SUPPORTED", "rocblas_status_not_implemented", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_ARCH_MISMATCH", {"HIPBLAS_STATUS_ARCH_MISMATCH", "rocblas_status_not_implemented", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_STATUS_LICENSE_ERROR", {"HIPBLAS_STATUS_LICENSE_ERROR", "rocblas_status_not_implemented", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}},
// Blas Fill Modes
{"cublasFillMode_t", {"hipblasFillMode_t", "rocblas_fill", CONV_TYPE, API_BLAS}},
{"CUBLAS_FILL_MODE_LOWER", {"HIPBLAS_FILL_MODE_LOWER", "rocblas_fill_lower", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_FILL_MODE_UPPER", {"HIPBLAS_FILL_MODE_UPPER", "rocblas_fill_upper", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_FILL_MODE_FULL", {"HIPBLAS_FILL_MODE_FULL", "rocblas_fill_full", CONV_NUMERIC_LITERAL, API_BLAS}},
// Blas Diag Types
{"cublasDiagType_t", {"hipblasDiagType_t", "rocblas_diagonal", CONV_TYPE, API_BLAS}},
{"CUBLAS_DIAG_NON_UNIT", {"HIPBLAS_DIAG_NON_UNIT", "rocblas_diagonal_non_unit", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_DIAG_UNIT", {"HIPBLAS_DIAG_UNIT", "rocblas_diagonal_unit", CONV_NUMERIC_LITERAL, API_BLAS}},
// Blas Side Modes
{"cublasSideMode_t", {"hipblasSideMode_t", "rocblas_side", CONV_TYPE, API_BLAS}},
{"CUBLAS_SIDE_LEFT", {"HIPBLAS_SIDE_LEFT", "rocblas_side_left", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_SIDE_RIGHT", {"HIPBLAS_SIDE_RIGHT", "rocblas_side_right", CONV_NUMERIC_LITERAL, API_BLAS}},
// Blas Pointer Modes
{"cublasPointerMode_t", {"hipblasPointerMode_t", "rocblas_pointer_mode", CONV_TYPE, API_BLAS}},
{"CUBLAS_POINTER_MODE_HOST", {"HIPBLAS_POINTER_MODE_HOST", "rocblas_pointer_mode_host", CONV_NUMERIC_LITERAL, API_BLAS}},
{"CUBLAS_POINTER_MODE_DEVICE", {"HIPBLAS_POINTER_MODE_DEVICE", "rocblas_pointer_mode_device", CONV_NUMERIC_LITERAL, API_BLAS}},
// Blas Atomics Modes
{"cublasAtomicsMode_t", {"hipblasAtomicsMode_t", "rocblas_atomics_mode", CONV_TYPE, API_BLAS, HIP_UNSUPPORTED}},
{"CUBLAS_ATOMICS_NOT_ALLOWED", {"HIPBLAS_ATOMICS_NOT_ALLOWED", "rocblas_atomics_not_allowed", CONV_NUMERIC_LITERAL, API_BLAS, HIP_UNSUPPORTED}},
{"CUBLAS_ATOMICS_ALLOWED", {"HIPBLAS_ATOMICS_ALLOWED", "rocblas_atomics_allowed", CONV_NUMERIC_LITERAL, API_BLAS, HIP_UNSUPPORTED}},
// Blas Data Type
{"cublasDataType_t", {"hipblasDatatype_t", "rocblas_datatype", CONV_TYPE, API_BLAS}},
// Blas Math mode/tensor operation
{"cublasMath_t", {"hipblasMath_t", "", CONV_TYPE, API_BLAS, UNSUPPORTED}},
{"CUBLAS_DEFAULT_MATH", {"HIPBLAS_DEFAULT_MATH", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}},
{"CUBLAS_TENSOR_OP_MATH", {"HIPBLAS_TENSOR_OP_MATH", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}},
// Blass different GEMM algorithms
{"cublasGemmAlgo_t", {"hipblasGemmAlgo_t", "rocblas_gemm_algo", CONV_TYPE, API_BLAS}},
{"CUBLAS_GEMM_DFALT", {"HIPBLAS_GEMM_DEFAULT", "rocblas_gemm_algo_standard", CONV_NUMERIC_LITERAL, API_BLAS}}, // -1 // 160 // 0b0000000000
{"CUBLAS_GEMM_DEFAULT", {"HIPBLAS_GEMM_DEFAULT", "rocblas_gemm_algo_standard", CONV_NUMERIC_LITERAL, API_BLAS}}, // -1 // 160 // 0b0000000000
{"CUBLAS_GEMM_ALGO0", {"HIPBLAS_GEMM_ALGO0", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 0
{"CUBLAS_GEMM_ALGO1", {"HIPBLAS_GEMM_ALGO1", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 1
{"CUBLAS_GEMM_ALGO2", {"HIPBLAS_GEMM_ALGO2", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 2
{"CUBLAS_GEMM_ALGO3", {"HIPBLAS_GEMM_ALGO3", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 3
{"CUBLAS_GEMM_ALGO4", {"HIPBLAS_GEMM_ALGO4", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 4
{"CUBLAS_GEMM_ALGO5", {"HIPBLAS_GEMM_ALGO5", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 5
{"CUBLAS_GEMM_ALGO6", {"HIPBLAS_GEMM_ALGO6", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 6
{"CUBLAS_GEMM_ALGO7", {"HIPBLAS_GEMM_ALGO7", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 7
{"CUBLAS_GEMM_ALGO8", {"HIPBLAS_GEMM_ALGO8", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 8
{"CUBLAS_GEMM_ALGO9", {"HIPBLAS_GEMM_ALGO9", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 9
{"CUBLAS_GEMM_ALGO10", {"HIPBLAS_GEMM_ALGO10", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 10
{"CUBLAS_GEMM_ALGO11", {"HIPBLAS_GEMM_ALGO11", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 11
{"CUBLAS_GEMM_ALGO12", {"HIPBLAS_GEMM_ALGO12", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 12
{"CUBLAS_GEMM_ALGO13", {"HIPBLAS_GEMM_ALGO13", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 13
{"CUBLAS_GEMM_ALGO14", {"HIPBLAS_GEMM_ALGO14", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 14
{"CUBLAS_GEMM_ALGO15", {"HIPBLAS_GEMM_ALGO15", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 15
{"CUBLAS_GEMM_ALGO16", {"HIPBLAS_GEMM_ALGO16", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 16
{"CUBLAS_GEMM_ALGO17", {"HIPBLAS_GEMM_ALGO17", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 17
{"CUBLAS_GEMM_ALGO18", {"HIPBLAS_GEMM_ALGO18", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 18
{"CUBLAS_GEMM_ALGO19", {"HIPBLAS_GEMM_ALGO19", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 19
{"CUBLAS_GEMM_ALGO20", {"HIPBLAS_GEMM_ALGO20", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 20
{"CUBLAS_GEMM_ALGO21", {"HIPBLAS_GEMM_ALGO21", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 21
{"CUBLAS_GEMM_ALGO22", {"HIPBLAS_GEMM_ALGO22", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 22
{"CUBLAS_GEMM_ALGO23", {"HIPBLAS_GEMM_ALGO23", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 23
{"CUBLAS_GEMM_DEFAULT_TENSOR_OP", {"HIPBLAS_GEMM_DEFAULT_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 99
{"CUBLAS_GEMM_DFALT_TENSOR_OP", {"HIPBLAS_GEMM_DFALT_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 99
{"CUBLAS_GEMM_ALGO0_TENSOR_OP", {"HIPBLAS_GEMM_ALGO0_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 100
{"CUBLAS_GEMM_ALGO1_TENSOR_OP", {"HIPBLAS_GEMM_ALGO1_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 101
{"CUBLAS_GEMM_ALGO2_TENSOR_OP", {"HIPBLAS_GEMM_ALGO2_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 102
{"CUBLAS_GEMM_ALGO3_TENSOR_OP", {"HIPBLAS_GEMM_ALGO3_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 103
{"CUBLAS_GEMM_ALGO4_TENSOR_OP", {"HIPBLAS_GEMM_ALGO4_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 104
{"CUBLAS_GEMM_ALGO5_TENSOR_OP", {"HIPBLAS_GEMM_ALGO5_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 105
{"CUBLAS_GEMM_ALGO6_TENSOR_OP", {"HIPBLAS_GEMM_ALGO6_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 106
{"CUBLAS_GEMM_ALGO7_TENSOR_OP", {"HIPBLAS_GEMM_ALGO7_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 107
{"CUBLAS_GEMM_ALGO8_TENSOR_OP", {"HIPBLAS_GEMM_ALGO8_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 108
{"CUBLAS_GEMM_ALGO9_TENSOR_OP", {"HIPBLAS_GEMM_ALGO9_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 109
{"CUBLAS_GEMM_ALGO10_TENSOR_OP", {"HIPBLAS_GEMM_ALGO10_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 110
{"CUBLAS_GEMM_ALGO11_TENSOR_OP", {"HIPBLAS_GEMM_ALGO11_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 111
{"CUBLAS_GEMM_ALGO12_TENSOR_OP", {"HIPBLAS_GEMM_ALGO12_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 112
{"CUBLAS_GEMM_ALGO13_TENSOR_OP", {"HIPBLAS_GEMM_ALGO13_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 113
{"CUBLAS_GEMM_ALGO14_TENSOR_OP", {"HIPBLAS_GEMM_ALGO14_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 114
{"CUBLAS_GEMM_ALGO15_TENSOR_OP", {"HIPBLAS_GEMM_ALGO15_TENSOR_OP", "", CONV_NUMERIC_LITERAL, API_BLAS, UNSUPPORTED}}, // 115
// TODO: rename hipblasDatatype_t to hipDataType_t and move from hipBLAS to HIP
{"cudaDataType_t", {"hipblasDatatype_t", "rocblas_datatype_", CONV_TYPE, API_RUNTIME}},
{"cudaDataType", {"hipblasDatatype_t", "rocblas_datatype", CONV_TYPE, API_RUNTIME}},
{"CUDA_R_16F", {"HIPBLAS_R_16F", "rocblas_datatype_f16_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 2 // 150
{"CUDA_C_16F", {"HIPBLAS_C_16F", "rocblas_datatype_f16_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 6 // 153
{"CUDA_R_32F", {"HIPBLAS_R_32F", "rocblas_datatype_f32_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 0 // 151
{"CUDA_C_32F", {"HIPBLAS_C_32F", "rocblas_datatype_f32_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 4 // 154
{"CUDA_R_64F", {"HIPBLAS_R_64F", "rocblas_datatype_f64_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 1 // 152
{"CUDA_C_64F", {"HIPBLAS_C_64F", "rocblas_datatype_f64_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 5 // 155
{"CUDA_R_8I", {"HIPBLAS_R_8I", "rocblas_datatype_i8_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 3 // 160
{"CUDA_C_8I", {"HIPBLAS_C_8I", "rocblas_datatype_i8_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 7 // 164
{"CUDA_R_8U", {"HIPBLAS_R_8U", "rocblas_datatype_u8_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 8 // 161
{"CUDA_C_8U", {"HIPBLAS_C_8U", "rocblas_datatype_u8_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 9 // 165
{"CUDA_R_32I", {"HIPBLAS_R_32I", "rocblas_datatype_i32_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 10 // 162
{"CUDA_C_32I", {"HIPBLAS_C_32I", "rocblas_datatype_i32_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 11 // 166
{"CUDA_R_32U", {"HIPBLAS_R_32U", "rocblas_datatype_u32_r", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 12 // 163
{"CUDA_C_32U", {"HIPBLAS_C_32U", "rocblas_datatype_u32_c", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 13 // 167
{"cublasHandle_t", {"hipblasHandle_t", "rocblas_handle", CONV_TYPE, API_BLAS}},
// TODO: dereferencing: typedef struct cublasContext *cublasHandle_t;
{"cublasContext", {"hipblasHandle_t", "_rocblas_handle", CONV_TYPE, API_BLAS, HIP_UNSUPPORTED}},
};
@@ -1,28 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps the names of CUDA SPARSE API functions to the corresponding HIP functions
const std::map<llvm::StringRef, hipCounter> CUDA_CAFFE2_FUNCTION_MAP{
{"cuda_stream", {"hip_stream", "", CONV_LIB_FUNC, API_CAFFE2}},
};
@@ -1,34 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all types
const std::map<llvm::StringRef, hipCounter> CUDA_CAFFE2_TYPE_NAME_MAP{
// 5. Defines
{"REGISTER_CUDA_OPERATOR", {"REGISTER_HIP_OPERATOR", "", CONV_DEFINE, API_CAFFE2}},
{"REGISTER_CUDA_OPERATOR_CREATOR", {"REGISTER_HIP_OPERATOR_CREATOR", "", CONV_DEFINE, API_CAFFE2}},
// 6. Classes
{"CUDAContext", {"HIPContext", "", CONV_TYPE, API_CAFFE2}},
};
@@ -1,28 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps the names of CUDA CUB API types to the corresponding HIP types
const std::map<llvm::StringRef, hipCounter> CUDA_CUB_TYPE_NAME_MAP{
{"cub", {"hipcub", "", CONV_TYPE, API_CUB}},
};
@@ -1,50 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps the names of CUDA Complex API functions to the corresponding HIP functions
const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_FUNCTION_MAP{
{"cuCrealf", {"hipCrealf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCimagf", {"hipCimagf", "", CONV_COMPLEX, API_COMPLEX}},
{"make_cuFloatComplex", {"make_hipFloatComplex", "", CONV_COMPLEX, API_COMPLEX}},
{"cuConjf", {"hipConjf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCaddf", {"hipCaddf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCsubf", {"hipCsubf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCmulf", {"hipCmulf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCdivf", {"hipCdivf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCabsf", {"hipCabsf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCreal", {"hipCreal", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCimag", {"hipCimag", "", CONV_COMPLEX, API_COMPLEX}},
{"make_cuDoubleComplex", {"make_hipDoubleComplex", "", CONV_COMPLEX, API_COMPLEX}},
{"cuConj", {"hipConj", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCadd", {"hipCadd", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCsub", {"hipCsub", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCmul", {"hipCmul", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCdiv", {"hipCdiv", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCabs", {"hipCabs", "", CONV_COMPLEX, API_COMPLEX}},
{"make_cuComplex", {"make_hipComplex", "", CONV_COMPLEX, API_COMPLEX}},
{"cuComplexFloatToDouble", {"hipComplexFloatToDouble", "", CONV_COMPLEX, API_COMPLEX}},
{"cuComplexDoubleToFloat", {"hipComplexDoubleToFloat", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCfmaf", {"hipCfmaf", "", CONV_COMPLEX, API_COMPLEX}},
{"cuCfma", {"hipCfma", "", CONV_COMPLEX, API_COMPLEX}},
};
@@ -1,30 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps the names of CUDA Complex API types to the corresponding HIP types
const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_TYPE_NAME_MAP{
{"cuFloatComplex", {"hipFloatComplex", "", CONV_TYPE, API_COMPLEX}},
{"cuDoubleComplex", {"hipDoubleComplex", "", CONV_TYPE, API_COMPLEX}},
{"cuComplex", {"hipComplex", "", CONV_TYPE, API_COMPLEX}},
};
@@ -1,299 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_DNN_FUNCTION_MAP{
{"cudnnGetVersion", {"hipdnnGetVersion", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetCudartVersion", {"hipdnnGetCudartVersion", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnQueryRuntimeError", {"hipdnnQueryRuntimeError", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetProperty", {"hipdnnGetProperty", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetErrorString", {"hipdnnGetErrorString", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnIm2Col", {"hipdnnIm2Col", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreate", {"hipdnnCreate", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroy", {"hipdnnDestroy", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetStream", {"hipdnnSetStream", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetStream", {"hipdnnGetStream", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetCallback", {"hipdnnSetCallback", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetCallback", {"hipdnnGetCallback", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Tensor functions
{"cudnnCreateTensorDescriptor", {"hipdnnCreateTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetTensor4dDescriptor", {"hipdnnSetTensor4dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetTensor4dDescriptorEx", {"hipdnnSetTensor4dDescriptorEx", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetTensor4dDescriptor", {"hipdnnGetTensor4dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetTensorNdDescriptor", {"hipdnnSetTensorNdDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetTensorNdDescriptorEx", {"hipdnnSetTensorNdDescriptorEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetTensorNdDescriptor", {"hipdnnGetTensorNdDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetTensorSizeInBytes", {"hipdnnGetTensorSizeInBytes", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyTensorDescriptor", {"hipdnnDestroyTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnTransformTensor", {"hipdnnTransformTensor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnTransformTensorEx", {"hipdnnTransformTensorEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnInitTransformDest", {"hipdnnInitTransformDest", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreateTensorTransformDescriptor", {"hipdnnCreateTensorTransformDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetTensorTransformDescriptor", {"hipdnnSetTensorTransformDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetTensorTransformDescriptor", {"hipdnnGetTensorTransformDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyTensorTransformDescriptor", {"hipdnnDestroyTensorTransformDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnAddTensor", {"hipdnnAddTensor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnCreateOpTensorDescriptor", {"hipdnnCreateOpTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetOpTensorDescriptor", {"hipdnnSetOpTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetOpTensorDescriptor", {"hipdnnGetOpTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyOpTensorDescriptor", {"hipdnnDestroyOpTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnOpTensor", {"hipdnnOpTensor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetFoldedConvBackwardDataDescriptors", {"hipdnnGetFoldedConvBackwardDataDescriptors", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Reduce Tensor functions
{"cudnnCreateReduceTensorDescriptor", {"hipdnnCreateReduceTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetReduceTensorDescriptor", {"hipdnnSetReduceTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetReduceTensorDescriptor", {"hipdnnGetReduceTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyReduceTensorDescriptor", {"hipdnnDestroyReduceTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetReductionIndicesSize", {"hipdnnGetReductionIndicesSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetReductionWorkspaceSize", {"hipdnnGetReductionWorkspaceSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnReduceTensor", {"hipdnnReduceTensor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetTensor", {"hipdnnSetTensor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnScaleTensor", {"hipdnnScaleTensor", "", CONV_LIB_FUNC, API_DNN}},
// cuDNN Filter functions
{"cudnnCreateFilterDescriptor", {"hipdnnCreateFilterDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetFilter4dDescriptor", {"hipdnnSetFilter4dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetFilter4dDescriptor", {"hipdnnGetFilter4dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetFilterNdDescriptor", {"hipdnnSetFilterNdDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetFilterNdDescriptor", {"hipdnnGetFilterNdDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetFilterSizeInBytes", {"hipdnnGetFilterSizeInBytes", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnTransformFilter", {"hipdnnTransformFilter", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyFilterDescriptor", {"hipdnnDestroyFilterDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnReorderFilterAndBias", {"hipdnnReorderFilterAndBias", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Convolution functions
{"cudnnCreateConvolutionDescriptor", {"hipdnnCreateConvolutionDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetConvolutionMathType", {"hipdnnSetConvolutionMathType", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionMathType", {"hipdnnGetConvolutionMathType", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetConvolutionGroupCount", {"hipdnnSetConvolutionGroupCount", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionGroupCount", {"hipdnnGetConvolutionGroupCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetConvolutionReorderType", {"hipdnnSetConvolutionReorderType", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionReorderType", {"hipdnnGetConvolutionReorderType", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetConvolution2dDescriptor", {"hipdnnSetConvolution2dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolution2dDescriptor", {"hipdnnGetConvolution2dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolution2dForwardOutputDim", {"hipdnnGetConvolution2dForwardOutputDim", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetConvolutionNdDescriptor", {"hipdnnSetConvolutionNdDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionNdDescriptor", {"hipdnnGetConvolutionNdDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionNdForwardOutputDim", {"hipdnnGetConvolutionNdForwardOutputDim", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyConvolutionDescriptor", {"hipdnnDestroyConvolutionDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionForwardAlgorithmMaxCount", {"hipdnnGetConvolutionForwardAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindConvolutionForwardAlgorithm", {"hipdnnFindConvolutionForwardAlgorithm", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnFindConvolutionForwardAlgorithmEx", {"hipdnnFindConvolutionForwardAlgorithmEx", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionForwardAlgorithm", {"hipdnnGetConvolutionForwardAlgorithm", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionForwardAlgorithm_v7", {"hipdnnGetConvolutionForwardAlgorithm_v7", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionForwardWorkspaceSize", {"hipdnnGetConvolutionForwardWorkspaceSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnConvolutionForward", {"hipdnnConvolutionForward", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnConvolutionBiasActivationForward", {"hipdnnConvolutionBiasActivationForward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnConvolutionBackwardBias", {"hipdnnConvolutionBackwardBias", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionBackwardFilterAlgorithmMaxCount", {"hipdnnGetConvolutionBackwardFilterAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindConvolutionBackwardFilterAlgorithm", {"hipdnnFindConvolutionBackwardFilterAlgorithm", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnFindConvolutionBackwardFilterAlgorithmEx", {"hipdnnFindConvolutionBackwardFilterAlgorithmEx", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionBackwardFilterAlgorithm", {"hipdnnGetConvolutionBackwardFilterAlgorithm", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionBackwardFilterAlgorithm_v7", {"hipdnnGetConvolutionBackwardFilterAlgorithm_v7", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionBackwardFilterWorkspaceSize", {"hipdnnGetConvolutionBackwardFilterWorkspaceSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnConvolutionBackwardFilter", {"hipdnnConvolutionBackwardFilter", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionBackwardDataAlgorithmMaxCount", {"hipdnnGetConvolutionBackwardDataAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindConvolutionBackwardDataAlgorithm", {"hipdnnFindConvolutionBackwardDataAlgorithm", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnFindConvolutionBackwardDataAlgorithmEx", {"hipdnnFindConvolutionBackwardDataAlgorithmEx", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionBackwardDataAlgorithm", {"hipdnnGetConvolutionBackwardDataAlgorithm", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetConvolutionBackwardDataAlgorithm_v7", {"hipdnnGetConvolutionBackwardDataAlgorithm_v7", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionBackwardDataWorkspaceSize", {"hipdnnGetConvolutionBackwardDataWorkspaceSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnConvolutionBackwardData", {"hipdnnConvolutionBackwardData", "", CONV_LIB_FUNC, API_DNN}},
// cuDNN Sortmax functions
{"cudnnSoftmaxForward", {"hipdnnSoftmaxForward", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSoftmaxBackward", {"hipdnnSoftmaxBackward", "", CONV_LIB_FUNC, API_DNN}},
// cuDNN Pooling functions
{"cudnnCreatePoolingDescriptor", {"hipdnnCreatePoolingDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetPooling2dDescriptor", {"hipdnnSetPooling2dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetPooling2dDescriptor", {"hipdnnGetPooling2dDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetPoolingNdDescriptor", {"hipdnnSetPoolingNdDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetPoolingNdDescriptor", {"hipdnnGetPoolingNdDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetPoolingNdForwardOutputDim", {"hipdnnGetPoolingNdForwardOutputDim", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetPooling2dForwardOutputDim", {"hipdnnGetPooling2dForwardOutputDim", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyPoolingDescriptor", {"hipdnnDestroyPoolingDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnPoolingForward", {"hipdnnPoolingForward", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnPoolingBackward", {"hipdnnPoolingBackward", "", CONV_LIB_FUNC, API_DNN}},
// cuDNN Activation functions
{"cudnnCreateActivationDescriptor", {"hipdnnCreateActivationDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetActivationDescriptor", {"hipdnnSetActivationDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetActivationDescriptor", {"hipdnnGetActivationDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyActivationDescriptor", {"hipdnnDestroyActivationDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnActivationForward", {"hipdnnActivationForward", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnActivationBackward", {"hipdnnActivationBackward", "", CONV_LIB_FUNC, API_DNN}},
// cuDNN LRN functions
{"cudnnCreateLRNDescriptor", {"hipdnnCreateLRNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetLRNDescriptor", {"hipdnnSetLRNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetLRNDescriptor", {"hipdnnGetLRNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyLRNDescriptor", {"hipdnnDestroyLRNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnLRNCrossChannelForward", {"hipdnnLRNCrossChannelForward", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnLRNCrossChannelBackward", {"hipdnnLRNCrossChannelBackward", "", CONV_LIB_FUNC, API_DNN}},
// cuDNN Divisive Normalization functions
{"cudnnDivisiveNormalizationForward", {"hipdnnDivisiveNormalizationForward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDivisiveNormalizationBackward", {"hipdnnDivisiveNormalizationBackward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Batch Normalization functions
{"cudnnDeriveBNTensorDescriptor", {"hipdnnDeriveBNTensorDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnBatchNormalizationForwardTraining", {"hipdnnBatchNormalizationForwardTraining", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnBatchNormalizationForwardTrainingEx", {"hipdnnBatchNormalizationForwardTrainingEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnBatchNormalizationForwardInference", {"hipdnnBatchNormalizationForwardInference", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnBatchNormalizationBackward", {"hipdnnBatchNormalizationBackward", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnBatchNormalizationBackwardEx", {"hipdnnBatchNormalizationBackwardEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize", {"hipdnnGetBatchNormalizationForwardTrainingExWorkspaceSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetBatchNormalizationBackwardExWorkspaceSize", {"hipdnnGetBatchNormalizationBackwardExWorkspaceSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetBatchNormalizationTrainingExReserveSpaceSize", {"hipdnnGetBatchNormalizationTrainingExReserveSpaceSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Spatial Transformer functions
{"cudnnCreateSpatialTransformerDescriptor", {"hipdnnCreateSpatialTransformerDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetSpatialTransformerNdDescriptor", {"hipdnnSetSpatialTransformerNdDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroySpatialTransformerDescriptor", {"hipdnnDestroySpatialTransformerDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSpatialTfGridGeneratorForward", {"hipdnnSpatialTfGridGeneratorForward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSpatialTfGridGeneratorBackward", {"hipdnnSpatialTfGridGeneratorBackward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSpatialTfSamplerForward", {"hipdnnSpatialTfSamplerForward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSpatialTfSamplerBackward", {"hipdnnSpatialTfSamplerBackward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Dropout functions
{"cudnnCreateDropoutDescriptor", {"hipdnnCreateDropoutDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyDropoutDescriptor", {"hipdnnDestroyDropoutDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDropoutGetStatesSize", {"hipdnnDropoutGetStatesSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDropoutGetReserveSpaceSize", {"hipdnnDropoutGetReserveSpaceSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetDropoutDescriptor", {"hipdnnSetDropoutDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetDropoutDescriptor", {"hipdnnGetDropoutDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRestoreDropoutDescriptor", {"hipdnnRestoreDropoutDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDropoutForward", {"hipdnnDropoutForward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDropoutBackward", {"hipdnnDropoutBackward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN RNN functions
{"cudnnCreateRNNDescriptor", {"hipdnnCreateRNNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyRNNDescriptor", {"hipdnnDestroyRNNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetRNNForwardInferenceAlgorithmMaxCount", {"hipdnnGetRNNForwardInferenceAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindRNNForwardInferenceAlgorithmEx", {"hipdnnFindRNNForwardInferenceAlgorithmEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNForwardTrainingAlgorithmMaxCount", {"hipdnnGetRNNForwardTrainingAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindRNNForwardTrainingAlgorithmEx", {"hipdnnFindRNNForwardTrainingAlgorithmEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNBackwardDataAlgorithmMaxCount", {"hipdnnGetRNNBackwardDataAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindRNNBackwardDataAlgorithmEx", {"hipdnnFindRNNBackwardDataAlgorithmEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNBackwardWeightsAlgorithmMaxCount", {"hipdnnGetRNNBackwardWeightsAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFindRNNBackwardWeightsAlgorithmEx", {"hipdnnFindRNNBackwardWeightsAlgorithmEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreatePersistentRNNPlan", {"hipdnnCreatePersistentRNNPlan", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetPersistentRNNPlan", {"hipdnnSetPersistentRNNPlan", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnDestroyPersistentRNNPlan", {"hipdnnDestroyPersistentRNNPlan", "", CONV_LIB_FUNC, API_DNN}},
// NOTE" hipdnnSetRNNDescriptor has additional argument hipdnnRNNBiasMode_t *biasMode without default value
{"cudnnSetRNNDescriptor", {"hipdnnSetRNNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
// NOTE" hipdnnGetRNNDescriptor has additional argument hipdnnRNNBiasMode_t *biasMode without default value
{"cudnnGetRNNDescriptor", {"hipdnnGetRNNDescriptor", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetRNNProjectionLayers", {"hipdnnSetRNNProjectionLayers", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNProjectionLayers", {"hipdnnGetRNNProjectionLayers", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetRNNAlgorithmDescriptor", {"hipdnnSetRNNAlgorithmDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetRNNMatrixMathType", {"hipdnnSetRNNMatrixMathType", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNMatrixMathType", {"hipdnnGetRNNMatrixMathType", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNWorkspaceSize", {"hipdnnGetRNNWorkspaceSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetRNNTrainingReserveSize", {"hipdnnGetRNNTrainingReserveSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetRNNParamsSize", {"hipdnnGetRNNParamsSize", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetRNNLinLayerMatrixParams", {"hipdnnGetRNNLinLayerMatrixParams", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnGetRNNLinLayerBiasParams", {"hipdnnGetRNNLinLayerBiasParams", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnRNNForwardInference", {"hipdnnRNNForwardInference", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnRNNForwardInferenceEx", {"hipdnnRNNForwardInferenceEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNForwardTraining", {"hipdnnRNNForwardTraining", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnRNNForwardTrainingEx", {"hipdnnRNNForwardTrainingEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNBackwardData", {"hipdnnRNNBackwardData", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnRNNBackwardDataEx", {"hipdnnRNNBackwardDataEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNBackwardWeights", {"hipdnnRNNBackwardWeights", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnRNNBackwardWeightsEx", {"hipdnnRNNBackwardWeightsEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetRNNDescriptor_v5", {"hipdnnSetRNNDescriptor_v5", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetRNNDescriptor_v6", {"hipdnnSetRNNDescriptor_v6", "", CONV_LIB_FUNC, API_DNN}},
{"cudnnSetRNNPaddingMode", {"hipdnnSetRNNPaddingMode", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNPaddingMode", {"hipdnnGetRNNPaddingMode", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreateRNNDataDescriptor", {"hipdnnCreateRNNDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyRNNDataDescriptor", {"hipdnnDestroyRNNDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetRNNDataDescriptor", {"hipdnnSetRNNDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNDataDescriptor", {"hipdnnGetRNNDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetRNNBiasMode", {"hipdnnSetRNNBiasMode", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetRNNBiasMode", {"hipdnnGetRNNBiasMode", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Connectionist Temporal Classification loss functions
{"cudnnCreateCTCLossDescriptor", {"hipdnnCreateCTCLossDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetCTCLossDescriptor", {"hipdnnSetCTCLossDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetCTCLossDescriptorEx", {"hipdnnSetCTCLossDescriptorEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetCTCLossDescriptor", {"hipdnnGetCTCLossDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetCTCLossDescriptorEx", {"hipdnnGetCTCLossDescriptorEx", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyCTCLossDescriptor", {"hipdnnDestroyCTCLossDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCTCLoss", {"hipdnnCTCLoss", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetCTCLossWorkspaceSize", {"hipdnnGetCTCLossWorkspaceSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Algorithm functions
{"cudnnCreateAlgorithmDescriptor", {"hipdnnCreateAlgorithmDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetAlgorithmDescriptor", {"hipdnnSetAlgorithmDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetAlgorithmDescriptor", {"hipdnnGetAlgorithmDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCopyAlgorithmDescriptor", {"hipdnnCopyAlgorithmDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyAlgorithmDescriptor", {"hipdnnDestroyAlgorithmDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreateAlgorithmPerformance", {"hipdnnCreateAlgorithmPerformance", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetAlgorithmPerformance", {"hipdnnSetAlgorithmPerformance", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetAlgorithmPerformance", {"hipdnnGetAlgorithmPerformance", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyAlgorithmPerformance", {"hipdnnDestroyAlgorithmPerformance", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetAlgorithmSpaceSize", {"hipdnnGetAlgorithmSpaceSize", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSaveAlgorithm", {"hipdnnSaveAlgorithm", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRestoreAlgorithm", {"hipdnnRestoreAlgorithm", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Clipping functions
{"cudnnRNNSetClip", {"hipdnnRNNSetClip", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNGetClip", {"hipdnnRNNGetClip", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Sequence functions
{"cudnnCreateSeqDataDescriptor", {"hipdnnCreateSeqDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroySeqDataDescriptor", {"hipdnnDestroySeqDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetSeqDataDescriptor", {"hipdnnSetSeqDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetSeqDataDescriptor", {"hipdnnGetSeqDataDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Multihead Attention functions
{"cudnnCreateAttnDescriptor", {"hipdnnCreateAttnDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyAttnDescriptor", {"hipdnnDestroyAttnDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetAttnDescriptor", {"hipdnnSetAttnDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetAttnDescriptor", {"hipdnnGetAttnDescriptor", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetMultiHeadAttnBuffers", {"hipdnnGetMultiHeadAttnBuffers", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetMultiHeadAttnWeights", {"hipdnnGetMultiHeadAttnWeights", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnMultiHeadAttnForward", {"hipdnnMultiHeadAttnForward", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnMultiHeadAttnBackwardData", {"hipdnnMultiHeadAttnBackwardData", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnMultiHeadAttnBackwardWeights", {"hipdnnMultiHeadAttnBackwardWeights", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
// cuDNN Fuse functions
{"cudnnCreateFusedOpsConstParamPack", {"hipdnnCreateFusedOpsConstParamPack", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyFusedOpsConstParamPack", {"hipdnnDestroyFusedOpsConstParamPack", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetFusedOpsConstParamPackAttribute", {"hipdnnSetFusedOpsConstParamPackAttribute", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetFusedOpsConstParamPackAttribute", {"hipdnnGetFusedOpsConstParamPackAttribute", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreateFusedOpsVariantParamPack", {"hipdnnCreateFusedOpsVariantParamPack", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyFusedOpsVariantParamPack", {"hipdnnDestroyFusedOpsVariantParamPack", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSetFusedOpsVariantParamPackAttribute", {"hipdnnSetFusedOpsVariantParamPackAttribute", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnGetFusedOpsVariantParamPackAttribute", {"hipdnnGetFusedOpsVariantParamPackAttribute", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCreateFusedOpsPlan", {"hipdnnCreateFusedOpsPlan", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDestroyFusedOpsPlan", {"hipdnnDestroyFusedOpsPlan", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnMakeFusedOpsPlan", {"hipdnnMakeFusedOpsPlan", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsExecute", {"hipdnnFusedOpsExecute", "", CONV_LIB_FUNC, API_DNN, HIP_UNSUPPORTED}},
};
@@ -1,391 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_DNN_TYPE_NAME_MAP{
// cuDNN defines
{"CUDNN_VERSION", {"HIPDNN_VERSION", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 7000
{"CUDNN_DIM_MAX", {"HIPDNN_DIM_MAX", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 8
{"CUDNN_LRN_MIN_N", {"HIPDNN_LRN_MIN_N", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_LRN_MAX_N", {"HIPDNN_LRN_MAX_N", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 16
{"CUDNN_LRN_MIN_K", {"HIPDNN_LRN_MIN_K", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1e-5
{"CUDNN_LRN_MIN_BETA", {"HIPDNN_LRN_MIN_BETA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0.01
{"CUDNN_BN_MIN_EPSILON", {"HIPDNN_BN_MIN_EPSILON", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1e-5
{"CUDNN_SEV_ERROR_EN", {"HIPDNN_SEV_ERROR_EN", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_SEV_WARNING_EN", {"HIPDNN_SEV_WARNING_EN", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_SEV_INFO_EN", {"HIPDNN_SEV_INFO_EN", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_SEQDATA_DIM_COUNT", {"HIPDNN_SEQDATA_DIM_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 4
// cuDNN enums
{"cudnnStatus_t", {"hipdnnStatus_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_STATUS_SUCCESS", {"HIPDNN_STATUS_SUCCESS", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_STATUS_NOT_INITIALIZED", {"HIPDNN_STATUS_NOT_INITIALIZED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_STATUS_ALLOC_FAILED", {"HIPDNN_STATUS_ALLOC_FAILED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_STATUS_BAD_PARAM", {"HIPDNN_STATUS_BAD_PARAM", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_STATUS_INTERNAL_ERROR", {"HIPDNN_STATUS_INTERNAL_ERROR", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_STATUS_INVALID_VALUE", {"HIPDNN_STATUS_INVALID_VALUE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"CUDNN_STATUS_ARCH_MISMATCH", {"HIPDNN_STATUS_ARCH_MISMATCH", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 6
{"CUDNN_STATUS_MAPPING_ERROR", {"HIPDNN_STATUS_MAPPING_ERROR", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 7
{"CUDNN_STATUS_EXECUTION_FAILED", {"HIPDNN_STATUS_EXECUTION_FAILED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 8
{"CUDNN_STATUS_NOT_SUPPORTED", {"HIPDNN_STATUS_NOT_SUPPORTED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 9
{"CUDNN_STATUS_LICENSE_ERROR", {"HIPDNN_STATUS_LICENSE_ERROR", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 10
{"CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING", {"HIPDNN_STATUS_RUNTIME_PREREQUISITE_MISSING", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 11
{"CUDNN_STATUS_RUNTIME_IN_PROGRESS", {"HIPDNN_STATUS_RUNTIME_IN_PROGRESS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 12
{"CUDNN_STATUS_RUNTIME_FP_OVERFLOW", {"HIPDNN_STATUS_RUNTIME_FP_OVERFLOW", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 13
{"cudnnRuntimeTag_t", {"hipdnnRuntimeTag_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnConvolutionMode_t", {"hipdnnConvolutionMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION", {"HIPDNN_CONVOLUTION", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CROSS_CORRELATION", {"HIPDNN_CROSS_CORRELATION", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnTensorFormat_t", {"hipdnnTensorFormat_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_TENSOR_NCHW", {"HIPDNN_TENSOR_NCHW", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_TENSOR_NHWC", {"HIPDNN_TENSOR_NHWC", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_TENSOR_NCHW_VECT_C", {"HIPDNN_TENSOR_NCHW_VECT_C", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"cudnnFoldingDirection_t", {"hipdnnFoldingDirection_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_TRANSFORM_FOLD", {"HIPDNN_TRANSFORM_FOLD", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0U
{"CUDNN_TRANSFORM_UNFOLD", {"HIPDNN_TRANSFORM_UNFOLD", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1U
{"cudnnDataType_t", {"hipdnnDataType_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_DATA_FLOAT", {"HIPDNN_DATA_FLOAT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_DATA_DOUBLE", {"HIPDNN_DATA_DOUBLE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_DATA_HALF", {"HIPDNN_DATA_HALF", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_DATA_INT8", {"HIPDNN_DATA_INT8", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_DATA_INT32", {"HIPDNN_DATA_INT32", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_DATA_INT8x4", {"HIPDNN_DATA_INT8x4", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"CUDNN_DATA_UINT8", {"HIPDNN_DATA_UINT8", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 6
{"CUDNN_DATA_UINT8x4", {"HIPDNN_DATA_UINT8x4", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 7
{"CUDNN_DATA_INT8x32", {"HIPDNN_DATA_INT8x32", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 8
{"cudnnErrQueryMode_t", {"hipdnnErrQueryMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_ERRQUERY_RAWCODE", {"HIPDNN_ERRQUERY_RAWCODE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_ERRQUERY_NONBLOCKING", {"HIPDNN_ERRQUERY_NONBLOCKING", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_ERRQUERY_BLOCKING", {"HIPDNN_ERRQUERY_BLOCKING", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"cudnnSeverity_t", {"hipdnnSeverity_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_SEV_FATAL", {"HIPDNN_SEV_FATAL", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_SEV_ERROR", {"HIPDNN_SEV_ERROR", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_SEV_WARNING", {"HIPDNN_SEV_WARNING", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"CUDNN_SEV_INFO", {"HIPDNN_SEV_INFO", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"cudnnConvolutionFwdAlgo_t", {"hipdnnConvolutionFwdAlgo_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_CONVOLUTION_FWD_ALGO_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_CONVOLUTION_FWD_ALGO_DIRECT", {"HIPDNN_CONVOLUTION_FWD_ALGO_DIRECT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_CONVOLUTION_FWD_ALGO_FFT", {"HIPDNN_CONVOLUTION_FWD_ALGO_FFT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", {"HIPDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", {"HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 6
{"CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", {"HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 7
{"CUDNN_CONVOLUTION_FWD_ALGO_COUNT", {"HIPDNN_CONVOLUTION_FWD_ALGO_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 8
{"cudnnConvolutionFwdPreference_t", {"hipdnnConvolutionFwdPreference_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION_FWD_NO_WORKSPACE", {"HIPDNN_CONVOLUTION_FWD_NO_WORKSPACE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CONVOLUTION_FWD_PREFER_FASTEST", {"HIPDNN_CONVOLUTION_FWD_PREFER_FASTEST", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT", {"HIPDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"cudnnDeterminism_t", {"hipdnnDeterminism_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_NON_DETERMINISTIC", {"HIPDNN_NON_DETERMINISTIC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_DETERMINISTIC", {"HIPDNN_DETERMINISTIC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnDivNormMode_t", {"hipdnnDivNormMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_DIVNORM_PRECOMPUTED_MEANS", {"HIPDNN_DIVNORM_PRECOMPUTED_MEANS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"cudnnCTCLossAlgo_t", {"hipdnnCTCLossAlgo_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_CTC_LOSS_ALGO_DETERMINISTIC", {"HIPDNN_CTC_LOSS_ALGO_DETERMINISTIC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC", {"HIPDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnLRNMode_t", {"hipdnnLRNMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_LRN_CROSS_CHANNEL_DIM1", {"HIPDNN_LRN_CROSS_CHANNEL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0 vs 1
{"cudnnRNNInputMode_t", {"hipdnnRNNInputMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_LINEAR_INPUT", {"HIPDNN_LINEAR_INPUT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_SKIP_INPUT", {"HIPDNN_SKIP_INPUT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnDirectionMode_t", {"hipdnnDirectionMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_UNIDIRECTIONAL", {"HIPDNN_UNIDIRECTIONAL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_BIDIRECTIONAL", {"HIPDNN_BIDIRECTIONAL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnMathType_t", {"hipdnnMathType_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_DEFAULT_MATH", {"HIPDNN_DEFAULT_MATH", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_TENSOR_OP_MATH", {"HIPDNN_TENSOR_OP_MATH", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_TENSOR_OP_MATH_ALLOW_CONVERSION", {"HIPDNN_TENSOR_OP_MATH_ALLOW_CONVERSION", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"cudnnNanPropagation_t", {"hipdnnNanPropagation_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_NOT_PROPAGATE_NAN", {"HIPDNN_NOT_PROPAGATE_NAN", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_PROPAGATE_NAN", {"HIPDNN_PROPAGATE_NAN", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnConvolutionBwdDataAlgo_t", {"hipdnnConvolutionBwdDataAlgo_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_0", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_0", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_1", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_1", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_FFT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"CUDNN_CONVOLUTION_BWD_DATA_ALGO_COUNT", {"HIPDNN_CONVOLUTION_BWD_DATA_ALGO_TRANSPOSE_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 6
{"cudnnConvolutionBwdFilterAlgo_t", {"hipdnnConvolutionBwdFilterAlgo_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_0", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_1", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_3", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 6
{"CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT", {"HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 7
{"cudnnConvolutionBwdFilterPreference_t", {"hipdnnConvolutionBwdFilterPreference_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE", {"HIPDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST", {"HIPDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT",{"HIPDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT","", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"cudnnRNNAlgo_t", {"hipdnnRNNAlgo_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_RNN_ALGO_STANDARD", {"HIPDNN_RNN_ALGO_STANDARD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_RNN_ALGO_PERSIST_STATIC", {"HIPDNN_RNN_ALGO_PERSIST_STATIC", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_RNN_ALGO_PERSIST_DYNAMIC", {"HIPDNN_RNN_ALGO_PERSIST_DYNAMIC", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_RNN_ALGO_COUNT", {"HIPDNN_RNN_ALGO_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"cudnnRNNMode_t", {"hipdnnRNNMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_RNN_RELU", {"HIPDNN_RNN_RELU", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_RNN_TANH", {"HIPDNN_RNN_TANH", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_LSTM", {"HIPDNN_LSTM", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_GRU", {"HIPDNN_GRU", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"cudnnRNNBiasMode_t", {"hipdnnRNNBiasMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_RNN_NO_BIAS", {"HIPDNN_RNN_NO_BIAS", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_RNN_SINGLE_INP_BIAS", {"HIPDNN_RNN_WITH_BIAS", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_RNN_DOUBLE_BIAS", {"HIPDNN_RNN_WITH_BIAS", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_RNN_SINGLE_REC_BIAS", {"HIPDNN_RNN_WITH_BIAS", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnOpTensorOp_t", {"hipdnnOpTensorOp_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_OP_TENSOR_ADD", {"HIPDNN_OP_TENSOR_ADD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_OP_TENSOR_MUL", {"HIPDNN_OP_TENSOR_MUL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_OP_TENSOR_MIN", {"HIPDNN_OP_TENSOR_MIN", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_OP_TENSOR_MAX", {"HIPDNN_OP_TENSOR_MAX", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_OP_TENSOR_SQRT", {"HIPDNN_OP_TENSOR_SQRT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_OP_TENSOR_NOT", {"HIPDNN_OP_TENSOR_NOT", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 5
{"cudnnReduceTensorOp_t", {"hipdnnReduceTensorOp_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_REDUCE_TENSOR_ADD", {"HIPDNN_REDUCE_TENSOR_ADD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_REDUCE_TENSOR_MUL", {"HIPDNN_REDUCE_TENSOR_MUL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_REDUCE_TENSOR_MIN", {"HIPDNN_REDUCE_TENSOR_MIN", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_REDUCE_TENSOR_MAX", {"HIPDNN_REDUCE_TENSOR_MAX", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_REDUCE_TENSOR_AMAX", {"HIPDNN_REDUCE_TENSOR_AMAX", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_REDUCE_TENSOR_AVG", {"HIPDNN_REDUCE_TENSOR_AVG", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"CUDNN_REDUCE_TENSOR_NORM1", {"HIPDNN_REDUCE_TENSOR_NORM1", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 6
{"CUDNN_REDUCE_TENSOR_NORM2", {"HIPDNN_REDUCE_TENSOR_NORM2", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 7
{"CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS", {"HIPDNN_REDUCE_TENSOR_MUL_NO_ZEROS", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 8
{"cudnnReduceTensorIndices_t", {"hipdnnReduceTensorIndices_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_REDUCE_TENSOR_NO_INDICES", {"HIPDNN_REDUCE_TENSOR_NO_INDICES", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_REDUCE_TENSOR_FLATTENED_INDICES", {"HIPDNN_REDUCE_TENSOR_FLATTENED_INDICES", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnConvolutionBwdDataPreference_t", {"hipdnnConvolutionBwdDataPreference_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE", {"HIPDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST", {"HIPDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT", {"HIPDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"cudnnIndicesType_t", {"hipdnnIndicesType_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_32BIT_INDICES", {"HIPDNN_32BIT_INDICES", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_64BIT_INDICES", {"HIPDNN_64BIT_INDICES", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_16BIT_INDICES", {"HIPDNN_16BIT_INDICES", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_8BIT_INDICES", {"HIPDNN_8BIT_INDICES", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"cudnnSoftmaxAlgorithm_t", {"hipdnnSoftmaxAlgorithm_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_SOFTMAX_FAST", {"HIPDNN_SOFTMAX_FAST", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_SOFTMAX_ACCURATE", {"HIPDNN_SOFTMAX_ACCURATE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_SOFTMAX_LOG", {"HIPDNN_SOFTMAX_LOG", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"cudnnSoftmaxMode_t", {"hipdnnSoftmaxMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_SOFTMAX_MODE_INSTANCE", {"HIPDNN_SOFTMAX_MODE_INSTANCE", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_SOFTMAX_MODE_CHANNEL", {"HIPDNN_SOFTMAX_MODE_CHANNEL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"cudnnPoolingMode_t", {"hipdnnPoolingMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_POOLING_MAX", {"HIPDNN_POOLING_MAX", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING", {"HIPDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING", {"HIPDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_POOLING_MAX_DETERMINISTIC", {"HIPDNN_POOLING_MAX_DETERMINISTIC", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"cudnnActivationMode_t", {"hipdnnActivationMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_ACTIVATION_SIGMOID", {"HIPDNN_ACTIVATION_SIGMOID", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_ACTIVATION_RELU", {"HIPDNN_ACTIVATION_RELU", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_ACTIVATION_TANH", {"HIPDNN_ACTIVATION_TANH", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"CUDNN_ACTIVATION_CLIPPED_RELU", {"HIPDNN_ACTIVATION_CLIPPED_RELU", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 3
{"CUDNN_ACTIVATION_ELU", {"HIPDNN_ACTIVATION_ELU", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 4
{"CUDNN_ACTIVATION_IDENTITY", {"HIPDNN_ACTIVATION_PATHTRU", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 5
{"cudnnBatchNormMode_t", {"hipdnnBatchNormMode_t", "", CONV_TYPE, API_DNN}},
{"CUDNN_BATCHNORM_PER_ACTIVATION", {"HIPDNN_BATCHNORM_PER_ACTIVATION", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 0
{"CUDNN_BATCHNORM_SPATIAL", {"HIPDNN_BATCHNORM_SPATIAL", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUDNN_BATCHNORM_SPATIAL_PERSISTENT", {"HIPDNN_BATCHNORM_SPATIAL_PERSISTENT", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 2
{"cudnnSamplerType_t", {"hipdnnSamplerType_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_SAMPLER_BILINEAR", {"HIPDNN_SAMPLER_BILINEAR", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"cudnnBatchNormOps_t", {"hipdnnBatchNormOps_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_BATCHNORM_OPS_BN", {"HIPDNN_BATCHNORM_OPS_BN", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_BATCHNORM_OPS_BN_ACTIVATION", {"HIPDNN_BATCHNORM_OPS_BN_ACTIVATION", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION", {"HIPDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"cudnnRNNClipMode_t", {"hipdnnRNNClipMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_RNN_CLIP_NONE", {"HIPDNN_RNN_CLIP_NONE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_RNN_CLIP_MINMAX", {"HIPDNN_RNN_CLIP_MINMAX", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnRNNDataLayout_t", {"hipdnnRNNDataLayout_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED", {"HIPDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED", {"HIPDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED", {"HIPDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"cudnnRNNPaddingMode_t", {"hipdnnRNNPaddingMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_RNN_PADDED_IO_DISABLED", {"HIPDNN_RNN_PADDED_IO_DISABLED", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_RNN_PADDED_IO_ENABLED", {"HIPDNN_RNN_PADDED_IO_ENABLED", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnSeqDataAxis_t", {"hipdnnSeqDataAxis_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_SEQDATA_TIME_DIM", {"HIPDNN_SEQDATA_TIME_DIM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_SEQDATA_BATCH_DIM", {"HIPDNN_SEQDATA_BATCH_DIM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_SEQDATA_BEAM_DIM", {"HIPDNN_SEQDATA_BEAM_DIM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"CUDNN_SEQDATA_VECT_DIM", {"HIPDNN_SEQDATA_VECT_DIM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"cudnnAttnQueryMap_t", {"hipdnnAttnQueryMap_t", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_ATTN_QUERYMAP_ALL_TO_ONE", {"HIPDNN_ATTN_QUERYMAP_ALL_TO_ONE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_ATTN_QUERYMAP_ONE_TO_ONE", {"HIPDNN_ATTN_QUERYMAP_ONE_TO_ONE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1U << 0
{"CUDNN_ATTN_DISABLE_PROJ_BIASES", {"HIPDNN_ATTN_DISABLE_PROJ_BIASES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_ATTN_ENABLE_PROJ_BIASES", {"HIPDNN_ATTN_ENABLE_PROJ_BIASES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1U << 1
{"cudnnMultiHeadAttnWeightKind_t", {"hipdnnMultiHeadAttnWeightKind_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_MH_ATTN_Q_WEIGHTS", {"HIPDNN_MH_ATTN_Q_WEIGHTS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_MH_ATTN_K_WEIGHTS", {"HIPDNN_MH_ATTN_K_WEIGHTS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_MH_ATTN_V_WEIGHTS", {"HIPDNN_MH_ATTN_V_WEIGHTS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"CUDNN_MH_ATTN_O_WEIGHTS", {"HIPDNN_MH_ATTN_O_WEIGHTS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"CUDNN_MH_ATTN_Q_BIASES", {"HIPDNN_MH_ATTN_Q_BIASES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 4
{"CUDNN_MH_ATTN_K_BIASES", {"HIPDNN_MH_ATTN_K_BIASES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 5
{"CUDNN_MH_ATTN_V_BIASES", {"HIPDNN_MH_ATTN_V_BIASES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 6
{"CUDNN_MH_ATTN_O_BIASES", {"HIPDNN_MH_ATTN_O_BIASES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 7
{"CUDNN_ATTN_WKIND_COUNT", {"HIPDNN_ATTN_WKIND_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 8
{"cudnnWgradMode_t", {"hipdnnWgradMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_WGRAD_MODE_ADD", {"HIPDNN_WGRAD_MODE_ADD", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_WGRAD_MODE_SET", {"HIPDNN_WGRAD_MODE_SET", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnReorderType_t", {"hipdnnReorderType_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_DEFAULT_REORDER", {"HIPDNN_DEFAULT_REORDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_NO_REORDER", {"HIPDNN_NO_REORDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnLossNormalizationMode_t", {"hipdnnLossNormalizationMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_LOSS_NORMALIZATION_NONE", {"HIPDNN_LOSS_NORMALIZATION_NONE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_LOSS_NORMALIZATION_SOFTMAX", {"HIPDNN_LOSS_NORMALIZATION_SOFTMAX", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"cudnnFusedOps_t", {"hipdnnFusedOps_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS", {"HIPDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD", {"HIPDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING", {"HIPDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE", {"HIPDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION", {"HIPDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 4
{"CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK", {"HIPDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 5
{"CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM", {"HIPDNN_FUSED_DACTIVATION_FORK_DBATCHNORM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 6
{"cudnnFusedOpsConstParamLabel_t", {"hipdnnFusedOpsConstParamLabel_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_PARAM_XDESC", {"HIPDNN_PARAM_XDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_PARAM_XDATA_PLACEHOLDER", {"HIPDNN_PARAM_XDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_PARAM_BN_MODE", {"HIPDNN_PARAM_BN_MODE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"CUDNN_PARAM_BN_EQSCALEBIAS_DESC", {"HIPDNN_PARAM_BN_EQSCALEBIAS_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER", {"HIPDNN_PARAM_BN_EQSCALE_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 4
{"CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER", {"HIPDNN_PARAM_BN_EQBIAS_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 5
{"CUDNN_PARAM_ACTIVATION_DESC", {"HIPDNN_PARAM_ACTIVATION_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 6
{"CUDNN_PARAM_CONV_DESC", {"HIPDNN_PARAM_CONV_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 7
{"CUDNN_PARAM_WDESC", {"HIPDNN_PARAM_WDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 8
{"CUDNN_PARAM_WDATA_PLACEHOLDER", {"HIPDNN_PARAM_WDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 9
{"CUDNN_PARAM_DWDESC", {"HIPDNN_PARAM_DWDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 10
{"CUDNN_PARAM_DWDATA_PLACEHOLDER", {"HIPDNN_PARAM_DWDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 11
{"CUDNN_PARAM_YDESC", {"HIPDNN_PARAM_YDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 12
{"CUDNN_PARAM_YDATA_PLACEHOLDER", {"HIPDNN_PARAM_YDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 13
{"CUDNN_PARAM_DYDESC", {"HIPDNN_PARAM_DYDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 14
{"CUDNN_PARAM_DYDATA_PLACEHOLDER", {"HIPDNN_PARAM_DYDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 15
{"CUDNN_PARAM_YSTATS_DESC", {"HIPDNN_PARAM_YSTATS_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 16
{"CUDNN_PARAM_YSUM_PLACEHOLDER", {"HIPDNN_PARAM_YSUM_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 17
{"CUDNN_PARAM_YSQSUM_PLACEHOLDER", {"HIPDNN_PARAM_YSQSUM_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 18
{"CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC", {"HIPDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 19
{"CUDNN_PARAM_BN_SCALE_PLACEHOLDER", {"HIPDNN_PARAM_BN_SCALE_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 20
{"CUDNN_PARAM_BN_BIAS_PLACEHOLDER", {"HIPDNN_PARAM_BN_BIAS_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 21
{"CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER", {"HIPDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 22
{"CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER", {"HIPDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 23
{"CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER", {"HIPDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 24
{"CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER", {"HIPDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 25
{"CUDNN_PARAM_ZDESC", {"HIPDNN_PARAM_ZDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 26
{"CUDNN_PARAM_ZDATA_PLACEHOLDER", {"HIPDNN_PARAM_ZDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 27
{"CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC", {"HIPDNN_PARAM_BN_Z_EQSCALEBIAS_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 28
{"CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER", {"HIPDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 29
{"CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER", {"HIPDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 30
{"CUDNN_PARAM_ACTIVATION_BITMASK_DESC", {"HIPDNN_PARAM_ACTIVATION_BITMASK_DESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 31
{"CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER", {"HIPDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 32
{"CUDNN_PARAM_DXDESC", {"HIPDNN_PARAM_DXDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 33
{"CUDNN_PARAM_DXDATA_PLACEHOLDER", {"HIPDNN_PARAM_DXDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 34
{"CUDNN_PARAM_DZDESC", {"HIPDNN_PARAM_DZDESC", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 35
{"CUDNN_PARAM_DZDATA_PLACEHOLDER", {"HIPDNN_PARAM_DZDATA_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 36
{"CUDNN_PARAM_BN_DSCALE_PLACEHOLDER", {"HIPDNN_PARAM_BN_DSCALE_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 37
{"CUDNN_PARAM_BN_DBIAS_PLACEHOLDER", {"HIPDNN_PARAM_BN_DBIAS_PLACEHOLDER", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 38
{"cudnnFusedOpsPointerPlaceHolder_t", {"hipdnnActivationMode_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_PTR_NULL", {"HIPDNN_ACTIVATION_SIGMOID", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_PTR_ELEM_ALIGNED", {"HIPDNN_ACTIVATION_RELU", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_PTR_16B_ALIGNED", {"HIPDNN_ACTIVATION_TANH", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"cudnnFusedOpsVariantParamLabel_t", {"hipdnnFusedOpsVariantParamLabel_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"CUDNN_PTR_XDATA", {"HIPDNN_PTR_XDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 0
{"CUDNN_PTR_BN_EQSCALE", {"HIPDNN_PTR_BN_EQSCALE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 1
{"CUDNN_PTR_BN_EQBIAS", {"HIPDNN_PTR_BN_EQBIAS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 2
{"CUDNN_PTR_WDATA", {"HIPDNN_PTR_WDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 3
{"CUDNN_PTR_DWDATA", {"HIPDNN_PTR_DWDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 4
{"CUDNN_PTR_YDATA", {"HIPDNN_PTR_YDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 5
{"CUDNN_PTR_DYDATA", {"HIPDNN_PTR_DYDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 6
{"CUDNN_PTR_YSUM", {"HIPDNN_PTR_YSUM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 7
{"CUDNN_PTR_YSQSUM", {"HIPDNN_PTR_YSQSUM", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 8
{"CUDNN_PTR_WORKSPACE", {"HIPDNN_PTR_WORKSPACE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 9
{"CUDNN_PTR_BN_SCALE", {"HIPDNN_PTR_BN_SCALE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 10
{"CUDNN_PTR_BN_BIAS", {"HIPDNN_PTR_BN_BIAS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 11
{"CUDNN_PTR_BN_SAVED_MEAN", {"HIPDNN_PTR_BN_SAVED_MEAN", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 12
{"CUDNN_PTR_BN_SAVED_INVSTD", {"HIPDNN_PTR_BN_SAVED_INVSTD", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 13
{"CUDNN_PTR_BN_RUNNING_MEAN", {"HIPDNN_PTR_BN_RUNNING_MEAN", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 14
{"CUDNN_PTR_BN_RUNNING_VAR", {"HIPDNN_PTR_BN_RUNNING_VAR", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 15
{"CUDNN_PTR_ZDATA", {"HIPDNN_PTR_ZDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 16
{"CUDNN_PTR_BN_Z_EQSCALE", {"HIPDNN_PTR_BN_Z_EQSCALE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 17
{"CUDNN_PTR_BN_Z_EQBIAS", {"HIPDNN_PTR_BN_Z_EQBIAS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 18
{"CUDNN_PTR_ACTIVATION_BITMASK", {"HIPDNN_PTR_ACTIVATION_BITMASK", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 19
{"CUDNN_PTR_DXDATA", {"HIPDNN_PTR_DXDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 20
{"CUDNN_PTR_DZDATA", {"HIPDNN_PTR_DZDATA", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 21
{"CUDNN_PTR_BN_DSCALE", {"HIPDNN_PTR_BN_DSCALE", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 22
{"CUDNN_PTR_BN_DBIAS", {"HIPDNN_PTR_BN_DBIAS", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 23
{"CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES", {"HIPDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 100
{"CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT", {"HIPDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 101
{"CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR", {"HIPDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 102
{"CUDNN_SCALAR_DOUBLE_BN_EPSILON", {"HIPDNN_SCALAR_DOUBLE_BN_EPSILON", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // 103
// cuDNN types
{"cudnnContext", {"hipdnnContext", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnHandle_t", {"hipdnnHandle_t", "", CONV_TYPE, API_DNN}},
{"cudnnTensorStruct", {"hipdnnTensorStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnTensorDescriptor_t", {"hipdnnTensorDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnConvolutionStruct", {"hipdnnConvolutionStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnConvolutionDescriptor_t", {"hipdnnConvolutionDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnPoolingStruct", {"hipdnnPoolingStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnPoolingDescriptor_t", {"hipdnnPoolingDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnFilterStruct", {"hipdnnFilterStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFilterDescriptor_t", {"hipdnnFilterDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnLRNStruct", {"hipdnnLRNStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnLRNDescriptor_t", {"hipdnnLRNDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnActivationStruct", {"hipdnnActivationStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnActivationDescriptor_t", {"hipdnnActivationDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnSpatialTransformerStruct", {"hipdnnSpatialTransformerStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSpatialTransformerDescriptor_t", {"hipdnnSpatialTransformerDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnOpTensorStruct", {"hipdnnOpTensorStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnOpTensorDescriptor_t", {"hipdnnOpTensorDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnReduceTensorStruct", {"hipdnnReduceTensorStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnReduceTensorDescriptor_t", {"hipdnnReduceTensorDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnCTCLossStruct", {"hipdnnCTCLossStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCTCLossDescriptor_t", {"hipdnnCTCLossDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnTensorTransformStruct", {"hipdnnTensorTransformStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnTensorTransformDescriptor_t", {"hipdnnTensorTransformDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnConvolutionFwdAlgoPerf_t", {"hipdnnConvolutionFwdAlgoPerf_t", "", CONV_TYPE, API_DNN}},
{"cudnnConvolutionBwdFilterAlgoPerf_t", {"hipdnnConvolutionBwdFilterAlgoPerf_t", "", CONV_TYPE, API_DNN}},
{"cudnnConvolutionBwdDataAlgoPerf_t", {"hipdnnConvolutionBwdDataAlgoPerf_t", "", CONV_TYPE, API_DNN}},
{"cudnnDropoutStruct", {"hipdnnDropoutStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDropoutDescriptor_t", {"hipdnnDropoutDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnAlgorithmStruct", {"hipdnnAlgorithmStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnAlgorithmDescriptor_t", {"hipdnnAlgorithmDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnAlgorithmPerformanceStruct", {"hipdnnAlgorithmPerformanceStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnAlgorithmPerformance_t", {"hipdnnAlgorithmPerformance_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNStruct", {"hipdnnRNNStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNDescriptor_t", {"hipdnnRNNDescriptor_t", "", CONV_TYPE, API_DNN}},
{"cudnnPersistentRNNPlan", {"hipdnnPersistentRNNPlan", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnPersistentRNNPlan_t", {"hipdnnPersistentRNNPlan_t", "", CONV_TYPE, API_DNN}},
{"cudnnAlgorithm_t", {"hipdnnAlgorithm_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnDebug_t", {"hipdnnDebug_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnCallback_t", {"hipdnnCallback_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNDataStruct", {"hipdnnRNNDataStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnRNNDataDescriptor_t", {"hipdnnRNNDataDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSeqDataStruct", {"hipdnnSeqDataStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnSeqDataDescriptor_t", {"hipdnnSeqDataDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnAttnStruct", {"hipdnnAttnStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnAttnDescriptor_t", {"hipdnnAttnDescriptor_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsConstParamStruct", {"hipdnnFusedOpsConstParamStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsConstParamPack_t", {"hipdnnFusedOpsConstParamPack_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsVariantParamStruct", {"hipdnnFusedOpsVariantParamStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsVariantParamPack_t", {"hipdnnFusedOpsVariantParamPack_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsPlanStruct", {"hipdnnFusedOpsPlanStruct", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
{"cudnnFusedOpsPlan_t", {"hipdnnFusedOpsPlan_t", "", CONV_TYPE, API_DNN, HIP_UNSUPPORTED}},
};
@@ -1,616 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps CUDA header names to HIP header names
const std::map<llvm::StringRef, hipCounter> CUDA_DEVICE_FUNC_MAP{
// math functions
{"abs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"labs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"llabs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fabs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fabsf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"min", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fminf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fmin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"max", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fmaxf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fmax", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cos", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sincos", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sincosf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"tan", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sqrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rsqrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rsqrtf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"exp2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"exp2f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"exp10", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"exp10f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"expm1", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"expm1f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log2f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log10", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log1p", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log1pf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"floor", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"exp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cosh", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sinh", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"tanh", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"acosh", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"acoshf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"asinh", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"asinhf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atanh", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atanhf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ldexp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ldexpf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"logb", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"logbf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ilogb", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ilogbf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"scalbn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"scalbnf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"scalbln", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"scalblnf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"frexp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"frexpf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"round", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"roundf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"lround", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"lroundf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"llround", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"llroundf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rintf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"lrint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"lrintf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"llrint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"llrintf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"nearbyint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"nearbyintf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ceil", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"trunc", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"truncf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fdim", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fdimf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atan2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atan", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"acos", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"asin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hypot", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rhypot", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hypotf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rhypotf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"norm3d", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rnorm3d", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"norm4d", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rnorm4d", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"norm", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rnorm", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rnormf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"normf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"norm3df", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rnorm3df", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"norm4df", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rnorm4df", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cbrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cbrtf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rcbrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"rcbrtf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sinpi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sinpif", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cospi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cospif", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sincospi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sincospif", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"pow", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"modf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fmod", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"remainder", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"remainderf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"remquo", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"remquof", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"j0", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"j0f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"j1", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"j1f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"jn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"jnf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"y0", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"y0f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"y1", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"y1f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"yn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ynf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cyl_bessel_i0", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cyl_bessel_i0f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cyl_bessel_i1", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cyl_bessel_i1f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erff", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfinv", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfinvf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfc", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfcf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"lgamma", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfcinv", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfcinvf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"normcdfinv", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"normcdfinvf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"normcdf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"normcdff", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfcx", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"erfcxf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"lgammaf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"tgamma", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"tgammaf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"copysign", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"copysignf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"nextafter", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"nextafterf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"nan", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"nanf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fma", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fmaf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"acosf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"asinf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atanf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atan2f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"cosf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sinf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"tanf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"coshf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sinhf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"tanhf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"expf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"logf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"log10f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"modff", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"powf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"sqrtf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"ceilf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"floorf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fmodf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"signbit", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"isfinite", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"isnan", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"isinf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"umin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"llmin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"ullmin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"umax", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"llmax", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"ullmax", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__isinff", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__isnanf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__finite", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__finitef", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__signbit", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__isnan", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__isinf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__signbitf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__signbitl", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__finitel", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__isinfl", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__isnanl", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"_ldsign", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"_fdsign", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"_Pow_int", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
// static math functions declared in device-functions.h
{"mulhi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"mul64hi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"float_as_int", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"int_as_float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"float_as_uint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"uint_as_float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"saturate", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"mul24", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"umul24", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"float2int", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"int2float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"uint2float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
// device functions
{"__mulhi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__umulhi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__mul64hi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__umul64hi", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int_as_float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float_as_int", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint_as_float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float_as_uint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__syncthreads", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__threadfence", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__threadfence_block", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__saturatef", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__sad", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__usad", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__mul24", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__umul24", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fdividef", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fdividef", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"fdivide", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__sinf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__cosf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__tanf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__sincosf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__expf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__exp10f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__log2f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__log10f", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__logf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__powf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2int_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2int_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2int_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2int_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2uint_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2uint_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2uint_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2uint_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2float_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2float_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2float_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2float_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2float_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2float_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2float_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2float_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ll_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ll_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ll_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ll_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ull_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ull_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ull_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2ull_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2float_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2float_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2float_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2float_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2float_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2float_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2float_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2float_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fadd_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fadd_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fadd_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fadd_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsub_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsub_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsub_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsub_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmul_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmul_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmul_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmul_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmaf_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmaf_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmaf_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fmaf_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__frcp_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__frcp_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__frcp_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__frcp_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsqrt_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsqrt_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsqrt_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fsqrt_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__frsqrt_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fdiv_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fdiv_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fdiv_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__fdiv_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__clz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ffs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__popc", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__brev", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__clzll", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ffsll", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__popcll", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__brevll", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__byte_perm", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hadd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__rhadd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uhadd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__urhadd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__double2int_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__double2uint_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__double2ll_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__double2ull_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__prof_trigger", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__trap", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__brkpt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__pm0", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__pm1", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__pm2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__pm3", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
// SIMD functions
{"__vabs2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabsss2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vadd2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vaddss2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vaddus2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vavgs2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vavgu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vhaddu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpeq2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpges2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpgeu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpgts2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpgtu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmples2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmplts2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpltu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpne2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabsdiffu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vmaxs2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vmaxu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vmins2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vminu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vseteq2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetges2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetgeu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetgts2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetles2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetleu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetlts2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetltu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetne2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsadu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsub2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsubss2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsubus2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vneg2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vnegss2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabsdiffs2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsads2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabs4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabsss4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vadd4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vaddss4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vaddus4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vavgs4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vavgu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vhaddu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpeq4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpges4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpgeu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpgts4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpgtu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmples4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpleu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmplts4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpltu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vcmpne4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabsdiffu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vmaxs4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vmaxu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vmins4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vminu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vseteq4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetles4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetleu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetlts4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetltu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetges4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetgeu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetgts4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetgtu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsetne4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsadu4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsub4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsubss4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsubus4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vneg4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vnegss4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vabsdiffs4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__vsads4", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
// fp16 functions
{"__float2half", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2half_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float2half2_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__floats2half2_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__low2float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__high2float", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__float22half2_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half22float2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2int_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2int_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2int_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2int_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__int2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2short_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2short_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2short_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2short_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__short2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__short2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__short2half_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__short2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2uint_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2uint_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2uint_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2uint_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2half_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__uint2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ushort_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ushort_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ushort_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ushort_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ushort2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ushort2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ushort2half_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ushort2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ull_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ull_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ull_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ull_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2half_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ull2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ll_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ll_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ll_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2ll_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2half_rn", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2half_rz", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2half_rd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ll2half_ru", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"htrunc", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hceil", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hfloor", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hrint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2trunc", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2ceil", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2floor", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2rint", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half2half2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__lowhigh2highlow", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__lows2half2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__highs2half2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__high2half", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__low2half", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hisinf", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__halves2half2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__low2half2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__high2half2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half_as_short", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__half_as_ushort", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__short_as_half", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ushort_as_half", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ldg", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ldcg", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ldca", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__ldcs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__heq2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hne2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hle2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hge2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hlt2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hgt2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hequ2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hneu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hleu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hgeu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hltu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hgtu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hisnan2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hadd2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hsub2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hmul2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__h2div", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hadd2_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hsub2_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hmul2_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hfma2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hfma2_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hneg2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hsub", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hmul", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hdiv", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hadd_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hsub_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hmul_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hfma", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hfma_sat", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hneg", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__habs2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__habs", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__hbeq2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbne2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hble2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbge2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hblt2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbgt2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbequ2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbneu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbleu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbgeu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbltu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hbgtu2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__heq", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hne", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hle", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hge", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hlt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hgt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hequ", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hneu", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hleu", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hgeu", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hltu", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hgtu", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__hisnan", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hsqrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hrsqrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hrcp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hlog", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hlog2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hlog10", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hexp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hexp2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hexp10", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hcos", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"hsin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2sqrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2rsqrt", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2rcp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2log", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2log2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2log10", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2exp", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2exp2", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2exp10", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2cos", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"h2sin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"__shfl_sync", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__shfl_up_sync", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__shfl_down_sync", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
{"__shfl_xor_sync", {"", "", CONV_DEVICE_FUNC, API_RUNTIME, UNSUPPORTED}},
// atomic functions
{"atomicAdd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicSub", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicExch", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicMin", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicMax", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicInc", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicDec", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicAnd", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicOr", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicXor", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
{"atomicCAS", {"", "", CONV_DEVICE_FUNC, API_RUNTIME}},
};
@@ -1,815 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all CUDA Driver API functions
const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP{
// 5.2. Error Handling
// no analogue
// NOTE: cudaGetErrorName and cuGetErrorName have different signatures
{"cuGetErrorName", {"hipGetErrorName_", "", CONV_ERROR, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: cudaGetErrorString and cuGetErrorString have different signatures
{"cuGetErrorString", {"hipGetErrorString_", "", CONV_ERROR, API_DRIVER, HIP_UNSUPPORTED}},
// 5.3. Initialization
// no analogue
{"cuInit", {"hipInit", "", CONV_INIT, API_DRIVER}},
// 5.4 Version Management
// cudaDriverGetVersion
{"cuDriverGetVersion", {"hipDriverGetVersion", "", CONV_VERSION, API_DRIVER}},
// 5.5. Device Management
// cudaGetDevice
// NOTE: cudaGetDevice has additional attr: int ordinal
{"cuDeviceGet", {"hipGetDevice", "", CONV_DEVICE, API_DRIVER}},
// cudaDeviceGetAttribute
{"cuDeviceGetAttribute", {"hipDeviceGetAttribute", "", CONV_DEVICE, API_DRIVER}},
// cudaGetDeviceCount
{"cuDeviceGetCount", {"hipGetDeviceCount", "", CONV_DEVICE, API_DRIVER}},
// no analogue
{"cuDeviceGetLuid", {"hipDeviceGetLuid", "", CONV_DEVICE, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuDeviceGetName", {"hipDeviceGetName", "", CONV_DEVICE, API_DRIVER}},
// cudaDeviceGetNvSciSyncAttributes
{"cuDeviceGetNvSciSyncAttributes", {"hipDeviceGetNvSciSyncAttributes", "", CONV_DEVICE, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuDeviceGetUuid", {"hipDeviceGetUuid", "", CONV_DEVICE, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuDeviceTotalMem", {"hipDeviceTotalMem", "", CONV_DEVICE, API_DRIVER}},
{"cuDeviceTotalMem_v2", {"hipDeviceTotalMem", "", CONV_DEVICE, API_DRIVER}},
// 5.6. Device Management [DEPRECATED]
{"cuDeviceComputeCapability", {"hipDeviceComputeCapability", "", CONV_DEVICE, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaGetDeviceProperties due to different attributes: cudaDeviceProp and CUdevprop
{"cuDeviceGetProperties", {"hipGetDeviceProperties_", "", CONV_DEVICE, API_DRIVER, HIP_UNSUPPORTED}},
// 5.7. Primary Context Management
// no analogues
{"cuDevicePrimaryCtxGetState", {"hipDevicePrimaryCtxGetState", "", CONV_CONTEXT, API_DRIVER}},
{"cuDevicePrimaryCtxRelease", {"hipDevicePrimaryCtxRelease", "", CONV_CONTEXT, API_DRIVER}},
{"cuDevicePrimaryCtxReset", {"hipDevicePrimaryCtxReset", "", CONV_CONTEXT, API_DRIVER}},
{"cuDevicePrimaryCtxRetain", {"hipDevicePrimaryCtxRetain", "", CONV_CONTEXT, API_DRIVER}},
{"cuDevicePrimaryCtxSetFlags", {"hipDevicePrimaryCtxSetFlags", "", CONV_CONTEXT, API_DRIVER}},
// 5.8. Context Management
// no analogues, except a few
{"cuCtxCreate", {"hipCtxCreate", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxCreate_v2", {"hipCtxCreate", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxDestroy", {"hipCtxDestroy", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxDestroy_v2", {"hipCtxDestroy", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxGetApiVersion", {"hipCtxGetApiVersion", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxGetCacheConfig", {"hipCtxGetCacheConfig", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxGetCurrent", {"hipCtxGetCurrent", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxGetDevice", {"hipCtxGetDevice", "", CONV_CONTEXT, API_DRIVER}},
// cudaGetDeviceFlags
// TODO: rename to hipGetDeviceFlags
{"cuCtxGetFlags", {"hipCtxGetFlags", "", CONV_CONTEXT, API_DRIVER}},
// cudaDeviceGetLimit
{"cuCtxGetLimit", {"hipDeviceGetLimit", "", CONV_CONTEXT, API_DRIVER}},
// cudaDeviceGetSharedMemConfig
// TODO: rename to hipDeviceGetSharedMemConfig
{"cuCtxGetSharedMemConfig", {"hipCtxGetSharedMemConfig", "", CONV_CONTEXT, API_DRIVER}},
// cudaDeviceGetStreamPriorityRange
{"cuCtxGetStreamPriorityRange", {"hipDeviceGetStreamPriorityRange", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxPopCurrent", {"hipCtxPopCurrent", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxPopCurrent_v2", {"hipCtxPopCurrent", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxPushCurrent", {"hipCtxPushCurrent", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxPushCurrent_v2", {"hipCtxPushCurrent", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxSetCacheConfig", {"hipCtxSetCacheConfig", "", CONV_CONTEXT, API_DRIVER}},
{"cuCtxSetCurrent", {"hipCtxSetCurrent", "", CONV_CONTEXT, API_DRIVER}},
// cudaDeviceSetLimit
{"cuCtxSetLimit", {"hipDeviceSetLimit", "", CONV_CONTEXT, API_DRIVER}},
// cudaDeviceSetSharedMemConfig
// TODO: rename to hipDeviceSetSharedMemConfig
{"cuCtxSetSharedMemConfig", {"hipCtxSetSharedMemConfig", "", CONV_CONTEXT, API_DRIVER}},
// cudaDeviceSynchronize
// TODO: rename to hipDeviceSynchronize
{"cuCtxSynchronize", {"hipCtxSynchronize", "", CONV_CONTEXT, API_DRIVER}},
// 5.9. Context Management [DEPRECATED]
// no analogues
{"cuCtxAttach", {"hipCtxAttach", "", CONV_CONTEXT, API_DRIVER, HIP_UNSUPPORTED}},
{"cuCtxDetach", {"hipCtxDetach", "", CONV_CONTEXT, API_DRIVER, HIP_UNSUPPORTED}},
// 5.10. Module Management
// no analogues
{"cuLinkAddData", {"hipLinkAddData", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkAddData_v2", {"hipLinkAddData", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkAddFile", {"hipLinkAddFile", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkAddFile_v2", {"hipLinkAddFile", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkComplete", {"hipLinkComplete", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkCreate", {"hipLinkCreate", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkCreate_v2", {"hipLinkCreate", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuLinkDestroy", {"hipLinkDestroy", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuModuleGetFunction", {"hipModuleGetFunction", "", CONV_MODULE, API_DRIVER}},
{"cuModuleGetGlobal", {"hipModuleGetGlobal", "", CONV_MODULE, API_DRIVER}},
{"cuModuleGetGlobal_v2", {"hipModuleGetGlobal", "", CONV_MODULE, API_DRIVER}},
{"cuModuleGetSurfRef", {"hipModuleGetSurfRef", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuModuleGetTexRef", {"hipModuleGetTexRef", "", CONV_MODULE, API_DRIVER}},
{"cuModuleLoad", {"hipModuleLoad", "", CONV_MODULE, API_DRIVER}},
{"cuModuleLoadData", {"hipModuleLoadData", "", CONV_MODULE, API_DRIVER}},
{"cuModuleLoadDataEx", {"hipModuleLoadDataEx", "", CONV_MODULE, API_DRIVER}},
{"cuModuleLoadFatBinary", {"hipModuleLoadFatBinary", "", CONV_MODULE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuModuleUnload", {"hipModuleUnload", "", CONV_MODULE, API_DRIVER}},
// 5.11. Memory Management
// no analogue
{"cuArray3DCreate", {"hipArray3DCreate", "", CONV_MEMORY, API_DRIVER}},
{"cuArray3DCreate_v2", {"hipArray3DCreate", "", CONV_MEMORY, API_DRIVER}},
{"cuArray3DGetDescriptor", {"hipArray3DGetDescriptor", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuArray3DGetDescriptor_v2", {"hipArray3DGetDescriptor", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuArrayCreate", {"hipArrayCreate", "", CONV_MEMORY, API_DRIVER}},
{"cuArrayCreate_v2", {"hipArrayCreate", "", CONV_MEMORY, API_DRIVER}},
{"cuArrayDestroy", {"hipArrayDestroy", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuArrayGetDescriptor", {"hipArrayGetDescriptor", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuArrayGetDescriptor_v2", {"hipArrayGetDescriptor", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// cudaDeviceGetByPCIBusId
{"cuDeviceGetByPCIBusId", {"hipDeviceGetByPCIBusId", "", CONV_MEMORY, API_DRIVER}},
// cudaDeviceGetPCIBusId
{"cuDeviceGetPCIBusId", {"hipDeviceGetPCIBusId", "", CONV_MEMORY, API_DRIVER}},
// cudaIpcCloseMemHandle
{"cuIpcCloseMemHandle", {"hipIpcCloseMemHandle", "", CONV_MEMORY, API_DRIVER}},
// cudaIpcGetEventHandle
{"cuIpcGetEventHandle", {"hipIpcGetEventHandle", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// cudaIpcGetMemHandle
{"cuIpcGetMemHandle", {"hipIpcGetMemHandle", "", CONV_MEMORY, API_DRIVER}},
// cudaIpcOpenEventHandle
{"cuIpcOpenEventHandle", {"hipIpcOpenEventHandle", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// cudaIpcOpenMemHandle
{"cuIpcOpenMemHandle", {"hipIpcOpenMemHandle", "", CONV_MEMORY, API_DRIVER}},
// cudaMalloc
{"cuMemAlloc", {"hipMalloc", "", CONV_MEMORY, API_DRIVER}},
{"cuMemAlloc_v2", {"hipMalloc", "", CONV_MEMORY, API_DRIVER}},
// cudaHostAlloc
{"cuMemAllocHost", {"hipHostMalloc", "", CONV_MEMORY, API_DRIVER}},
{"cuMemAllocHost_v2", {"hipHostMalloc", "", CONV_MEMORY, API_DRIVER}},
// cudaMallocManaged
{"cuMemAllocManaged", {"hipMallocManaged", "", CONV_MEMORY, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaMallocPitch due to different signatures
{"cuMemAllocPitch", {"hipMemAllocPitch", "", CONV_MEMORY, API_DRIVER}},
{"cuMemAllocPitch_v2", {"hipMemAllocPitch", "", CONV_MEMORY, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaMemcpy due to different signatures
{"cuMemcpy", {"hipMemcpy_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpy2D due to different signatures
{"cuMemcpy2D", {"hipMemcpyParam2D", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpy2D_v2", {"hipMemcpyParam2D", "", CONV_MEMORY, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaMemcpy2DAsync/hipMemcpy2DAsync due to different signatures
{"cuMemcpy2DAsync", {"hipMemcpyParam2DAsync", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpy2DAsync_v2", {"hipMemcpyParam2DAsync", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpy2DUnaligned", {"hipMemcpy2DUnaligned", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpy2DUnaligned_v2", {"hipMemcpy2DUnaligned", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpy3D due to different signatures
{"cuMemcpy3D", {"hipMemcpy3D_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpy3D_v2", {"hipMemcpy3D_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpy3DAsync due to different signatures
{"cuMemcpy3DAsync", {"hipMemcpy3DAsync_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpy3DAsync_v2", {"hipMemcpy3DAsync_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpy3DPeer due to different signatures
{"cuMemcpy3DPeer", {"hipMemcpy3DPeer_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpy3DPeerAsync due to different signatures
{"cuMemcpy3DPeerAsync", {"hipMemcpy3DPeerAsync_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpyAsync due to different signatures
{"cuMemcpyAsync", {"hipMemcpyAsync_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpyArrayToArray due to different signatures
{"cuMemcpyAtoA", {"hipMemcpyAtoA", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpyAtoA_v2", {"hipMemcpyAtoA", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemcpyAtoD", {"hipMemcpyAtoD", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpyAtoD_v2", {"hipMemcpyAtoD", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemcpyAtoH", {"hipMemcpyAtoH", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyAtoH_v2", {"hipMemcpyAtoH", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyAtoHAsync", {"hipMemcpyAtoHAsync", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpyAtoHAsync_v2", {"hipMemcpyAtoHAsync", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemcpyDtoA", {"hipMemcpyDtoA", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpyDtoA_v2", {"hipMemcpyDtoA", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemcpyDtoD", {"hipMemcpyDtoD", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyDtoD_v2", {"hipMemcpyDtoD", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyDtoDAsync", {"hipMemcpyDtoDAsync", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyDtoDAsync_v2", {"hipMemcpyDtoDAsync", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyDtoH", {"hipMemcpyDtoH", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyDtoH_v2", {"hipMemcpyDtoH", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyDtoHAsync", {"hipMemcpyDtoHAsync", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyDtoHAsync_v2", {"hipMemcpyDtoHAsync", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyHtoA", {"hipMemcpyHtoA", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyHtoA_v2", {"hipMemcpyHtoA", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyHtoAAsync", {"hipMemcpyHtoAAsync", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemcpyHtoAAsync_v2", {"hipMemcpyHtoAAsync", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemcpyHtoD", {"hipMemcpyHtoD", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyHtoD_v2", {"hipMemcpyHtoD", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemcpyHtoDAsync", {"hipMemcpyHtoDAsync", "", CONV_MEMORY, API_DRIVER}},
{"cuMemcpyHtoDAsync_v2", {"hipMemcpyHtoDAsync", "", CONV_MEMORY, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaMemcpyPeer due to different signatures
{"cuMemcpyPeer", {"hipMemcpyPeer_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaMemcpyPeerAsync due to different signatures
{"cuMemcpyPeerAsync", {"hipMemcpyPeerAsync_", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// cudaFree
{"cuMemFree", {"hipFree", "", CONV_MEMORY, API_DRIVER}},
{"cuMemFree_v2", {"hipFree", "", CONV_MEMORY, API_DRIVER}},
// cudaFreeHost
{"cuMemFreeHost", {"hipHostFree", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemGetAddressRange", {"hipMemGetAddressRange", "", CONV_MEMORY, API_DRIVER}},
{"cuMemGetAddressRange_v2", {"hipMemGetAddressRange", "", CONV_MEMORY, API_DRIVER}},
// cudaMemGetInfo
{"cuMemGetInfo", {"hipMemGetInfo", "", CONV_MEMORY, API_DRIVER}},
{"cuMemGetInfo_v2", {"hipMemGetInfo", "", CONV_MEMORY, API_DRIVER}},
// cudaHostAlloc
{"cuMemHostAlloc", {"hipHostMalloc", "", CONV_MEMORY, API_DRIVER}},
// cudaHostGetDevicePointer
{"cuMemHostGetDevicePointer", {"hipHostGetDevicePointer", "", CONV_MEMORY, API_DRIVER}},
{"cuMemHostGetDevicePointer_v2", {"hipHostGetDevicePointer", "", CONV_MEMORY, API_DRIVER}},
// cudaHostGetFlags
{"cuMemHostGetFlags", {"hipHostGetFlags", "", CONV_MEMORY, API_DRIVER}},
// cudaHostRegister
{"cuMemHostRegister", {"hipHostRegister", "", CONV_MEMORY, API_DRIVER}},
{"cuMemHostRegister_v2", {"hipHostRegister", "", CONV_MEMORY, API_DRIVER}},
// cudaHostUnregister
{"cuMemHostUnregister", {"hipHostUnregister", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemsetD16", {"hipMemsetD16", "", CONV_MEMORY, API_DRIVER}},
{"cuMemsetD16_v2", {"hipMemsetD16", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemsetD16Async", {"hipMemsetD16Async", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemsetD2D16", {"hipMemsetD2D16", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemsetD2D16_v2", {"hipMemsetD2D16", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemsetD2D16Async", {"hipMemsetD2D16Async", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemsetD2D32", {"hipMemsetD2D32", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemsetD2D32_v2", {"hipMemsetD2D32", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemsetD2D32Async", {"hipMemsetD2D32Async", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemsetD2D8", {"hipMemsetD2D8", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemsetD2D8_v2", {"hipMemsetD2D8", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuMemsetD2D8Async", {"hipMemsetD2D8Async", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// cudaMemset
{"cuMemsetD32", {"hipMemsetD32", "", CONV_MEMORY, API_DRIVER}},
{"cuMemsetD32_v2", {"hipMemsetD32", "", CONV_MEMORY, API_DRIVER}},
// cudaMemsetAsync
{"cuMemsetD32Async", {"hipMemsetD32Async", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemsetD8", {"hipMemsetD8", "", CONV_MEMORY, API_DRIVER}},
{"cuMemsetD8_v2", {"hipMemsetD8", "", CONV_MEMORY, API_DRIVER}},
// no analogue
{"cuMemsetD8Async", {"hipMemsetD8Async", "", CONV_MEMORY, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaMallocMipmappedArray due to different signatures
{"cuMipmappedArrayCreate", {"hipMipmappedArrayCreate", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaFreeMipmappedArray due to different signatures
{"cuMipmappedArrayDestroy", {"hipMipmappedArrayDestroy", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGetMipmappedArrayLevel due to different signatures
{"cuMipmappedArrayGetLevel", {"hipMipmappedArrayGetLevel", "", CONV_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// 5.12. Virtual Memory Management
// no analogue
{"cuMemAddressFree", {"hipMemAddressFree", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemAddressReserve", {"hipMemAddressReserve", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemCreate", {"hipMemCreate", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemExportToShareableHandle", {"hipMemExportToShareableHandle", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemGetAccess", {"hipMemGetAccess", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemGetAllocationGranularity", {"hipMemGetAllocationGranularity", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemGetAllocationPropertiesFromHandle", {"hipMemGetAllocationPropertiesFromHandle", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemImportFromShareableHandle", {"hipMemImportFromShareableHandle", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemMap", {"hipMemMap", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemRelease", {"hipMemRelease", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemSetAccess", {"hipMemSetAccess", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuMemUnmap", {"hipMemUnmap", "", CONV_VIRTUAL_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// 5.13. Unified Addressing
// cudaMemAdvise
{"cuMemAdvise", {"hipMemAdvise", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// TODO: double check cudaMemPrefetchAsync
{"cuMemPrefetchAsync", {"hipMemPrefetchAsync_", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// cudaMemRangeGetAttribute
{"cuMemRangeGetAttribute", {"hipMemRangeGetAttribute", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// cudaMemRangeGetAttributes
{"cuMemRangeGetAttributes", {"hipMemRangeGetAttributes", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuPointerGetAttribute", {"hipPointerGetAttribute", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaPointerGetAttributes due to different signatures
{"cuPointerGetAttributes", {"hipPointerGetAttributes_", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuPointerSetAttribute", {"hipPointerSetAttribute", "", CONV_ADDRESSING, API_DRIVER, HIP_UNSUPPORTED}},
// 5.14. Stream Management
// cudaStreamAddCallback
{"cuStreamAddCallback", {"hipStreamAddCallback", "", CONV_STREAM, API_DRIVER}},
// cudaStreamAttachMemAsync
{"cuStreamAttachMemAsync", {"hipStreamAttachMemAsync", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// cudaStreamBeginCapture
{"cuStreamBeginCapture", {"hipStreamBeginCapture", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
{"cuStreamBeginCapture_v2", {"hipStreamBeginCapture", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
{"cuStreamBeginCapture_ptsz", {"hipStreamBeginCapture", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// cudaStreamCreateWithFlags
{"cuStreamCreate", {"hipStreamCreateWithFlags", "", CONV_STREAM, API_DRIVER}},
// cudaStreamCreateWithPriority
{"cuStreamCreateWithPriority", {"hipStreamCreateWithPriority", "", CONV_STREAM, API_DRIVER}},
// cudaStreamDestroy
{"cuStreamDestroy", {"hipStreamDestroy", "", CONV_STREAM, API_DRIVER}},
{"cuStreamDestroy_v2", {"hipStreamDestroy", "", CONV_STREAM, API_DRIVER}},
// cudaStreamEndCapture
{"cuStreamEndCapture", {"hipStreamEndCapture", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// cudaStreamGetCaptureInfo
{"cuStreamGetCaptureInfo", {"hipStreamGetCaptureInfo", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuStreamGetCtx", {"hipStreamGetContext", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// cudaStreamGetFlags
{"cuStreamGetFlags", {"hipStreamGetFlags", "", CONV_STREAM, API_DRIVER}},
// cudaStreamGetPriority
{"cuStreamGetPriority", {"hipStreamGetPriority", "", CONV_STREAM, API_DRIVER}},
// cudaStreamIsCapturing
{"cuStreamIsCapturing", {"hipStreamIsCapturing", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// cudaStreamQuery
{"cuStreamQuery", {"hipStreamQuery", "", CONV_STREAM, API_DRIVER}},
// cudaStreamSynchronize
{"cuStreamSynchronize", {"hipStreamSynchronize", "", CONV_STREAM, API_DRIVER}},
// cudaStreamWaitEvent
{"cuStreamWaitEvent", {"hipStreamWaitEvent", "", CONV_STREAM, API_DRIVER}},
// cudaThreadExchangeStreamCaptureMode
{"cuThreadExchangeStreamCaptureMode", {"hipThreadExchangeStreamCaptureMode", "", CONV_STREAM, API_DRIVER, HIP_UNSUPPORTED}},
// 5.15. Event Management
// cudaEventCreateWithFlags
{"cuEventCreate", {"hipEventCreateWithFlags", "", CONV_EVENT, API_DRIVER}},
// cudaEventDestroy
{"cuEventDestroy", {"hipEventDestroy", "", CONV_EVENT, API_DRIVER}},
{"cuEventDestroy_v2", {"hipEventDestroy", "", CONV_EVENT, API_DRIVER}},
// cudaEventElapsedTime
{"cuEventElapsedTime", {"hipEventElapsedTime", "", CONV_EVENT, API_DRIVER}},
// cudaEventQuery
{"cuEventQuery", {"hipEventQuery", "", CONV_EVENT, API_DRIVER}},
// cudaEventRecord
{"cuEventRecord", {"hipEventRecord", "", CONV_EVENT, API_DRIVER}},
// cudaEventSynchronize
{"cuEventSynchronize", {"hipEventSynchronize", "", CONV_EVENT, API_DRIVER}},
// 5.16. External Resource Interoperability
// cudaDestroyExternalMemory
{"cuDestroyExternalMemory", {"hipDestroyExternalMemory", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaDestroyExternalSemaphore
{"cuDestroyExternalSemaphore", {"hipDestroyExternalSemaphore", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaExternalMemoryGetMappedBuffer
{"cuExternalMemoryGetMappedBuffer", {"hipExternalMemoryGetMappedBuffer", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaExternalMemoryGetMappedMipmappedArray
{"cuExternalMemoryGetMappedMipmappedArray", {"hipExternalMemoryGetMappedMipmappedArray", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaImportExternalMemory
{"cuImportExternalMemory", {"hipImportExternalMemory", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaImportExternalSemaphore
{"cuImportExternalSemaphore", {"hipImportExternalSemaphore", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaSignalExternalSemaphoresAsync
{"cuSignalExternalSemaphoresAsync", {"hipSignalExternalSemaphoresAsync", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// cudaWaitExternalSemaphoresAsync
{"cuWaitExternalSemaphoresAsync", {"hipWaitExternalSemaphoresAsync", "", CONV_EXT_RES, API_DRIVER, HIP_UNSUPPORTED}},
// 5.17. Stream Memory Operations
// no analogues
{"cuStreamBatchMemOp", {"hipStreamBatchMemOp", "", CONV_STREAM_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuStreamWaitValue32", {"hipStreamWaitValue32", "", CONV_STREAM_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuStreamWaitValue64", {"hipStreamWaitValue64", "", CONV_STREAM_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuStreamWriteValue32", {"hipStreamWriteValue32", "", CONV_STREAM_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
{"cuStreamWriteValue64", {"hipStreamWriteValue64", "", CONV_STREAM_MEMORY, API_DRIVER, HIP_UNSUPPORTED}},
// 5.18.Execution Control
// no analogue
{"cuFuncGetAttribute", {"hipFuncGetAttribute", "", CONV_EXECUTION, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaFuncSetAttribute due to different signatures
{"cuFuncSetAttribute", {"hipFuncSetAttribute", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaFuncSetCacheConfig due to different signatures
{"cuFuncSetCacheConfig", {"hipFuncSetCacheConfig", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaFuncSetSharedMemConfig due to different signatures
{"cuFuncSetSharedMemConfig", {"hipFuncSetSharedMemConfig", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaLaunchCooperativeKernel due to different signatures
{"cuLaunchCooperativeKernel", {"hipLaunchCooperativeKernel_", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaLaunchCooperativeKernelMultiDevice due to different signatures
{"cuLaunchCooperativeKernelMultiDevice", {"hipLaunchCooperativeKernelMultiDevice_", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// cudaLaunchHostFunc
{"cuLaunchHostFunc", {"hipLaunchHostFunc", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaLaunchKernel due to different signatures
{"cuLaunchKernel", {"hipModuleLaunchKernel", "", CONV_EXECUTION, API_DRIVER}},
// 5.19.Execution Control [DEPRECATED]
// no analogue
{"cuFuncSetBlockShape", {"hipFuncSetBlockShape", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuFuncSetSharedSize", {"hipFuncSetSharedSize", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaLaunch due to different signatures
{"cuLaunch", {"hipLaunch", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuLaunchGrid", {"hipLaunchGrid", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuLaunchGridAsync", {"hipLaunchGridAsync", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuParamSetf", {"hipParamSetf", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuParamSeti", {"hipParamSeti", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuParamSetSize", {"hipParamSetSize", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuParamSetTexRef", {"hipParamSetTexRef", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuParamSetv", {"hipParamSetv", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}},
// 5.20. Graph Management
// cudaGraphAddChildGraphNode
{"cuGraphAddChildGraphNode", {"hipGraphAddChildGraphNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphAddDependencies
{"cuGraphAddDependencies", {"hipGraphAddDependencies", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphAddEmptyNode
{"cuGraphAddEmptyNode", {"hipGraphAddEmptyNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphAddHostNode
{"cuGraphAddHostNode", {"hipGraphAddHostNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphAddKernelNode
{"cuGraphAddKernelNode", {"hipGraphAddKernelNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphAddMemcpyNode
{"cuGraphAddMemcpyNode", {"hipGraphAddMemcpyNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphAddMemsetNode
{"cuGraphAddMemsetNode", {"hipGraphAddMemsetNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphChildGraphNodeGetGraph
{"cuGraphChildGraphNodeGetGraph", {"hipGraphChildGraphNodeGetGraph", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphClone
{"cuGraphClone", {"hipGraphClone", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphCreate
{"cuGraphCreate", {"hipGraphCreate", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphDestroy
{"cuGraphDestroy", {"hipGraphDestroy", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphDestroyNode
{"cuGraphDestroyNode", {"hipGraphDestroyNode", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphExecDestroy
{"cuGraphExecDestroy", {"hipGraphExecDestroy", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphGetEdges
{"cuGraphGetEdges", {"hipGraphGetEdges", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphGetNodes
{"cuGraphGetNodes", {"hipGraphGetNodes", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphGetRootNodes
{"cuGraphGetRootNodes", {"hipGraphGetRootNodes", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphHostNodeGetParams
{"cuGraphHostNodeGetParams", {"hipGraphHostNodeGetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphHostNodeSetParams
{"cuGraphHostNodeSetParams", {"hipGraphHostNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphInstantiate
{"cuGraphInstantiate", {"hipGraphInstantiate", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphExecKernelNodeSetParams
{"cuGraphExecKernelNodeSetParams", {"hipGraphExecKernelNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphKernelNodeGetParams
{"cuGraphKernelNodeGetParams", {"hipGraphKernelNodeGetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphKernelNodeSetParams
{"cuGraphKernelNodeSetParams", {"hipGraphKernelNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphLaunch
{"cuGraphLaunch", {"hipGraphLaunch", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphMemcpyNodeGetParams
{"cuGraphMemcpyNodeGetParams", {"hipGraphMemcpyNodeGetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphMemcpyNodeSetParams
{"cuGraphMemcpyNodeSetParams", {"hipGraphMemcpyNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphMemsetNodeGetParams
{"cuGraphMemsetNodeGetParams", {"hipGraphMemsetNodeGetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphMemsetNodeSetParams
{"cuGraphMemsetNodeSetParams", {"hipGraphMemsetNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphNodeFindInClone
{"cuGraphNodeFindInClone", {"hipGraphNodeFindInClone", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphNodeGetDependencies
{"cuGraphNodeGetDependencies", {"hipGraphNodeGetDependencies", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphNodeGetDependentNodes
{"cuGraphNodeGetDependentNodes", {"hipGraphNodeGetDependentNodes", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphNodeGetType
{"cuGraphNodeGetType", {"hipGraphNodeGetType", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphRemoveDependencies
{"cuGraphRemoveDependencies", {"hipGraphRemoveDependencies", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphExecMemcpyNodeSetParams
{"cuGraphExecMemcpyNodeSetParams", {"hipGraphExecMemcpyNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphExecMemsetNodeSetParams
{"cuGraphExecMemsetNodeSetParams", {"hipGraphExecMemsetNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphExecHostNodeSetParams
{"cuGraphExecHostNodeSetParams", {"hipGraphExecHostNodeSetParams", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphExecUpdate
{"cuGraphExecUpdate", {"hipGraphExecUpdate", "", CONV_GRAPH, API_DRIVER, HIP_UNSUPPORTED}},
// 5.21. Occupancy
// cudaOccupancyMaxActiveBlocksPerMultiprocessor
{"cuOccupancyMaxActiveBlocksPerMultiprocessor", {"hipDrvOccupancyMaxActiveBlocksPerMultiprocessor", "", CONV_OCCUPANCY, API_DRIVER}},
// cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags
{"cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags", {"hipDrvOccupancyMaxActiveBlocksPerMultiprocessorWithFlags","", CONV_OCCUPANCY, API_DRIVER}},
// cudaOccupancyMaxPotentialBlockSize
{"cuOccupancyMaxPotentialBlockSize", {"hipOccupancyMaxPotentialBlockSize", "", CONV_OCCUPANCY, API_DRIVER}},
// cudaOccupancyMaxPotentialBlockSizeWithFlags
{"cuOccupancyMaxPotentialBlockSizeWithFlags", {"hipOccupancyMaxPotentialBlockSizeWithFlags", "", CONV_OCCUPANCY, API_DRIVER, HIP_UNSUPPORTED}},
// 5.22. Texture Reference Management [DEPRECATED]
// no analogues
{"cuTexRefGetAddress", {"hipTexRefGetAddress", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefGetAddress_v2", {"hipTexRefGetAddress", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefGetAddressMode", {"hipTexRefGetAddressMode", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefGetArray", {"hipTexRefGetArray", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefGetBorderColor", {"hipTexRefGetBorderColor", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetFilterMode", {"hipTexRefGetFilterMode", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetFlags", {"hipTexRefGetFlags", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetFormat", {"hipTexRefGetFormat", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetMaxAnisotropy", {"hipTexRefGetMaxAnisotropy", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetMipmapFilterMode", {"hipTexRefGetMipmapFilterMode", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetMipmapLevelBias", {"hipTexRefGetMipmapLevelBias", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetMipmapLevelClamp", {"hipTexRefGetMipmapLevelClamp", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefGetMipmappedArray", {"hipTexRefGetMipmappedArray", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefSetAddress", {"hipTexRefSetAddress", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetAddress_v2", {"hipTexRefSetAddress", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetAddress2D", {"hipTexRefSetAddress2D", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetAddress2D_v2", {"hipTexRefSetAddress2D", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetAddress2D_v3", {"hipTexRefSetAddress2D", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetAddressMode", {"hipTexRefSetAddressMode", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetArray", {"hipTexRefSetArray", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetBorderColor", {"hipTexRefSetBorderColor", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefSetFilterMode", {"hipTexRefSetFilterMode", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetFlags", {"hipTexRefSetFlags", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetFormat", {"hipTexRefSetFormat", "", CONV_TEXTURE, API_DRIVER}},
{"cuTexRefSetMaxAnisotropy", {"hipTexRefSetMaxAnisotropy", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefSetMipmapFilterMode", {"hipTexRefSetMipmapFilterMode", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefSetMipmapLevelBias", {"hipTexRefSetMipmapLevelBias", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefSetMipmapLevelClamp", {"hipTexRefSetMipmapLevelClamp", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefSetMipmappedArray", {"hipTexRefSetMipmappedArray", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefCreate", {"hipTexRefCreate", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuTexRefDestroy", {"hipTexRefDestroy", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// 5.23. Surface Reference Management [DEPRECATED]
// no analogues
{"cuSurfRefGetArray", {"hipSurfRefGetArray", "", CONV_SURFACE, API_DRIVER, HIP_UNSUPPORTED}},
{"cuSurfRefSetArray", {"hipSurfRefSetArray", "", CONV_SURFACE, API_DRIVER, HIP_UNSUPPORTED}},
// 5.24. Texture Object Management
// no analogue
// NOTE: Not equal to cudaCreateTextureObject due to different signatures
{"cuTexObjectCreate", {"hipTexObjectCreate", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// cudaDestroyTextureObject
{"cuTexObjectDestroy", {"hipTexObjectDestroy", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGetTextureObjectResourceDesc due to different signatures
{"cuTexObjectGetResourceDesc", {"hipTexObjectGetResourceDesc", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGetTextureObjectResourceViewDesc
{"cuTexObjectGetResourceViewDesc", {"hipTexObjectGetResourceViewDesc", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGetTextureObjectTextureDesc due to different signatures
{"cuTexObjectGetTextureDesc", {"hipTexObjectGetTextureDesc", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// 5.25. Surface Object Management
// no analogue
// NOTE: Not equal to cudaCreateSurfaceObject due to different signatures
{"cuSurfObjectCreate", {"hipSurfObjectCreate", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// cudaDestroySurfaceObject
{"cuSurfObjectDestroy", {"hipSurfObjectDestroy", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGetSurfaceObjectResourceDesc due to different signatures
{"cuSurfObjectGetResourceDesc", {"hipSurfObjectGetResourceDesc", "", CONV_TEXTURE, API_DRIVER, HIP_UNSUPPORTED}},
// 5.26. Peer Context Memory Access
// no analogue
// NOTE: Not equal to cudaDeviceEnablePeerAccess due to different signatures
{"cuCtxEnablePeerAccess", {"hipCtxEnablePeerAccess", "", CONV_PEER, API_DRIVER}},
// no analogue
// NOTE: Not equal to cudaDeviceDisablePeerAccess due to different signatures
{"cuCtxDisablePeerAccess", {"hipCtxDisablePeerAccess", "", CONV_PEER, API_DRIVER}},
// cudaDeviceCanAccessPeer
{"cuDeviceCanAccessPeer", {"hipDeviceCanAccessPeer", "", CONV_PEER, API_DRIVER}},
// cudaDeviceGetP2PAttribute
{"cuDeviceGetP2PAttribute", {"hipDeviceGetP2PAttribute", "", CONV_PEER, API_DRIVER, HIP_UNSUPPORTED}},
// 5.27. Graphics Interoperability
// cudaGraphicsMapResources
{"cuGraphicsMapResources", {"hipGraphicsMapResources", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsResourceGetMappedMipmappedArray
{"cuGraphicsResourceGetMappedMipmappedArray", {"hipGraphicsResourceGetMappedMipmappedArray", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsResourceGetMappedPointer
{"cuGraphicsResourceGetMappedPointer", {"hipGraphicsResourceGetMappedPointer", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsResourceGetMappedPointer
{"cuGraphicsResourceGetMappedPointer_v2", {"hipGraphicsResourceGetMappedPointer", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsResourceSetMapFlags
{"cuGraphicsResourceSetMapFlags", {"hipGraphicsResourceSetMapFlags", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsResourceSetMapFlags
{"cuGraphicsResourceSetMapFlags_v2", {"hipGraphicsResourceSetMapFlags", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsSubResourceGetMappedArray
{"cuGraphicsSubResourceGetMappedArray", {"hipGraphicsSubResourceGetMappedArray", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsUnmapResources
{"cuGraphicsUnmapResources", {"hipGraphicsUnmapResources", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsUnregisterResource
{"cuGraphicsUnregisterResource", {"hipGraphicsUnregisterResource", "", CONV_GRAPHICS, API_DRIVER, HIP_UNSUPPORTED}},
// 5.28. Profiler Control
// cudaProfilerInitialize
{"cuProfilerInitialize", {"hipProfilerInitialize", "", CONV_PROFILER, API_DRIVER, HIP_UNSUPPORTED}},
// cudaProfilerStart
{"cuProfilerStart", {"hipProfilerStart", "", CONV_PROFILER, API_DRIVER}},
// cudaProfilerStop
{"cuProfilerStop", {"hipProfilerStop", "", CONV_PROFILER, API_DRIVER}},
// 5.29. OpenGL Interoperability
// cudaGLGetDevices
{"cuGLGetDevices", {"hipGLGetDevices", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsGLRegisterBuffer
{"cuGraphicsGLRegisterBuffer", {"hipGraphicsGLRegisterBuffer", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsGLRegisterImage
{"cuGraphicsGLRegisterImage", {"hipGraphicsGLRegisterImage", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaWGLGetDevice
{"cuWGLGetDevice", {"hipWGLGetDevice", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// 5.29. OpenGL Interoperability [DEPRECATED]
// no analogue
{"cuGLCtxCreate", {"hipGLCtxCreate", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuGLInit", {"hipGLInit", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGLMapBufferObject due to different signatures
{"cuGLMapBufferObject", {"hipGLMapBufferObject_", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGLMapBufferObjectAsync due to different signatures
{"cuGLMapBufferObjectAsync", {"hipGLMapBufferObjectAsync_", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGLRegisterBufferObject
{"cuGLRegisterBufferObject", {"hipGLRegisterBufferObject", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGLSetBufferObjectMapFlags
{"cuGLSetBufferObjectMapFlags", {"hipGLSetBufferObjectMapFlags", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGLUnmapBufferObject
{"cuGLUnmapBufferObject", {"hipGLUnmapBufferObject", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGLUnmapBufferObjectAsync
{"cuGLUnmapBufferObjectAsync", {"hipGLUnmapBufferObjectAsync", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGLUnregisterBufferObject
{"cuGLUnregisterBufferObject", {"hipGLUnregisterBufferObject", "", CONV_OPENGL, API_DRIVER, HIP_UNSUPPORTED}},
// 5.30.Direct3D 9 Interoperability
// no analogue
{"cuD3D9CtxCreate", {"hipD3D9CtxCreate", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuD3D9CtxCreateOnDevice", {"hipD3D9CtxCreateOnDevice", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9GetDevice
{"cuD3D9GetDevice", {"hipD3D9GetDevice", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9GetDevices
{"cuD3D9GetDevices", {"hipD3D9GetDevices", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9GetDirect3DDevice
{"cuD3D9GetDirect3DDevice", {"hipD3D9GetDirect3DDevice", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsD3D9RegisterResource
{"cuGraphicsD3D9RegisterResource", {"hipGraphicsD3D9RegisterResource", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// 5.30.Direct3D 9 Interoperability [DEPRECATED]
// cudaD3D9MapResources
{"cuD3D9MapResources", {"hipD3D9MapResources", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9RegisterResource
{"cuD3D9RegisterResource", {"hipD3D9RegisterResource", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9ResourceGetMappedArray
{"cuD3D9ResourceGetMappedArray", {"hipD3D9ResourceGetMappedArray", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9ResourceGetMappedPitch
{"cuD3D9ResourceGetMappedPitch", {"hipD3D9ResourceGetMappedPitch", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9ResourceGetMappedPointer
{"cuD3D9ResourceGetMappedPointer", {"hipD3D9ResourceGetMappedPointer", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9ResourceGetMappedSize
{"cuD3D9ResourceGetMappedSize", {"hipD3D9ResourceGetMappedSize", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9ResourceGetSurfaceDimensions
{"cuD3D9ResourceGetSurfaceDimensions", {"hipD3D9ResourceGetSurfaceDimensions", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9ResourceSetMapFlags
{"cuD3D9ResourceSetMapFlags", {"hipD3D9ResourceSetMapFlags", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9UnmapResources
{"cuD3D9UnmapResources", {"hipD3D9UnmapResources", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D9UnregisterResource
{"cuD3D9UnregisterResource", {"hipD3D9UnregisterResource", "", CONV_D3D9, API_DRIVER, HIP_UNSUPPORTED}},
// 5.31. Direct3D 10 Interoperability
// cudaD3D10GetDevice
{"cuD3D10GetDevice", {"hipD3D10GetDevice", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10GetDevices
{"cuD3D10GetDevices", {"hipD3D10GetDevices", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsD3D10RegisterResource
{"cuGraphicsD3D10RegisterResource", {"hipGraphicsD3D10RegisterResource", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// 5.31. Direct3D 10 Interoperability [DEPRECATED]
// no analogue
{"cuD3D10CtxCreate", {"hipD3D10CtxCreate", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuD3D10CtxCreateOnDevice", {"hipD3D10CtxCreateOnDevice", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10GetDirect3DDevice
{"cuD3D10GetDirect3DDevice", {"hipD3D10GetDirect3DDevice", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10MapResources
{"cuD3D10MapResources", {"hipD3D10MapResources", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10RegisterResource
{"cuD3D10RegisterResource", {"hipD3D10RegisterResource", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10ResourceGetMappedArray
{"cuD3D10ResourceGetMappedArray", {"hipD3D10ResourceGetMappedArray", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10ResourceGetMappedPitch
{"cuD3D10ResourceGetMappedPitch", {"hipD3D10ResourceGetMappedPitch", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10ResourceGetMappedPointer
{"cuD3D10ResourceGetMappedPointer", {"hipD3D10ResourceGetMappedPointer", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10ResourceGetMappedSize
{"cuD3D10ResourceGetMappedSize", {"hipD3D10ResourceGetMappedSize", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10ResourceGetSurfaceDimensions
{"cuD3D10ResourceGetSurfaceDimensions", {"hipD3D10ResourceGetSurfaceDimensions", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10ResourceSetMapFlags
{"cuD310ResourceSetMapFlags", {"hipD3D10ResourceSetMapFlags", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10UnmapResources
{"cuD3D10UnmapResources", {"hipD3D10UnmapResources", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D10UnregisterResource
{"cuD3D10UnregisterResource", {"hipD3D10UnregisterResource", "", CONV_D3D10, API_DRIVER, HIP_UNSUPPORTED}},
// 5.32. Direct3D 11 Interoperability
// cudaD3D11GetDevice
{"cuD3D11GetDevice", {"hipD3D11GetDevice", "", CONV_D3D11, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D11GetDevices
{"cuD3D11GetDevices", {"hipD3D11GetDevices", "", CONV_D3D11, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsD3D11RegisterResource
{"cuGraphicsD3D11RegisterResource", {"hipGraphicsD3D11RegisterResource", "", CONV_D3D11, API_DRIVER, HIP_UNSUPPORTED}},
// 5.32. Direct3D 11 Interoperability [DEPRECATED]
// no analogue
{"cuD3D11CtxCreate", {"hipD3D11CtxCreate", "", CONV_D3D11, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuD3D11CtxCreateOnDevice", {"hipD3D11CtxCreateOnDevice", "", CONV_D3D11, API_DRIVER, HIP_UNSUPPORTED}},
// cudaD3D11GetDirect3DDevice
{"cuD3D11GetDirect3DDevice", {"hipD3D11GetDirect3DDevice", "", CONV_D3D11, API_DRIVER, HIP_UNSUPPORTED}},
// 5.33. VDPAU Interoperability
// cudaGraphicsVDPAURegisterOutputSurface
{"cuGraphicsVDPAURegisterOutputSurface", {"hipGraphicsVDPAURegisterOutputSurface", "", CONV_VDPAU, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsVDPAURegisterVideoSurface
{"cuGraphicsVDPAURegisterVideoSurface", {"hipGraphicsVDPAURegisterVideoSurface", "", CONV_VDPAU, API_DRIVER, HIP_UNSUPPORTED}},
// cudaVDPAUGetDevice
{"cuVDPAUGetDevice", {"hipVDPAUGetDevice", "", CONV_VDPAU, API_DRIVER, HIP_UNSUPPORTED}},
// no analogue
{"cuVDPAUCtxCreate", {"hipVDPAUCtxCreate", "", CONV_VDPAU, API_DRIVER, HIP_UNSUPPORTED}},
// 5.34. EGL Interoperability
// cudaEGLStreamConsumerAcquireFrame
{"cuEGLStreamConsumerAcquireFrame", {"hipEGLStreamConsumerAcquireFrame", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamConsumerConnect
{"cuEGLStreamConsumerConnect", {"hipEGLStreamConsumerConnect", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamConsumerConnectWithFlags
{"cuEGLStreamConsumerConnectWithFlags", {"hipEGLStreamConsumerConnectWithFlags", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamConsumerDisconnect
{"cuEGLStreamConsumerDisconnect", {"hipEGLStreamConsumerDisconnect", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamConsumerReleaseFrame
{"cuEGLStreamConsumerReleaseFrame", {"hipEGLStreamConsumerReleaseFrame", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamProducerConnect
{"cuEGLStreamProducerConnect", {"hipEGLStreamProducerConnect", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamProducerDisconnect
{"cuEGLStreamProducerDisconnect", {"hipEGLStreamProducerDisconnect", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamProducerPresentFrame
{"cuEGLStreamProducerPresentFrame", {"hipEGLStreamProducerPresentFrame", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEGLStreamProducerReturnFrame
{"cuEGLStreamProducerReturnFrame", {"hipEGLStreamProducerReturnFrame", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsEGLRegisterImage
{"cuGraphicsEGLRegisterImage", {"hipGraphicsEGLRegisterImage", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaGraphicsResourceGetMappedEglFrame
{"cuGraphicsResourceGetMappedEglFrame", {"hipGraphicsResourceGetMappedEglFrame", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
// cudaEventCreateFromEGLSync
{"cuEventCreateFromEGLSync", {"hipEventCreateFromEGLSync", "", CONV_EGL, API_DRIVER, HIP_UNSUPPORTED}},
};
File diff suppressed because it is too large Load Diff
@@ -1,59 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_FFT_FUNCTION_MAP{
{"cufftPlan1d", {"hipfftPlan1d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftPlan2d", {"hipfftPlan2d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftPlan3d", {"hipfftPlan3d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftPlanMany", {"hipfftPlanMany", "", CONV_LIB_FUNC, API_FFT}},
{"cufftMakePlan1d", {"hipfftMakePlan1d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftMakePlan2d", {"hipfftMakePlan2d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftMakePlan3d", {"hipfftMakePlan3d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftMakePlanMany", {"hipfftMakePlanMany", "", CONV_LIB_FUNC, API_FFT}},
{"cufftMakePlanMany64", {"hipfftMakePlanMany64", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetSizeMany64", {"hipfftGetSizeMany64", "", CONV_LIB_FUNC, API_FFT}},
{"cufftEstimate1d", {"hipfftEstimate1d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftEstimate2d", {"hipfftEstimate2d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftEstimate3d", {"hipfftEstimate3d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftEstimateMany", {"hipfftEstimateMany", "", CONV_LIB_FUNC, API_FFT}},
{"cufftCreate", {"hipfftCreate", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetSize1d", {"hipfftGetSize1d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetSize2d", {"hipfftGetSize2d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetSize3d", {"hipfftGetSize3d", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetSizeMany", {"hipfftGetSizeMany", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetSize", {"hipfftGetSize", "", CONV_LIB_FUNC, API_FFT}},
{"cufftSetWorkArea", {"hipfftSetWorkArea", "", CONV_LIB_FUNC, API_FFT}},
{"cufftSetAutoAllocation", {"hipfftSetAutoAllocation", "", CONV_LIB_FUNC, API_FFT}},
{"cufftExecC2C", {"hipfftExecC2C", "", CONV_LIB_FUNC, API_FFT}},
{"cufftExecR2C", {"hipfftExecR2C", "", CONV_LIB_FUNC, API_FFT}},
{"cufftExecC2R", {"hipfftExecC2R", "", CONV_LIB_FUNC, API_FFT}},
{"cufftExecZ2Z", {"hipfftExecZ2Z", "", CONV_LIB_FUNC, API_FFT}},
{"cufftExecD2Z", {"hipfftExecD2Z", "", CONV_LIB_FUNC, API_FFT}},
{"cufftExecZ2D", {"hipfftExecZ2D", "", CONV_LIB_FUNC, API_FFT}},
{"cufftSetStream", {"hipfftSetStream", "", CONV_LIB_FUNC, API_FFT}},
{"cufftDestroy", {"hipfftDestroy", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetVersion", {"hipfftGetVersion", "", CONV_LIB_FUNC, API_FFT}},
{"cufftGetProperty", {"hipfftGetProperty", "", CONV_LIB_FUNC, API_FFT, HIP_UNSUPPORTED}},
};
@@ -1,71 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_FFT_TYPE_NAME_MAP{
// cuFFT defines
{"CUFFT_FORWARD", {"HIPFFT_FORWARD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // -1
{"CUFFT_INVERSE", {"HIPFFT_BACKWARD", "", CONV_NUMERIC_LITERAL, API_DNN}}, // 1
{"CUFFT_COMPATIBILITY_DEFAULT", {"HIPFFT_COMPATIBILITY_DEFAULT", "", CONV_NUMERIC_LITERAL, API_DNN, HIP_UNSUPPORTED}}, // CUFFT_COMPATIBILITY_FFTW_PADDING
// cuFFT enums
{"cufftResult_t", {"hipfftResult_t", "", CONV_TYPE, API_FFT}},
{"cufftResult", {"hipfftResult", "", CONV_TYPE, API_FFT}},
{"CUFFT_SUCCESS", {"HIPFFT_SUCCESS", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x0 0
{"CUFFT_INVALID_PLAN", {"HIPFFT_INVALID_PLAN", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x1 1
{"CUFFT_ALLOC_FAILED", {"HIPFFT_ALLOC_FAILED", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x2 2
{"CUFFT_INVALID_TYPE", {"HIPFFT_INVALID_TYPE", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x3 3
{"CUFFT_INVALID_VALUE", {"HIPFFT_INVALID_VALUE", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x4 4
{"CUFFT_INTERNAL_ERROR", {"HIPFFT_INTERNAL_ERROR", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x5 5
{"CUFFT_EXEC_FAILED", {"HIPFFT_EXEC_FAILED", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x6 6
{"CUFFT_SETUP_FAILED", {"HIPFFT_SETUP_FAILED", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x7 7
{"CUFFT_INVALID_SIZE", {"HIPFFT_INVALID_SIZE", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x8 8
{"CUFFT_UNALIGNED_DATA", {"HIPFFT_UNALIGNED_DATA", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x9 9
{"CUFFT_INCOMPLETE_PARAMETER_LIST", {"HIPFFT_INCOMPLETE_PARAMETER_LIST", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0xA 10
{"CUFFT_INVALID_DEVICE", {"HIPFFT_INVALID_DEVICE", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0xB 11
{"CUFFT_PARSE_ERROR", {"HIPFFT_PARSE_ERROR", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0xC 12
{"CUFFT_NO_WORKSPACE", {"HIPFFT_NO_WORKSPACE", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0xD 13
{"CUFFT_NOT_IMPLEMENTED", {"HIPFFT_NOT_IMPLEMENTED", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0xE 14
{"CUFFT_LICENSE_ERROR", {"HIPFFT_LICENSE_ERROR", "", CONV_NUMERIC_LITERAL, API_FFT, HIP_UNSUPPORTED}},
{"CUFFT_NOT_SUPPORTED", {"HIPFFT_NOT_SUPPORTED", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x10 16
{"cufftType_t", {"hipfftType_t", "", CONV_TYPE, API_FFT}},
{"cufftType", {"hipfftType", "", CONV_TYPE, API_FFT}},
{"CUFFT_R2C", {"HIPFFT_R2C", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x2a
{"CUFFT_C2R", {"HIPFFT_C2R", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x2c
{"CUFFT_C2C", {"HIPFFT_C2C", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x29
{"CUFFT_D2Z", {"HIPFFT_D2Z", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x6a
{"CUFFT_Z2D", {"HIPFFT_Z2D", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x6c
{"CUFFT_Z2Z", {"HIPFFT_Z2Z", "", CONV_NUMERIC_LITERAL, API_FFT}}, // 0x69
{"cufftCompatibility_t", {"hipfftCompatibility_t", "", CONV_TYPE, API_FFT, HIP_UNSUPPORTED}},
{"cufftCompatibility", {"hipfftCompatibility", "", CONV_TYPE, API_FFT, HIP_UNSUPPORTED}},
{"CUFFT_COMPATIBILITY_FFTW_PADDING", {"HIPFFT_COMPATIBILITY_FFTW_PADDING", "", CONV_NUMERIC_LITERAL, API_FFT, HIP_UNSUPPORTED}}, // 0x01
// cuFFT types
{"cufftReal", {"hipfftReal", "", CONV_TYPE, API_FFT}},
{"cufftDoubleReal", {"hipfftDoubleReal", "", CONV_TYPE, API_FFT}},
{"cufftComplex", {"hipfftComplex", "", CONV_TYPE, API_FFT}},
{"cufftDoubleComplex", {"hipfftDoubleComplex", "", CONV_TYPE, API_FFT}},
{"cufftHandle", {"hipfftHandle", "", CONV_TYPE, API_FFT}},
};
@@ -1,488 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <sstream>
#include <regex>
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Path.h"
#include "CUDA2HIP.h"
#include "CUDA2HIP_Scripting.h"
#include "ArgParse.h"
#include "StringUtils.h"
#include "LLVMCompat.h"
#include "Statistics.h"
namespace perl {
using namespace std;
using namespace llvm;
const string sCopyright =
"##\n"
"# Copyright (c) 2015-present Advanced Micro Devices, Inc. All rights reserved.\n"
"#\n"
"# Permission is hereby granted, free of charge, to any person obtaining a copy\n"
"# of this software and associated documentation files (the \"Software\"), to deal\n"
"# in the Software without restriction, including without limitation the rights\n"
"# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n"
"# copies of the Software, and to permit persons to whom the Software is\n"
"# furnished to do so, subject to the following conditions:\n"
"#\n"
"# The above copyright notice and this permission notice shall be included in\n"
"# all copies or substantial portions of the Software.\n"
"#\n"
"# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n"
"# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n"
"# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n"
"# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n"
"# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n"
"# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n"
"# THE SOFTWARE.\n"
"##\n";
const string sImportant = "# IMPORTANT: Do not change this file manually: it is generated by hipify-clang --perl";
const string tab = " ";
const string tab_2 = tab + tab;
const string tab_3 = tab_2 + tab;
const string tab_4 = tab_3 + tab;
const string tab_5 = tab_4 + tab;
const string tab_6 = tab_5 + tab;
const string endl_2 = "\n\n";
const string endl_tab = "\n" + tab;
const string endl_tab_2 = "\n" + tab_2;
const string endl_tab_3 = "\n" + tab_3;
const string endl_tab_4 = "\n" + tab_4;
const string endl_tab_5 = "\n" + tab_5;
const string sub = "sub ";
const string my = "my ";
const string my_k = my + "$k = 0;";
const string return_0 = "return 0;\n";
const string return_k = "return $k;\n";
const string while_ = "while ";
const string unless_ = "unless ";
const string foreach = "foreach ";
const string foreach_func = foreach + "$func (\n";
const string print = "print STDERR ";
const string printf = "printf STDERR ";
const string no_warns = "no warnings qw/uninitialized/;";
const string hipify_perl = "hipify-perl";
const string sCudaDevice = "cudaDevice";
const string sCudaDeviceId = "cudaDeviceId";
const string sCudaDevices = "cudaDevices";
const string sCudaDevice_t = "cudaDevice_t";
const string sCudaIDs = "cudaIDs";
const string sCudaGridDim = "cudaGridDim";
const string sCudaDimGrid = "cudaDimGrid";
const string sCudaDimBlock = "cudaDimBlock";
const string sCudaGradInput = "cudaGradInput";
const string sCudaGradOutput = "cudaGradOutput";
const string sCudaInput = "cudaInput";
const string sCudaOutput = "cudaOutput";
const string sCudaIndices = "cudaIndices";
const string sCudaGaugeField = "cudaGaugeField";
const string sCudaMom = "cudaMom";
const string sCudaGauge = "cudaGauge";
const string sCudaInGauge = "cudaInGauge";
const string sCudaColorSpinorField = "cudaColorSpinorField";
const string sCudaSiteLink = "cudaSiteLink";
const string sCudaFatLink = "cudaFatLink";
const string sCudaStaple = "cudaStaple";
const string sCudaCloverField = "cudaCloverField";
const string sCudaParam = "cudaParam";
const set<string> Whitelist{
{sCudaDevice}, {sCudaDevice_t}, {sCudaIDs}, {sCudaGridDim}, {sCudaDimGrid}, {sCudaDimBlock}, {sCudaDeviceId}, {sCudaDevices},
{sCudaGradInput}, {sCudaGradOutput}, {sCudaInput}, {sCudaOutput}, {sCudaIndices}, {sCudaGaugeField}, {sCudaMom}, {sCudaGauge},
{sCudaInGauge}, {sCudaColorSpinorField}, {sCudaSiteLink}, {sCudaFatLink}, {sCudaStaple}, {sCudaCloverField}, {sCudaParam}
};
void generateHeader(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << "#!/usr/bin/perl -w" << endl_2;
*streamPtr.get() << sCopyright << endl;
*streamPtr.get() << sImportant << endl_2;
*streamPtr.get() << "#usage " << hipify_perl << " [OPTIONS] INPUT_FILE" << endl_2;
*streamPtr.get() << "use Getopt::Long;" << endl;
*streamPtr.get() << my << "$whitelist = \"\";" << endl;
*streamPtr.get() << my << "$fileName = \"\";" << endl;
*streamPtr.get() << my << "%ft;" << endl;
*streamPtr.get() << my << "%Tkernels;" << endl_2;
*streamPtr.get() << "GetOptions(" << endl;
*streamPtr.get() << tab << " \"examine\" => \\$examine # Combines -no-output and -print-stats options." << endl;
*streamPtr.get() << tab << ", \"inplace\" => \\$inplace # Modify input file inplace, replacing input with hipified output, save backup in .prehip file." << endl;
*streamPtr.get() << tab << ", \"no-output\" => \\$no_output # Don't write any translated output to stdout." << endl;
*streamPtr.get() << tab << ", \"print-stats\" => \\$print_stats # Print translation statistics." << endl;
*streamPtr.get() << tab << ", \"quiet-warnings\" => \\$quiet_warnings # Don't print warnings on unknown CUDA functions." << endl;
*streamPtr.get() << tab << ", \"whitelist=s\" => \\$whitelist # TODO: test it beforehand" << endl;
*streamPtr.get() << ");" << endl_2;
*streamPtr.get() << "$print_stats = 1 if $examine;" << endl;
*streamPtr.get() << "$no_output = 1 if $examine;" << endl_2;
*streamPtr.get() << "# Whitelist of cuda[A-Z] identifiers, which are commonly used in CUDA sources but don't map to any CUDA API:" << endl;
*streamPtr.get() << "@whitelist = (";
unsigned int num = 0;
for (const string &m : Whitelist) {
*streamPtr.get() << endl_tab << (num ? ", " : " ") << "\"" << m << "\"";
++num;
}
*streamPtr.get() << endl << ");" << endl_2;
*streamPtr.get() << "push(@whitelist, split(',', $whitelist));" << endl_2;
}
void generateStatFunctions(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << endl << sub << "totalStats" << " {" << endl;
*streamPtr.get() << tab << my << "%count = %{ shift() };" << endl;
*streamPtr.get() << tab << my << "$total = 0;" << endl;
*streamPtr.get() << tab << foreach << "$key (keys %count) {" << endl;
*streamPtr.get() << tab_2 << "$total += $count{$key};" << endl_tab << "}" << endl;
*streamPtr.get() << tab << "return $total;" << endl << "};" << endl;
*streamPtr.get() << endl << sub << "printStats" << " {" << endl;
*streamPtr.get() << tab << my << "$label = shift();" << endl;
*streamPtr.get() << tab << my << "@statNames = @{ shift() };" << endl;
*streamPtr.get() << tab << my << "%counts = %{ shift() };" << endl;
*streamPtr.get() << tab << my << "$warnings = shift();" << endl;
*streamPtr.get() << tab << my << "$loc = shift();" << endl;
*streamPtr.get() << tab << my << "$total = totalStats(\\%counts);" << endl;
*streamPtr.get() << tab << printf << "\"%s %d CUDA->HIP refs ( \", $label, $total;" << endl;
*streamPtr.get() << tab << foreach << "$stat (@statNames) {" << endl;
*streamPtr.get() << tab_2 << printf << "\"%s:%d \", $stat, $counts{$stat};" << endl_tab << "}" << endl;
*streamPtr.get() << tab << printf << "\")\\n warn:%d LOC:%d\", $warnings, $loc;" << endl << "}" << endl;
for (int i = 0; i < 2; ++i) {
*streamPtr.get() << endl << sub << (i ? "clearStats" : "addStats") << " {" << endl;
*streamPtr.get() << tab << my << "$dest_ref = shift();" << endl;
*streamPtr.get() << tab << my << (i ? "@statNames = @{ shift() };" : "%adder = %{ shift() };") << endl;
*streamPtr.get() << tab << foreach << (i ? "$stat(@statNames)" : "$key (keys %adder)") << " {" << endl;
*streamPtr.get() << tab_2 << "$dest_ref->" << (i ? "{$stat} = 0;" : "{$key} += $adder{$key};") << endl_tab << "}" << endl << "}" << endl;
}
}
void generateSimpleSubstitutions(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << endl << sub << "simpleSubstitutions" << " {" << endl;
for (int i = 0; i < NUM_CONV_TYPES; ++i) {
if (i == CONV_INCLUDE_CUDA_MAIN_H || i == CONV_INCLUDE) {
for (auto &ma : CUDA_INCLUDE_MAP) {
if (Statistics::isUnsupported(ma.second)) continue;
if (i == ma.second.type) {
string sCUDA = ma.first.str();
string sHIP = ma.second.hipName.str();
sCUDA = regex_replace(sCUDA, regex("/"), "\\/");
sHIP = regex_replace(sHIP, regex("/"), "\\/");
*streamPtr.get() << tab << "$ft{'" << counterNames[ma.second.type] << "'} += s/\\b" << sCUDA << "\\b/" << sHIP << "/g;" << endl;
}
}
} else {
for (auto &ma : CUDA_RENAMES_MAP()) {
if (Statistics::isUnsupported(ma.second)) continue;
if (i == ma.second.type) {
*streamPtr.get() << tab << "$ft{'" << counterNames[ma.second.type] << "'} += s/\\b" << ma.first.str() << "\\b/" << ma.second.hipName.str() << "/g;" << endl;
}
}
}
}
*streamPtr.get() << "}" << endl;
}
void generateExternShared(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << endl << "# CUDA extern __shared__ syntax replace with HIP_DYNAMIC_SHARED() macro" << endl;
*streamPtr.get() << sub << "transformExternShared" << " {" << endl;
*streamPtr.get() << tab << no_warns << endl;
*streamPtr.get() << tab << my_k << endl;
*streamPtr.get() << tab << "$k += s/extern\\s+([\\w\\(\\)]+)?\\s*__shared__\\s+([\\w:<>\\s]+)\\s+(\\w+)\\s*\\[\\s*\\]\\s*;/HIP_DYNAMIC_SHARED($1 $2, $3)/g;" << endl;
*streamPtr.get() << tab << "$ft{'extern_shared'} += $k;" << endl << "}" << endl;
}
void generateKernelLaunch(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << endl << "# CUDA Kernel Launch Syntax" << endl << sub << "transformKernelLaunch" << " {" << endl;
*streamPtr.get() << tab << no_warns << endl;
*streamPtr.get() << tab << my_k << endl_2;
string s_k = "$k += s/([:|\\w]+)\\s*";
*streamPtr.get() << tab << "# Handle the kern<...><<<Dg, Db, Ns, S>>>() syntax with empty args:" << endl;
*streamPtr.get() << tab << s_k << "<(.+)>\\s*<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\((\\s*)\\)/hipLaunchKernelGGL(HIP_KERNEL_NAME($1<$2>), dim3($3), dim3($4), $5, $6)/g;" << endl;
*streamPtr.get() << tab << "# Handle the kern<<<Dg, Db, Ns, S>>>() syntax with empty args:" << endl;
*streamPtr.get() << tab << s_k << "<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\((\\s*)\\)/hipLaunchKernelGGL($1, dim3($2), dim3($3), $4, $5)/g;" << endl_2;
*streamPtr.get() << tab << "# Handle the kern<...><<<Dg, Db, Ns, S>>>(...) syntax with non-empty args:" << endl;
*streamPtr.get() << tab << s_k << "<(.+)>\\s*<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\(/hipLaunchKernelGGL(HIP_KERNEL_NAME($1<$2>), dim3($3), dim3($4), $5, $6, /g;" << endl;
*streamPtr.get() << tab << "# Handle the kern<<<Dg, Db, Ns, S>>>(...) syntax with non-empty args:" << endl;
*streamPtr.get() << tab << s_k << "<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\(/hipLaunchKernelGGL($1, dim3($2), dim3($3), $4, $5, /g;" << endl_2;
*streamPtr.get() << tab << "# Handle the kern<...><<<Dg, Db, Ns>>>() syntax with empty args:" << endl;
*streamPtr.get() << tab << s_k << "<(.+)>\\s*<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\((\\s*)\\)/hipLaunchKernelGGL(HIP_KERNEL_NAME($1<$2>), dim3($3), dim3($4), $5, 0)/g;" << endl;
*streamPtr.get() << tab << "# Handle the kern<<<Dg, Db, Ns>>>() syntax with empty args:" << endl;
*streamPtr.get() << tab << s_k << "<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\((\\s*)\\)/hipLaunchKernelGGL($1, dim3($2), dim3($3), $4, 0)/g;" << endl_2;
*streamPtr.get() << tab << "# Handle the kern<...><<Dg, Db, Ns>>>(...) syntax with non-empty args:" << endl;
*streamPtr.get() << tab << s_k << "<(.+)>\\s*<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\(/hipLaunchKernelGGL(HIP_KERNEL_NAME($1<$2>), dim3($3), dim3($4), $5, 0, /g;" << endl;
*streamPtr.get() << tab << "# Handle the kern<<<Dg, Db, Ns>>>(...) syntax with non-empty args:" << endl;
*streamPtr.get() << tab << s_k << "<<<\\s*(.+)\\s*,\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\(/hipLaunchKernelGGL($1, dim3($2), dim3($3), $4, 0, /g;" << endl_2;
*streamPtr.get() << tab << "# Handle the kern<...><<<Dg, Db>>>() syntax with empty args:" << endl;
*streamPtr.get() << tab << s_k << "<(.+)>\\s*<<<\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\((\\s*)\\)/hipLaunchKernelGGL(HIP_KERNEL_NAME($1<$2>), dim3($3), dim3($4), 0, 0)/g;" << endl;
*streamPtr.get() << tab << "# Handle the kern<<<Dg, Db>>>() syntax with empty args:" << endl;
*streamPtr.get() << tab << s_k << "<<<\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\((\\s*)\\)/hipLaunchKernelGGL($1, dim3($2), dim3($3), 0, 0)/g;" << endl_2;
*streamPtr.get() << tab << "# Handle the kern<...><<<Dg, Db>>>(...) syntax with non-empty args:" << endl;
*streamPtr.get() << tab << s_k << "<(.+)>\\s*<<<\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\(/hipLaunchKernelGGL(HIP_KERNEL_NAME($1<$2>), dim3($3), dim3($4), 0, 0, /g;" << endl;
*streamPtr.get() << tab << "# Handle the kern<<<Dg, Db>>>(...) syntax with non-empty args:" << endl;
*streamPtr.get() << tab << s_k << "<<<\\s*(.+)\\s*,\\s*(.+)\\s*>>>(\\s*)\\(/hipLaunchKernelGGL($1, dim3($2), dim3($3), 0, 0, /g;" << endl_2;
*streamPtr.get() << tab << "if ($k) {" << endl;
*streamPtr.get() << tab_2 << "$ft{'kernel_launch'} += $k;" << endl;
*streamPtr.get() << tab_2 << "$Tkernels{$1}++;" << endl_tab << "}" << endl << "}" << endl;
}
void generateCubNamespace(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << endl << sub << "transformCubNamespace" << " {" << endl_tab << my_k << endl;
*streamPtr.get() << tab << "$k += s/using\\s*namespace\\s*cub/using namespace hipcub/g;" << endl;
*streamPtr.get() << tab << "$k += s/\\bcub::\\b/hipcub::/g;" << endl << tab << return_k << "}" << endl;
}
void generateHostFunctions(unique_ptr<ostream> &streamPtr) {
*streamPtr.get() << endl << sub << "transformHostFunctions" << " {" << endl_tab << my_k << endl;
set<string> &funcSet = DeviceSymbolFunctions0;
const string s0 = "$k += s/(?<!\\/\\/ CHECK: )($func)\\s*\\(\\s*([^,]+)\\s*,/$func\\(";
const string s1 = "$k += s/(?<!\\/\\/ CHECK: )($func)\\s*\\(\\s*([^,]+)\\s*,\\s*([^,\\)]+)\\s*(,\\s*|\\))\\s*/$func\\($2, ";
for (int i = 0; i < 4; ++i) {
*streamPtr.get() << tab + foreach_func;
switch (i) {
case 1: funcSet = DeviceSymbolFunctions1; break;
case 2: funcSet = ReinterpretFunctions0; break;
case 3: funcSet = ReinterpretFunctions1; break;
default: funcSet = DeviceSymbolFunctions0;
}
unsigned int count = 0;
for (auto &f : funcSet) {
const auto found = CUDA_RUNTIME_FUNCTION_MAP.find(f);
if (found != CUDA_RUNTIME_FUNCTION_MAP.end()) {
*streamPtr.get() << (count ? ",\n" : "") << tab_2 << "\"" << found->second.hipName.str() << "\"";
count++;
}
}
*streamPtr.get() << endl_tab << ")" << endl_tab << "{" << endl_tab_2;
switch (i) {
case 0:
default: *streamPtr.get() << s0 << sHIP_SYMBOL << "\\($2\\),/g" << endl; break;
case 1: *streamPtr.get() << s1 << sHIP_SYMBOL << "\\($3\\)$4/g;" << endl; break;
case 2: *streamPtr.get() << s0 << s_reinterpret_cast << "\\($2\\),/g" << endl; break;
case 3: *streamPtr.get() << s1 << s_reinterpret_cast << "\\($3\\)$4/g;" << endl; break;
}
*streamPtr.get() << tab << "}" << endl;
}
*streamPtr.get() << tab << return_k << "}" << endl;
}
void generateDeviceFunctions(unique_ptr<ostream> &streamPtr) {
unsigned int countUnsupported = 0;
unsigned int countSupported = 0;
stringstream sSupported;
stringstream sUnsupported;
for (auto &ma : CUDA_DEVICE_FUNC_MAP) {
bool isUnsupported = Statistics::isUnsupported(ma.second);
(isUnsupported ? sUnsupported : sSupported) << ((isUnsupported && countUnsupported) || (!isUnsupported && countSupported) ? ",\n" : "") << tab_2 << "\"" << ma.first.str() << "\"";
if (isUnsupported) countUnsupported++;
else countSupported++;
}
stringstream subCountSupported;
stringstream subWarnUnsupported;
stringstream subCommon;
string sCommon = tab + my_k + "\n" + tab + foreach_func;
subCountSupported << endl << sub << "countSupportedDeviceFunctions" << " {" << endl << (countSupported ? sCommon : tab + return_0);
subWarnUnsupported << endl << sub << "warnUnsupportedDeviceFunctions" << " {" << endl << (countUnsupported ? tab + my + "$line_num = shift;\n" + sCommon : tab + return_0);
if (countSupported) subCountSupported << sSupported.str() << endl_tab << ")" << endl;
if (countUnsupported) subWarnUnsupported << sUnsupported.str() << endl_tab << ")" << endl;
if (countSupported || countUnsupported) {
subCommon << tab << "{" << endl;
subCommon << tab_2 << "# match device function from the list, except those, which have a namespace prefix (aka somenamespace::umin(...));" << endl;
subCommon << tab_2 << "# function with only global namespace qualifier '::' (aka ::umin(...)) should be treated as a device function (and warned as well as without such qualifier);" << endl;
subCommon << tab_2 << my << "$mt_namespace = m/(\\w+)::($func)\\s*\\(\\s*.*\\s*\\)/g;" << endl;
subCommon << tab_2 << my << "$mt = m/($func)\\s*\\(\\s*.*\\s*\\)/g;" << endl;
subCommon << tab_2 << "if ($mt && !$mt_namespace) {" << endl;
subCommon << tab_3 << "$k += $mt;" << endl;
}
if (countSupported) subCountSupported << subCommon.str();
if (countUnsupported) {
subWarnUnsupported << subCommon.str();
subWarnUnsupported << tab_3 << print << "\" warning: $fileName:$line_num: unsupported device function \\\"$func\\\": $_\\n\";" << endl;
}
if (countSupported || countUnsupported) sCommon = tab_2 + "}\n" + tab + "}\n" + tab + return_k;
if (countSupported) subCountSupported << sCommon;
if (countUnsupported) subWarnUnsupported << sCommon;
subCountSupported << "}" << endl;
subWarnUnsupported << "}" << endl;
*streamPtr.get() << subCountSupported.str();
*streamPtr.get() << subWarnUnsupported.str();
}
bool generate(bool Generate) {
if (!Generate) return true;
string dstHipifyPerl = hipify_perl, dstHipifyPerlDir = OutputHipifyPerlDir;
error_code EC;
if (!dstHipifyPerlDir.empty()) {
string sOutputHipifyPerlDirAbsPath = getAbsoluteDirectoryPath(OutputHipifyPerlDir, EC, "output " + hipify_perl);
if (EC) return false;
dstHipifyPerl = sOutputHipifyPerlDirAbsPath + "/" + dstHipifyPerl;
}
SmallString<128> tmpFile;
EC = sys::fs::createTemporaryFile(dstHipifyPerl, hipify_perl, tmpFile);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": " << tmpFile << "\n";
return false;
}
unique_ptr<ostream> streamPtr = unique_ptr<ostream>(new ofstream(tmpFile.c_str(), ios_base::trunc));
generateHeader(streamPtr);
string sConv = my + "$apiCalls = ";
unsigned int exclude[3] = { CONV_DEVICE_FUNC, CONV_EXTERN_SHARED, CONV_KERNEL_LAUNCH };
*streamPtr.get() << "@statNames = (";
for (unsigned int i = 0; i < NUM_CONV_TYPES - 1; ++i) {
*streamPtr.get() << "\"" << counterNames[i] << "\", ";
if (any_of(exclude, exclude + 3, [&i](unsigned int x) { return x == i; })) continue;
sConv += "$ft{'" + string(counterNames[i]) + "'}" + (i < NUM_CONV_TYPES - 2 ? " + " : ";");
}
if (sConv.back() == ' ') sConv = sConv.substr(0, sConv.size() - 3) + ";";
*streamPtr.get() << "\"" << counterNames[NUM_CONV_TYPES - 1] << "\");" << endl;
generateStatFunctions(streamPtr);
generateSimpleSubstitutions(streamPtr);
generateExternShared(streamPtr);
generateKernelLaunch(streamPtr);
generateCubNamespace(streamPtr);
generateHostFunctions(streamPtr);
generateDeviceFunctions(streamPtr);
*streamPtr.get() << endl << "# Count of transforms in all files" << endl;
*streamPtr.get() << my << "%tt;" << endl;
*streamPtr.get() << "clearStats(\\%tt, \\@statNames);" << endl;
*streamPtr.get() << "$Twarnings = 0;" << endl;
*streamPtr.get() << "$TlineCount = 0;" << endl;
*streamPtr.get() << my << "%TwarningTags;" << endl;
*streamPtr.get() << my << "$fileCount = @ARGV;" << endl_2;
*streamPtr.get() << while_ << "(@ARGV) {" << endl;
*streamPtr.get() << tab << "$fileName=shift (@ARGV);" << endl;
*streamPtr.get() << tab << "if ($inplace) {" << endl;
*streamPtr.get() << tab_2 << my << "$file_prehip = \"$fileName\" . \".prehip\";" << endl;
*streamPtr.get() << tab_2 << my << "$infile;" << endl;
*streamPtr.get() << tab_2 << my << "$outfile;" << endl;
*streamPtr.get() << tab_2 << "if (-e $file_prehip) {" << endl;
*streamPtr.get() << tab_3 << "$infile = $file_prehip;" << endl;
*streamPtr.get() << tab_3 << "$outfile = $fileName;" << endl;
*streamPtr.get() << tab_2 << "} else {" << endl;
*streamPtr.get() << tab_3 << "system (\"cp $fileName $file_prehip\");" << endl;
*streamPtr.get() << tab_3 << "$infile = $file_prehip;" << endl;
*streamPtr.get() << tab_3 << "$outfile = $fileName;" << endl_tab_2 << "}" << endl;
*streamPtr.get() << tab_2 << "open(INFILE,\"<\", $infile) or die \"error: could not open $infile\";" << endl;
*streamPtr.get() << tab_2 << "open(OUTFILE,\">\", $outfile) or die \"error: could not open $outfile\";" << endl;
*streamPtr.get() << tab_2 << "$OUTFILE = OUTFILE;" << endl;
*streamPtr.get() << tab << "} else {" << endl;
*streamPtr.get() << tab_2 << "open(INFILE,\"<\", $fileName) or die \"error: could not open $fileName\";" << endl;
*streamPtr.get() << tab_2 << "$OUTFILE = STDOUT;" << endl_tab << "}" << endl;
*streamPtr.get() << tab << "# Count of transforms in this file" << endl;
*streamPtr.get() << tab << "clearStats(\\%ft, \\@statNames);" << endl;
*streamPtr.get() << tab << my << "$countIncludes = 0;" << endl;
*streamPtr.get() << tab << my << "$countKeywords = 0;" << endl;
*streamPtr.get() << tab << my << "$warnings = 0;" << endl;
*streamPtr.get() << tab << my << "%warningTags;" << endl;
*streamPtr.get() << tab << my << "$lineCount = 0;" << endl;
*streamPtr.get() << tab << "undef $/;" << endl;
*streamPtr.get() << tab << "# Read whole file at once, so we can match newlines" << endl;
*streamPtr.get() << tab << while_ << "(<INFILE>) {" << endl;
*streamPtr.get() << tab_2 << "$countKeywords += m/__global__/;" << endl;
*streamPtr.get() << tab_2 << "$countKeywords += m/__shared__/;" << endl;
*streamPtr.get() << tab_2 << "simpleSubstitutions();" << endl;
*streamPtr.get() << tab_2 << "transformExternShared();" << endl;
*streamPtr.get() << tab_2 << "transformKernelLaunch();" << endl;
*streamPtr.get() << tab_2 << "transformCubNamespace();" << endl;
*streamPtr.get() << tab_2 << "if ($print_stats) {" << endl;
*streamPtr.get() << tab_3 << while_ << "(/(\\b(hip|HIP)([A-Z]|_)\\w+\\b)/g) {" << endl;
*streamPtr.get() << tab_4 << "$convertedTags{$1}++;" << endl_tab_3 << "}" << endl_tab_2 << "}" << endl;
*streamPtr.get() << tab_2 << my << "$hasDeviceCode = $countKeywords + $ft{'device_function'};" << endl;
*streamPtr.get() << tab_2 << unless_ << "($quiet_warnings) {" << endl;
*streamPtr.get() << tab_3 << "# Copy into array of lines, process line-by-line to show warnings" << endl;
*streamPtr.get() << tab_3 << "if ($hasDeviceCode or (/\\bcu|CU/) or (/<<<.*>>>/)) {" << endl;
*streamPtr.get() << tab_4 << my << "@lines = split /\\n/, $_;" << endl;
*streamPtr.get() << tab_4 << "# Copy the whole file" << endl;
*streamPtr.get() << tab_4 << my << "$tmp = $_;" << endl;
*streamPtr.get() << tab_4 << my << "$line_num = 0;" << endl;
*streamPtr.get() << tab_4 << foreach << "(@lines) {" << endl;
*streamPtr.get() << tab_5 << "$line_num++;" << endl;
*streamPtr.get() << tab_5 << "# Remove any whitelisted words" << endl;
*streamPtr.get() << tab_5 << foreach << "$w (@whitelist) {" << endl;
*streamPtr.get() << tab_6 << "s/\\b$w\\b/ZAP/" << endl_tab_5 << "}" << endl;
*streamPtr.get() << tab_5 << my << "$tag;" << endl;
*streamPtr.get() << tab_5 << "if ((/(\\bcuda[A-Z]\\w+)/) or (/<<<.*>>>/)) {" << endl;
*streamPtr.get() << tab_6 << "# Flag any remaining code that look like cuda API calls: may want to add these to hipify" << endl;
*streamPtr.get() << tab_6 << "$tag = (defined $1) ? $1 : \"Launch\";" << endl_tab_5 << "}" << endl;
*streamPtr.get() << tab_5 << "if (defined $tag) {" << endl;
*streamPtr.get() << tab_6 << "$warnings++;" << endl;
*streamPtr.get() << tab_6 << "$warningTags{$tag}++;" << endl;
*streamPtr.get() << tab_6 << print << "\" warning: $fileName:#$line_num : $_\\n\";" << endl_tab_5 << "}" << endl;
*streamPtr.get() << tab_5 << "$s = warnUnsupportedDeviceFunctions($line_num);" << endl;
*streamPtr.get() << tab_5 << "$warnings += $s;" << endl_tab_4 << "}" << endl;
*streamPtr.get() << tab_4 << "$_ = $tmp;" << endl_tab_3 << "}" << endl_tab_2 << "}" << endl;
*streamPtr.get() << tab_2 << "if ($hasDeviceCode > 0) {" << endl;
*streamPtr.get() << tab_3 << "$ft{'device_function'} += countSupportedDeviceFunctions();" << endl_tab_2 << "}" << endl;
*streamPtr.get() << tab_2 << "transformHostFunctions();" << endl;
*streamPtr.get() << tab_2 << "# TODO: would like to move this code outside loop but it uses $_ which contains the whole file" << endl;
*streamPtr.get() << tab_2 << unless_ << "($no_output) {" << endl;
*streamPtr.get() << tab_3 << sConv << endl;
*streamPtr.get() << tab_3 << my << "$kernStuff = $hasDeviceCode + $ft{'" << counterNames[CONV_KERNEL_LAUNCH] << "'} + $ft{'" << counterNames[CONV_DEVICE_FUNC] << "'};" << endl;
*streamPtr.get() << tab_3 << my << "$totalCalls = $apiCalls + $kernStuff;" << endl;
*streamPtr.get() << tab_3 << "$is_dos = m/\\r\\n$/;" << endl;
*streamPtr.get() << tab_3 << "if ($totalCalls and ($countIncludes == 0) and ($kernStuff != 0)) {" << endl;
*streamPtr.get() << tab_4 << "# TODO: implement hipify-clang's logic with header files AMAP" << endl;
*streamPtr.get() << tab_4 << "print $OUTFILE '#include \"hip/hip_runtime.h\"' . ($is_dos ? \"\\r\\n\" : \"\\n\");" << endl_tab_3 << "}" << endl;
*streamPtr.get() << tab_3 << "print $OUTFILE \"$_\";" << endl_tab_2 << "}" << endl;
*streamPtr.get() << tab_2 << "$lineCount = $_ =~ tr/\\n//;" << endl_tab << "}" << endl;
*streamPtr.get() << tab << my << "$totalConverted = totalStats(\\%ft);" << endl;
*streamPtr.get() << tab << "if (($totalConverted+$warnings) and $print_stats) {" << endl;
*streamPtr.get() << tab_2 << "printStats(\" info: converted\", \\@statNames, \\%ft, $warnings, $lineCount);" << endl;
*streamPtr.get() << tab_2 << print << "\" in '$fileName'\\n\";" << endl_tab << "}" << endl;
*streamPtr.get() << tab << "# Update totals for all files" << endl;
*streamPtr.get() << tab << "addStats(\\%tt, \\%ft);" << endl;
*streamPtr.get() << tab << "$Twarnings += $warnings;" << endl;
*streamPtr.get() << tab << "$TlineCount += $lineCount;" << endl;
*streamPtr.get() << tab << foreach << "$key (keys %warningTags) {" << endl;
*streamPtr.get() << tab_2 << "$TwarningTags{$key} += $warningTags{$key};" << endl_tab << "}" << endl << "}" << endl;
*streamPtr.get() << "# Print total stats for all files processed:" << endl;
*streamPtr.get() << "if ($print_stats and ($fileCount > 1)) {" << endl;
*streamPtr.get() << tab << print << "\"\\n\";" << endl;
*streamPtr.get() << tab << "printStats(\" info: TOTAL-converted\", \\@statNames, \\%tt, $Twarnings, $TlineCount);" << endl;
*streamPtr.get() << tab << print << "\"\\n\";" << endl;
*streamPtr.get() << tab << foreach << "my $key (sort { $TwarningTags{$b} <=> $TwarningTags{$a} } keys %TwarningTags) {" << endl;
*streamPtr.get() << tab_2 << printf << "\" warning: unconverted %s : %d\\n\", $key, $TwarningTags{$key};" << endl_tab << "}" << endl;
*streamPtr.get() << tab << my << "$kernelCnt = keys %Tkernels;" << endl;
*streamPtr.get() << tab << printf << "\" kernels (%d total) : \", $kernelCnt;" << endl;
*streamPtr.get() << tab << foreach << "my $key (sort { $Tkernels{$b} <=> $Tkernels{$a} } keys %Tkernels) {" << endl;
*streamPtr.get() << tab_2 << printf << "\" %s(%d)\", $key, $Tkernels{$key};" << endl_tab << "}" << endl;
*streamPtr.get() << tab << print << "\"\\n\\n\";" << endl << "}" << endl;
*streamPtr.get() << "if ($print_stats) {" << endl;
*streamPtr.get() << tab << foreach << "my $key (sort { $convertedTags{$b} <=> $convertedTags{$a} } keys %convertedTags) {" << endl;
*streamPtr.get() << tab_2 << printf << "\" %s %d\\n\", $key, $convertedTags{$key};" << endl_tab << "}" << endl << "}" << endl;
streamPtr.get()->flush();
bool ret = true;
EC = sys::fs::copy_file(tmpFile, dstHipifyPerl);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": while copying " << tmpFile << " to " << dstHipifyPerl << "\n";
ret = false;
}
if (!SaveTemps) sys::fs::remove(tmpFile);
return ret;
}
}
@@ -1,103 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <sstream>
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Path.h"
#include "CUDA2HIP.h"
#include "CUDA2HIP_Scripting.h"
#include "ArgParse.h"
#include "StringUtils.h"
#include "LLVMCompat.h"
#include "Statistics.h"
using namespace llvm;
namespace python {
bool generate(bool Generate) {
if (!Generate) {
return true;
}
std::string dstPythonMap = "cuda_to_hip_mappings.py", dstPythonMapDir = OutputPythonMapDir;
std::error_code EC;
if (!dstPythonMapDir.empty()) {
std::string sOutputPythonMapDirAbsPath = getAbsoluteDirectoryPath(OutputPythonMapDir, EC, "output hipify-python map");
if (EC) {
return false;
}
dstPythonMap = sOutputPythonMapDirAbsPath + "/" + dstPythonMap;
}
SmallString<128> tmpFile;
StringRef ext = "hipify-tmp";
EC = sys::fs::createTemporaryFile(dstPythonMap, ext, tmpFile);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": " << tmpFile << "\n";
return false;
}
std::unique_ptr<std::ostream> pythonStreamPtr = std::unique_ptr<std::ostream>(new std::ofstream(tmpFile.c_str(), std::ios_base::trunc));
*pythonStreamPtr.get() << "import collections\n\n";
*pythonStreamPtr.get() << "from pyHIPIFY.constants import *\n\n";
*pythonStreamPtr.get() << "CUDA_RENAMES_MAP = collections.OrderedDict([\n";
const std::string sHIP_UNS = ", HIP_UNSUPPORTED";
for (int i = 0; i < NUM_CONV_TYPES; ++i) {
if (i == CONV_INCLUDE_CUDA_MAIN_H || i == CONV_INCLUDE) {
for (auto &ma : CUDA_INCLUDE_MAP) {
if (i == ma.second.type) {
std::string sUnsupported;
if (Statistics::isUnsupported(ma.second)) {
sUnsupported = sHIP_UNS;
}
StringRef repName = Statistics::isToRoc(ma.second) ? ma.second.rocName : ma.second.hipName;
*pythonStreamPtr.get() << " (\"" << ma.first.str() << "\", (\"" << repName.str() << "\", " << counterTypes[i] << ", " << apiTypes[ma.second.apiType] << sUnsupported << ")),\n";
}
}
}
else {
for (auto &ma : CUDA_RENAMES_MAP()) {
if (i == ma.second.type) {
std::string sUnsupported;
if (Statistics::isUnsupported(ma.second)) {
sUnsupported = sHIP_UNS;
}
StringRef repName = Statistics::isToRoc(ma.second) ? ma.second.rocName : ma.second.hipName;
*pythonStreamPtr.get() << " (\"" << ma.first.str() << "\", (\"" << repName.str() << "\", " << counterTypes[i] << ", " << apiTypes[ma.second.apiType] << sUnsupported << ")),\n";
}
}
}
}
*pythonStreamPtr.get() << "])\n\n";
*pythonStreamPtr.get() << "CUDA_TO_HIP_MAPPINGS = [CUDA_RENAMES_MAP, C10_MAPPINGS, PYTORCH_SPECIFIC_MAPPINGS]\n";
pythonStreamPtr.get()->flush();
bool ret = true;
EC = sys::fs::copy_file(tmpFile, dstPythonMap);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": while copying " << tmpFile << " to " << dstPythonMap << "\n";
ret = false;
}
if (!SaveTemps) {
sys::fs::remove(tmpFile);
}
return true;
}
}
@@ -1,86 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_RAND_FUNCTION_MAP{
// RAND Host functions
{"curandCreateGenerator", {"hiprandCreateGenerator", "", CONV_LIB_FUNC, API_RAND}},
{"curandCreateGeneratorHost", {"hiprandCreateGeneratorHost", "", CONV_LIB_FUNC, API_RAND}},
{"curandCreatePoissonDistribution", {"hiprandCreatePoissonDistribution", "", CONV_LIB_FUNC, API_RAND}},
{"curandDestroyDistribution", {"hiprandDestroyDistribution", "", CONV_LIB_FUNC, API_RAND}},
{"curandDestroyGenerator", {"hiprandDestroyGenerator", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerate", {"hiprandGenerate", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateLogNormal", {"hiprandGenerateLogNormal", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateLogNormalDouble", {"hiprandGenerateLogNormalDouble", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateLongLong", {"hiprandGenerateLongLong", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandGenerateNormal", {"hiprandGenerateNormal", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateNormalDouble", {"hiprandGenerateNormalDouble", "", CONV_LIB_FUNC, API_RAND}},
{"curandGeneratePoisson", {"hiprandGeneratePoisson", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateSeeds", {"hiprandGenerateSeeds", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateUniform", {"hiprandGenerateUniform", "", CONV_LIB_FUNC, API_RAND}},
{"curandGenerateUniformDouble", {"hiprandGenerateUniformDouble", "", CONV_LIB_FUNC, API_RAND}},
{"curandGetDirectionVectors32", {"hiprandGetDirectionVectors32", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandGetDirectionVectors64", {"hiprandGetDirectionVectors64", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandGetProperty", {"hiprandGetProperty", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandGetScrambleConstants32", {"hiprandGetScrambleConstants32", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandGetScrambleConstants64", {"hiprandGetScrambleConstants64", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandGetVersion", {"hiprandGetVersion", "", CONV_LIB_FUNC, API_RAND}},
{"curandSetGeneratorOffset", {"hiprandSetGeneratorOffset", "", CONV_LIB_FUNC, API_RAND}},
{"curandSetGeneratorOrdering", {"hiprandSetGeneratorOrdering", "", CONV_LIB_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curandSetPseudoRandomGeneratorSeed", {"hiprandSetPseudoRandomGeneratorSeed", "", CONV_LIB_FUNC, API_RAND}},
{"curandSetQuasiRandomGeneratorDimensions", {"hiprandSetQuasiRandomGeneratorDimensions", "", CONV_LIB_FUNC, API_RAND}},
{"curandSetStream", {"hiprandSetStream", "", CONV_LIB_FUNC, API_RAND}},
{"curandMakeMTGP32Constants", {"hiprandMakeMTGP32Constants", "", CONV_LIB_FUNC, API_RAND}},
{"curandMakeMTGP32KernelState", {"hiprandMakeMTGP32KernelState", "", CONV_LIB_FUNC, API_RAND}},
// RAND Device functions
{"curand", {"hiprand", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_init", {"hiprand_init", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_log_normal", {"hiprand_log_normal", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_log_normal_double", {"hiprand_log_normal_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_log_normal2", {"hiprand_log_normal2", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_log_normal2_double", {"hiprand_log_normal2_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_log_normal4", {"hiprand_log_normal4", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_log_normal4_double", {"hiprand_log_normal4_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_mtgp32_single", {"hiprand_mtgp32_single", "", CONV_LIB_DEVICE_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curand_mtgp32_single_specific", {"hiprand_mtgp32_single_specific", "", CONV_LIB_DEVICE_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curand_mtgp32_specific", {"hiprand_mtgp32_specific", "", CONV_LIB_DEVICE_FUNC, API_RAND, HIP_UNSUPPORTED}},
{"curand_normal", {"hiprand_normal", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_normal_double", {"hiprand_normal_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_normal2", {"hiprand_normal2", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_normal2_double", {"hiprand_normal2_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_normal4", {"hiprand_normal4", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_normal4_double", {"hiprand_normal4_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_uniform", {"hiprand_uniform", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_uniform_double", {"hiprand_uniform_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_uniform2_double", {"hiprand_uniform2_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_uniform4", {"hiprand_uniform4", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_uniform4_double", {"hiprand_uniform4_double", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_discrete", {"hiprand_discrete", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_discrete4", {"hiprand_discrete4", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_poisson", {"hiprand_poisson", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_poisson4", {"hiprand_poisson4", "", CONV_LIB_DEVICE_FUNC, API_RAND}},
{"curand_Philox4x32_10", {"hiprand_Philox4x32_10", "", CONV_LIB_DEVICE_FUNC, API_RAND, HIP_UNSUPPORTED}},
// unchanged function names: skipahead, skipahead_sequence, skipahead_subsequence
};
@@ -1,140 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all functions
const std::map<llvm::StringRef, hipCounter> CUDA_RAND_TYPE_NAME_MAP{
// RAND defines
{"CURAND_VER_MAJOR", {"HIPRAND_VER_MAJOR", "", CONV_DEFINE, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_VER_MINOR", {"HIPRAND_VER_MINOR", "", CONV_DEFINE, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_VER_PATCH", {"HIPRAND_VER_PATCH", "", CONV_DEFINE, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_VER_BUILD", {"HIPRAND_VER_BUILD", "", CONV_DEFINE, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_VERSION", {"HIPRAND_VERSION", "", CONV_DEFINE, API_RAND, HIP_UNSUPPORTED}},
// RAND Host types
{"curandStatus", {"hiprandStatus_t", "", CONV_TYPE, API_RAND}},
{"curandStatus_t", {"hiprandStatus_t", "", CONV_TYPE, API_RAND}},
{"curandRngType", {"hiprandRngType_t", "", CONV_TYPE, API_RAND}},
{"curandRngType_t", {"hiprandRngType_t", "", CONV_TYPE, API_RAND}},
{"curandGenerator_st", {"hiprandGenerator_st", "", CONV_TYPE, API_RAND}},
{"curandGenerator_t", {"hiprandGenerator_t", "", CONV_TYPE, API_RAND}},
{"curandDirectionVectorSet", {"hiprandDirectionVectorSet_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDirectionVectorSet_t", {"hiprandDirectionVectorSet_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandOrdering", {"hiprandOrdering_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandOrdering_t", {"hiprandOrdering_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDistribution_st", {"hiprandDistribution_st", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandHistogramM2V_st", {"hiprandDistribution_st", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDistribution_t", {"hiprandDistribution_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandHistogramM2V_t", {"hiprandDistribution_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDistributionShift_st", {"hiprandDistributionShift_st", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDistributionShift_t", {"hiprandDistributionShift_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDistributionM2Shift_st", {"hiprandDistributionM2Shift_st", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDistributionM2Shift_t", {"hiprandDistributionM2Shift_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandHistogramM2_st", {"hiprandHistogramM2_st", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandHistogramM2_t", {"hiprandHistogramM2_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandHistogramM2K_st", {"hiprandHistogramM2K_st", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandHistogramM2K_t", {"hiprandHistogramM2K_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDiscreteDistribution_st", {"hiprandDiscreteDistribution_st", "", CONV_TYPE, API_RAND}},
{"curandDiscreteDistribution_t", {"hiprandDiscreteDistribution_t", "", CONV_TYPE, API_RAND}},
{"curandMethod", {"hiprandMethod_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandMethod_t", {"hiprandMethod_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandDirectionVectors32_t", {"hiprandDirectionVectors32_t", "", CONV_TYPE, API_RAND}},
{"curandDirectionVectors64_t", {"hiprandDirectionVectors64_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
// RAND types for Device functions
{"curandStateMtgp32", {"hiprandStateMtgp32", "", CONV_TYPE, API_RAND}},
{"curandStateMtgp32_t", {"hiprandStateMtgp32_t", "", CONV_TYPE, API_RAND}},
{"curandStateScrambledSobol64", {"hiprandStateScrambledSobol64", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandStateScrambledSobol64_t", {"hiprandStateScrambledSobol64_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandStateSobol64", {"hiprandStateSobol64", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandStateSobol64_t", {"hiprandStateSobol64_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandStateScrambledSobol32", {"hiprandStateScrambledSobol32", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandStateScrambledSobol32_t", {"hiprandStateScrambledSobol32_t", "", CONV_TYPE, API_RAND, HIP_UNSUPPORTED}},
{"curandStateSobol32", {"hiprandStateSobol32", "", CONV_TYPE, API_RAND}},
{"curandStateSobol32_t", {"hiprandStateSobol32_t", "", CONV_TYPE, API_RAND}},
{"curandStateMRG32k3a", {"hiprandStateMRG32k3a", "", CONV_TYPE, API_RAND}},
{"curandStateMRG32k3a_t", {"hiprandStateMRG32k3a_t", "", CONV_TYPE, API_RAND}},
{"curandStatePhilox4_32_10", {"hiprandStatePhilox4_32_10", "", CONV_TYPE, API_RAND}},
{"curandStatePhilox4_32_10_t", {"hiprandStatePhilox4_32_10_t", "", CONV_TYPE, API_RAND}},
{"curandStateXORWOW", {"hiprandStateXORWOW", "", CONV_TYPE, API_RAND}},
{"curandStateXORWOW_t", {"hiprandStateXORWOW_t", "", CONV_TYPE, API_RAND}},
{"curandState", {"hiprandState", "", CONV_TYPE, API_RAND}},
{"curandState_t", {"hiprandState_t", "", CONV_TYPE, API_RAND}},
// RAND function call status types (enum curandStatus)
{"CURAND_STATUS_SUCCESS", {"HIPRAND_STATUS_SUCCESS", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_VERSION_MISMATCH", {"HIPRAND_STATUS_VERSION_MISMATCH", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_NOT_INITIALIZED", {"HIPRAND_STATUS_NOT_INITIALIZED", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_ALLOCATION_FAILED", {"HIPRAND_STATUS_ALLOCATION_FAILED", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_TYPE_ERROR", {"HIPRAND_STATUS_TYPE_ERROR", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_OUT_OF_RANGE", {"HIPRAND_STATUS_OUT_OF_RANGE", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_LENGTH_NOT_MULTIPLE", {"HIPRAND_STATUS_LENGTH_NOT_MULTIPLE", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_DOUBLE_PRECISION_REQUIRED", {"HIPRAND_STATUS_DOUBLE_PRECISION_REQUIRED", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_LAUNCH_FAILURE", {"HIPRAND_STATUS_LAUNCH_FAILURE", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_PREEXISTING_FAILURE", {"HIPRAND_STATUS_PREEXISTING_FAILURE", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_INITIALIZATION_FAILED", {"HIPRAND_STATUS_INITIALIZATION_FAILED", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_ARCH_MISMATCH", {"HIPRAND_STATUS_ARCH_MISMATCH", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_STATUS_INTERNAL_ERROR", {"HIPRAND_STATUS_INTERNAL_ERROR", "", CONV_NUMERIC_LITERAL, API_RAND}},
// RAND generator types (enum curandRngType)
{"CURAND_RNG_TEST", {"HIPRAND_RNG_TEST", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_PSEUDO_DEFAULT", {"HIPRAND_RNG_PSEUDO_DEFAULT", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_PSEUDO_XORWOW", {"HIPRAND_RNG_PSEUDO_XORWOW", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_PSEUDO_MRG32K3A", {"HIPRAND_RNG_PSEUDO_MRG32K3A", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_PSEUDO_MTGP32", {"HIPRAND_RNG_PSEUDO_MTGP32", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_PSEUDO_MT19937", {"HIPRAND_RNG_PSEUDO_MT19937", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_PSEUDO_PHILOX4_32_10", {"HIPRAND_RNG_PSEUDO_PHILOX4_32_10", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_QUASI_DEFAULT", {"HIPRAND_RNG_QUASI_DEFAULT", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_QUASI_SOBOL32", {"HIPRAND_RNG_QUASI_SOBOL32", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_QUASI_SCRAMBLED_SOBOL32", {"HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_QUASI_SOBOL64", {"HIPRAND_RNG_QUASI_SOBOL64", "", CONV_NUMERIC_LITERAL, API_RAND}},
{"CURAND_RNG_QUASI_SCRAMBLED_SOBOL64", {"HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64", "", CONV_NUMERIC_LITERAL, API_RAND}},
// RAND ordering of results in memory (enum curandOrdering)
{"CURAND_ORDERING_PSEUDO_BEST", {"HIPRAND_ORDERING_PSEUDO_BEST", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_ORDERING_PSEUDO_DEFAULT", {"HIPRAND_ORDERING_PSEUDO_DEFAULT", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_ORDERING_PSEUDO_SEEDED", {"HIPRAND_ORDERING_PSEUDO_SEEDED", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_ORDERING_QUASI_DEFAULT", {"HIPRAND_ORDERING_QUASI_DEFAULT", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
// RAND choice of direction vector set (enum curandDirectionVectorSet)
{"CURAND_DIRECTION_VECTORS_32_JOEKUO6", {"HIPRAND_DIRECTION_VECTORS_32_JOEKUO6", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6", {"HIPRAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_DIRECTION_VECTORS_64_JOEKUO6", {"HIPRAND_DIRECTION_VECTORS_64_JOEKUO6", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6", {"HIPRAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
// RAND method (enum curandMethod)
{"CURAND_CHOOSE_BEST", {"HIPRAND_CHOOSE_BEST", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_ITR", {"HIPRAND_ITR", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_KNUTH", {"HIPRAND_KNUTH", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_HITR", {"HIPRAND_HITR", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_M1", {"HIPRAND_M1", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_M2", {"HIPRAND_M2", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_BINARY_SEARCH", {"HIPRAND_BINARY_SEARCH", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_DISCRETE_GAUSS", {"HIPRAND_DISCRETE_GAUSS", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_REJECTION", {"HIPRAND_REJECTION", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_DEVICE_API", {"HIPRAND_DEVICE_API", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_FAST_REJECTION", {"HIPRAND_FAST_REJECTION", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_3RD", {"HIPRAND_3RD", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_DEFINITION", {"HIPRAND_DEFINITION", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
{"CURAND_POISSON", {"HIPRAND_POISSON", "", CONV_NUMERIC_LITERAL, API_RAND, HIP_UNSUPPORTED}},
};
@@ -1,693 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Map of all CUDA Runtime API functions
const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_FUNCTION_MAP{
// 5.1. Device Management
// no analogue
{"cudaChooseDevice", {"hipChooseDevice", "", CONV_DEVICE, API_RUNTIME}},
// cuDeviceGetAttribute
{"cudaDeviceGetAttribute", {"hipDeviceGetAttribute", "", CONV_DEVICE, API_RUNTIME}},
// cuDeviceGetByPCIBusId
{"cudaDeviceGetByPCIBusId", {"hipDeviceGetByPCIBusId", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
{"cudaDeviceGetCacheConfig", {"hipDeviceGetCacheConfig", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxGetLimit
{"cudaDeviceGetLimit", {"hipDeviceGetLimit", "", CONV_DEVICE, API_RUNTIME}},
// cuDeviceGetNvSciSyncAttributes
{"cudaDeviceGetNvSciSyncAttributes", {"hipDeviceGetNvSciSyncAttributes", "", CONV_DEVICE, API_RUNTIME, HIP_UNSUPPORTED}},
// cuDeviceGetP2PAttribute
{"cudaDeviceGetP2PAttribute", {"hipDeviceGetP2PAttribute", "", CONV_DEVICE, API_RUNTIME, HIP_UNSUPPORTED}},
// cuDeviceGetPCIBusId
{"cudaDeviceGetPCIBusId", {"hipDeviceGetPCIBusId", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxGetSharedMemConfig
{"cudaDeviceGetSharedMemConfig", {"hipDeviceGetSharedMemConfig", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxGetStreamPriorityRange
{"cudaDeviceGetStreamPriorityRange", {"hipDeviceGetStreamPriorityRange", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
{"cudaDeviceReset", {"hipDeviceReset", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
{"cudaDeviceSetCacheConfig", {"hipDeviceSetCacheConfig", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxSetLimit
{"cudaDeviceSetLimit", {"hipDeviceSetLimit", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxSetSharedMemConfig
{"cudaDeviceSetSharedMemConfig", {"hipDeviceSetSharedMemConfig", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxSynchronize
{"cudaDeviceSynchronize", {"hipDeviceSynchronize", "", CONV_DEVICE, API_RUNTIME}},
// cuDeviceGet
// NOTE: cuDeviceGet has no attr: int ordinal
{"cudaGetDevice", {"hipGetDevice", "", CONV_DEVICE, API_RUNTIME}},
// cuDeviceGetCount
{"cudaGetDeviceCount", {"hipGetDeviceCount", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxGetFlags
// TODO: rename to hipGetDeviceFlags
{"cudaGetDeviceFlags", {"hipCtxGetFlags", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuDeviceGetProperties due to different attributes: CUdevprop and cudaDeviceProp
{"cudaGetDeviceProperties", {"hipGetDeviceProperties", "", CONV_DEVICE, API_RUNTIME}},
// cuIpcCloseMemHandle
{"cudaIpcCloseMemHandle", {"hipIpcCloseMemHandle", "", CONV_DEVICE, API_RUNTIME}},
// cuIpcGetEventHandle
{"cudaIpcGetEventHandle", {"hipIpcGetEventHandle", "", CONV_DEVICE, API_RUNTIME}},
// cuIpcGetMemHandle
{"cudaIpcGetMemHandle", {"hipIpcGetMemHandle", "", CONV_DEVICE, API_RUNTIME}},
// cuIpcOpenEventHandle
{"cudaIpcOpenEventHandle", {"hipIpcOpenEventHandle", "", CONV_DEVICE, API_RUNTIME}},
// cuIpcOpenMemHandle
{"cudaIpcOpenMemHandle", {"hipIpcOpenMemHandle", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
{"cudaSetDevice", {"hipSetDevice", "", CONV_DEVICE, API_RUNTIME}},
// cuCtxGetFlags
{"cudaSetDeviceFlags", {"hipSetDeviceFlags", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
{"cudaSetValidDevices", {"hipSetValidDevices", "", CONV_DEVICE, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.2. Thread Management [DEPRECATED]
// no analogue
{"cudaThreadExit", {"hipDeviceReset", "", CONV_THREAD, API_RUNTIME}},
// no analogue
{"cudaThreadGetCacheConfig", {"hipDeviceGetCacheConfig", "", CONV_THREAD, API_RUNTIME}},
// no analogue
{"cudaThreadGetLimit", {"hipThreadGetLimit", "", CONV_THREAD, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaThreadSetCacheConfig", {"hipDeviceSetCacheConfig", "", CONV_THREAD, API_RUNTIME}},
// no analogue
{"cudaThreadSetLimit", {"hipThreadSetLimit", "", CONV_THREAD, API_RUNTIME, HIP_UNSUPPORTED}},
// cuCtxSynchronize
{"cudaThreadSynchronize", {"hipDeviceSynchronize", "", CONV_THREAD, API_RUNTIME}},
// 5.3. Error Handling
// no analogue
// NOTE: cudaGetErrorName and cuGetErrorName have different signatures
{"cudaGetErrorName", {"hipGetErrorName", "", CONV_ERROR, API_RUNTIME}},
// no analogue
// NOTE: cudaGetErrorString and cuGetErrorString have different signatures
{"cudaGetErrorString", {"hipGetErrorString", "", CONV_ERROR, API_RUNTIME}},
// no analogue
{"cudaGetLastError", {"hipGetLastError", "", CONV_ERROR, API_RUNTIME}},
// no analogue
{"cudaPeekAtLastError", {"hipPeekAtLastError", "", CONV_ERROR, API_RUNTIME}},
// 5.4. Stream Management
// cuStreamAddCallback
{"cudaStreamAddCallback", {"hipStreamAddCallback", "", CONV_STREAM, API_RUNTIME}},
// cuStreamAttachMemAsync
{"cudaStreamAttachMemAsync", {"hipStreamAttachMemAsync", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// cuStreamBeginCapture
{"cudaStreamBeginCapture", {"hipStreamBeginCapture", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuStreamCreate due to different signatures
{"cudaStreamCreate", {"hipStreamCreate", "", CONV_STREAM, API_RUNTIME}},
// cuStreamCreate
{"cudaStreamCreateWithFlags", {"hipStreamCreateWithFlags", "", CONV_STREAM, API_RUNTIME}},
// cuStreamCreateWithPriority
{"cudaStreamCreateWithPriority", {"hipStreamCreateWithPriority", "", CONV_STREAM, API_RUNTIME}},
// cuStreamDestroy
{"cudaStreamDestroy", {"hipStreamDestroy", "", CONV_STREAM, API_RUNTIME}},
// cuStreamEndCapture
{"cudaStreamEndCapture", {"hipStreamEndCapture", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// cuStreamGetFlags
{"cudaStreamGetFlags", {"hipStreamGetFlags", "", CONV_STREAM, API_RUNTIME}},
// cuStreamGetPriority
{"cudaStreamGetPriority", {"hipStreamGetPriority", "", CONV_STREAM, API_RUNTIME}},
// cuStreamIsCapturing
{"cudaStreamIsCapturing", {"hipStreamIsCapturing", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// cuStreamGetCaptureInfo
{"cudaStreamGetCaptureInfo", {"hipStreamGetCaptureInfo", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// cuStreamQuery
{"cudaStreamQuery", {"hipStreamQuery", "", CONV_STREAM, API_RUNTIME}},
// cuStreamSynchronize
{"cudaStreamSynchronize", {"hipStreamSynchronize", "", CONV_STREAM, API_RUNTIME}},
// cuStreamWaitEvent
{"cudaStreamWaitEvent", {"hipStreamWaitEvent", "", CONV_STREAM, API_RUNTIME}},
// cuThreadExchangeStreamCaptureMode
{"cudaThreadExchangeStreamCaptureMode", {"hipThreadExchangeStreamCaptureMode", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.5.Event Management
// no analogue
// NOTE: Not equal to cuEventCreate due to different signatures
{"cudaEventCreate", {"hipEventCreate", "", CONV_EVENT, API_RUNTIME}},
// cuEventCreate
{"cudaEventCreateWithFlags", {"hipEventCreateWithFlags", "", CONV_EVENT, API_RUNTIME}},
// cuEventDestroy
{"cudaEventDestroy", {"hipEventDestroy", "", CONV_EVENT, API_RUNTIME}},
// cuEventElapsedTime
{"cudaEventElapsedTime", {"hipEventElapsedTime", "", CONV_EVENT, API_RUNTIME}},
// cuEventQuery
{"cudaEventQuery", {"hipEventQuery", "", CONV_EVENT, API_RUNTIME}},
// cuEventRecord
{"cudaEventRecord", {"hipEventRecord", "", CONV_EVENT, API_RUNTIME}},
// cuEventSynchronize
{"cudaEventSynchronize", {"hipEventSynchronize", "", CONV_EVENT, API_RUNTIME}},
// 5.6. External Resource Interoperability
// cuDestroyExternalMemory
{"cudaDestroyExternalMemory", {"hipDestroyExternalMemory", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuDestroyExternalSemaphore
{"cudaDestroyExternalSemaphore", {"hipDestroyExternalSemaphore", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuExternalMemoryGetMappedBuffer
{"cudaExternalMemoryGetMappedBuffer", {"hipExternalMemoryGetMappedBuffer", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuExternalMemoryGetMappedMipmappedArray
{"cudaExternalMemoryGetMappedMipmappedArray", {"hipExternalMemoryGetMappedMipmappedArray", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuImportExternalMemory
{"cudaImportExternalMemory", {"hipImportExternalMemory", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuImportExternalSemaphore
{"cudaImportExternalSemaphore", {"hipImportExternalSemaphore", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuSignalExternalSemaphoresAsync
{"cudaSignalExternalSemaphoresAsync", {"hipSignalExternalSemaphoresAsync", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// cuWaitExternalSemaphoresAsync
{"cudaWaitExternalSemaphoresAsync", {"hipWaitExternalSemaphoresAsync", "", CONV_EXT_RES, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.7. Execution Control
// no analogue
{"cudaFuncGetAttributes", {"hipFuncGetAttributes", "", CONV_EXECUTION, API_RUNTIME}},
// no analogue
{"cudaFuncSetAttribute", {"hipFuncSetAttribute", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuFuncSetCacheConfig due to different signatures
{"cudaFuncSetCacheConfig", {"hipFuncSetCacheConfig", "", CONV_DEVICE, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuFuncSetSharedMemConfig due to different signatures
{"cudaFuncSetSharedMemConfig", {"hipFuncSetSharedMemConfig", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaGetParameterBuffer", {"hipGetParameterBuffer", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaGetParameterBufferV2", {"hipGetParameterBufferV2", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuLaunchCooperativeKernel due to different signatures
{"cudaLaunchCooperativeKernel", {"hipLaunchCooperativeKernel", "", CONV_EXECUTION, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuLaunchCooperativeKernelMultiDevice due to different signatures
{"cudaLaunchCooperativeKernelMultiDevice", {"hipLaunchCooperativeKernelMultiDevice", "", CONV_EXECUTION, API_RUNTIME}},
// cuLaunchHostFunc
{"cudaLaunchHostFunc", {"hipLaunchHostFunc", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuLaunchKernel due to different signatures
{"cudaLaunchKernel", {"hipLaunchKernel", "", CONV_EXECUTION, API_RUNTIME}},
// no analogue
{"cudaSetDoubleForDevice", {"hipSetDoubleForDevice", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaSetDoubleForHost", {"hipSetDoubleForHost", "", CONV_EXECUTION, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.8. Occupancy
// cuOccupancyMaxActiveBlocksPerMultiprocessor
{"cudaOccupancyMaxActiveBlocksPerMultiprocessor", {"hipOccupancyMaxActiveBlocksPerMultiprocessor", "", CONV_OCCUPANCY, API_RUNTIME}},
// cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags
{"cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags", {"hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags", "", CONV_OCCUPANCY, API_RUNTIME}},
// cuOccupancyMaxPotentialBlockSize
{"cudaOccupancyMaxPotentialBlockSize", {"hipOccupancyMaxPotentialBlockSize", "", CONV_OCCUPANCY, API_RUNTIME}},
// cuOccupancyMaxPotentialBlockSizeWithFlags
{"cudaOccupancyMaxPotentialBlockSizeWithFlags", {"hipOccupancyMaxPotentialBlockSizeWithFlags", "", CONV_OCCUPANCY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaOccupancyMaxPotentialBlockSizeVariableSMem", {"hipOccupancyMaxPotentialBlockSizeVariableSMem", "", CONV_OCCUPANCY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags", {"hipOccupancyMaxPotentialBlockSizeVariableSMemWithFlags", "", CONV_OCCUPANCY, API_RUNTIME, HIP_UNSUPPORTED}},
// Former 5.9. Execution Control [DEPRECATED]
// NOTE: Removed in CUDA 10.1
// no analogue
{"cudaConfigureCall", {"hipConfigureCall", "", CONV_EXECUTION, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cudaLaunch due to different signatures
{"cudaLaunch", {"hipLaunchByPtr", "", CONV_EXECUTION, API_RUNTIME}},
// no analogue
{"cudaSetupArgument", {"hipSetupArgument", "", CONV_EXECUTION, API_RUNTIME}},
// 5.9. Memory Management
// no analogue
{"cudaArrayGetInfo", {"hipArrayGetInfo", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// cuMemFree
{"cudaFree", {"hipFree", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaFreeArray", {"hipFreeArray", "", CONV_MEMORY, API_RUNTIME}},
// cuMemFreeHost
{"cudaFreeHost", {"hipHostFree", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMipmappedArrayDestroy due to different signatures
{"cudaFreeMipmappedArray", {"hipFreeMipmappedArray", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMipmappedArrayGetLevel due to different signatures
{"cudaGetMipmappedArrayLevel", {"hipGetMipmappedArrayLevel", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaGetSymbolAddress", {"hipGetSymbolAddress", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaGetSymbolSize", {"hipGetSymbolSize", "", CONV_MEMORY, API_RUNTIME}},
// cuMemHostAlloc
{"cudaHostAlloc", {"hipHostMalloc", "", CONV_MEMORY, API_RUNTIME}},
// cuMemHostGetDevicePointer
{"cudaHostGetDevicePointer", {"hipHostGetDevicePointer", "", CONV_MEMORY, API_RUNTIME}},
// cuMemHostGetFlags
{"cudaHostGetFlags", {"hipHostGetFlags", "", CONV_MEMORY, API_RUNTIME}},
// cuMemHostRegister
{"cudaHostRegister", {"hipHostRegister", "", CONV_MEMORY, API_RUNTIME}},
// cuMemHostUnregister
{"cudaHostUnregister", {"hipHostUnregister", "", CONV_MEMORY, API_RUNTIME}},
// cuMemAlloc
{"cudaMalloc", {"hipMalloc", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMalloc3D", {"hipMalloc3D", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMalloc3DArray", {"hipMalloc3DArray", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMallocArray", {"hipMallocArray", "", CONV_MEMORY, API_RUNTIME}},
// cuMemHostAlloc
{"cudaMallocHost", {"hipHostMalloc", "", CONV_MEMORY, API_RUNTIME}},
// cuMemAllocManaged
{"cudaMallocManaged", {"hipMallocManaged", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMipmappedArrayCreate due to different signatures
{"cudaMallocMipmappedArray", {"hipMallocMipmappedArray", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMemAllocPitch due to different signatures
{"cudaMallocPitch", {"hipMallocPitch", "", CONV_MEMORY, API_RUNTIME}},
// cuMemAdvise
{"cudaMemAdvise", {"hipMemAdvise", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMemcpy due to different signatures
{"cudaMemcpy", {"hipMemcpy", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMemcpy2D due to different signatures
{"cudaMemcpy2D", {"hipMemcpy2D", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpy2DArrayToArray", {"hipMemcpy2DArrayToArray", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMemcpy2DAsync due to different signatures
{"cudaMemcpy2DAsync", {"hipMemcpy2DAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpy2DFromArray", {"hipMemcpy2DFromArray", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpy2DFromArrayAsync", {"hipMemcpy2DFromArrayAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpy2DToArray", {"hipMemcpy2DToArray", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpy2DToArrayAsync", {"hipMemcpy2DToArrayAsync", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMemcpy3D due to different signatures
{"cudaMemcpy3D", {"hipMemcpy3D", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMemcpy3DAsync due to different signatures
{"cudaMemcpy3DAsync", {"hipMemcpy3DAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMemcpy3DPeer due to different signatures
{"cudaMemcpy3DPeer", {"hipMemcpy3DPeer", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMemcpy3DPeerAsync due to different signatures
{"cudaMemcpy3DPeerAsync", {"hipMemcpy3DPeerAsync", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuMemcpyAsync due to different signatures
{"cudaMemcpyAsync", {"hipMemcpyAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpyFromSymbol", {"hipMemcpyFromSymbol", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpyFromSymbolAsync", {"hipMemcpyFromSymbolAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMemcpyPeer due to different signatures
{"cudaMemcpyPeer", {"hipMemcpyPeer", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuMemcpyPeerAsync due to different signatures
{"cudaMemcpyPeerAsync", {"hipMemcpyPeerAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpyToSymbol", {"hipMemcpyToSymbol", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpyToSymbolAsync", {"hipMemcpyToSymbolAsync", "", CONV_MEMORY, API_RUNTIME}},
// cuMemGetInfo
{"cudaMemGetInfo", {"hipMemGetInfo", "", CONV_MEMORY, API_RUNTIME}},
// TODO: double check cuMemPrefetchAsync
{"cudaMemPrefetchAsync", {"hipMemPrefetchAsync", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// cuMemRangeGetAttribute
{"cudaMemRangeGetAttribute", {"hipMemRangeGetAttribute", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// cuMemRangeGetAttributes
{"cudaMemRangeGetAttributes", {"hipMemRangeGetAttributes", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// cuMemsetD32 - hipMemsetD32
{"cudaMemset", {"hipMemset", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemset2D", {"hipMemset2D", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemset2DAsync", {"hipMemset2DAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemset3D", {"hipMemset3D", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemset3DAsync", {"hipMemset3DAsync", "", CONV_MEMORY, API_RUNTIME}},
// cuMemsetD32Async
{"cudaMemsetAsync", {"hipMemsetAsync", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"make_cudaExtent", {"make_hipExtent", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"make_cudaPitchedPtr", {"make_hipPitchedPtr", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"make_cudaPos", {"make_hipPos", "", CONV_MEMORY, API_RUNTIME}},
// 5.10. Memory Management [DEPRECATED]
// no analogue
// NOTE: Not equal to cuMemcpyAtoA due to different signatures
{"cudaMemcpyArrayToArray", {"hipMemcpyArrayToArray", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaMemcpyFromArray", {"hipMemcpyFromArray", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpyFromArrayAsync", {"hipMemcpyFromArrayAsync", "", CONV_MEMORY, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaMemcpyToArray", {"hipMemcpyToArray", "", CONV_MEMORY, API_RUNTIME}},
// no analogue
{"cudaMemcpyToArrayAsync", {"hipMemcpyToArrayAsync", "", CONV_MEMORY, API_RUNTIME}},
// 5.11.Unified Addressing
// no analogue
// NOTE: Not equal to cuPointerGetAttributes due to different signatures
{"cudaPointerGetAttributes", {"hipPointerGetAttributes", "", CONV_ADDRESSING, API_RUNTIME}},
// 5.12. Peer Device Memory Access
// cuDeviceCanAccessPeer
{"cudaDeviceCanAccessPeer", {"hipDeviceCanAccessPeer", "", CONV_PEER, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuCtxDisablePeerAccess due to different signatures
{"cudaDeviceDisablePeerAccess", {"hipDeviceDisablePeerAccess", "", CONV_PEER, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuCtxEnablePeerAccess due to different signatures
{"cudaDeviceEnablePeerAccess", {"hipDeviceEnablePeerAccess", "", CONV_PEER, API_RUNTIME}},
// 5.13. OpenGL Interoperability
// cuGLGetDevices
{"cudaGLGetDevices", {"hipGLGetDevices", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsGLRegisterBuffer
{"cudaGraphicsGLRegisterBuffer", {"hipGraphicsGLRegisterBuffer", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsGLRegisterImage
{"cudaGraphicsGLRegisterImage", {"hipGraphicsGLRegisterImage", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuWGLGetDevice
{"cudaWGLGetDevice", {"hipWGLGetDevice", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.14. OpenGL Interoperability [DEPRECATED]
// no analogue
// NOTE: Not equal to cuGLMapBufferObject due to different signatures
{"cudaGLMapBufferObject", {"hipGLMapBufferObject", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cuGLMapBufferObjectAsync due to different signatures
{"cudaGLMapBufferObjectAsync", {"hipGLMapBufferObjectAsync", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGLRegisterBufferObject
{"cudaGLRegisterBufferObject", {"hipGLRegisterBufferObject", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGLSetBufferObjectMapFlags
{"cudaGLSetBufferObjectMapFlags", {"hipGLSetBufferObjectMapFlags", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaGLSetGLDevice", {"hipGLSetGLDevice", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGLUnmapBufferObject
{"cudaGLUnmapBufferObject", {"hipGLUnmapBufferObject", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGLUnmapBufferObjectAsync
{"cudaGLUnmapBufferObjectAsync", {"hipGLUnmapBufferObjectAsync", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGLUnregisterBufferObject
{"cudaGLUnregisterBufferObject", {"hipGLUnregisterBufferObject", "", CONV_OPENGL, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.15. Direct3D 9 Interoperability
// cuD3D9GetDevice
{"cudaD3D9GetDevice", {"hipD3D9GetDevice", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9GetDevices
{"cudaD3D9GetDevices", {"hipD3D9GetDevices", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9GetDirect3DDevice
{"cudaD3D9GetDirect3DDevice", {"hipD3D9GetDirect3DDevice", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaD3D9SetDirect3DDevice", {"hipD3D9SetDirect3DDevice", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsD3D9RegisterResource
{"cudaGraphicsD3D9RegisterResource", {"hipGraphicsD3D9RegisterResource", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.16.Direct3D 9 Interoperability[DEPRECATED]
// cuD3D9MapResources
{"cudaD3D9MapResources", {"hipD3D9MapResources", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9RegisterResource
{"cudaD3D9RegisterResource", {"hipD3D9RegisterResource", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9ResourceGetMappedArray
{"cudaD3D9ResourceGetMappedArray", {"hipD3D9ResourceGetMappedArray", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cudaD3D9ResourceGetMappedPitch
{"cudaD3D9ResourceGetMappedPitch", {"hipD3D9ResourceGetMappedPitch", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9ResourceGetMappedPointer
{"cudaD3D9ResourceGetMappedPointer", {"hipD3D9ResourceGetMappedPointer", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9ResourceGetMappedSize
{"cudaD3D9ResourceGetMappedSize", {"hipD3D9ResourceGetMappedSize", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9ResourceGetSurfaceDimensions
{"cudaD3D9ResourceGetSurfaceDimensions", {"hipD3D9ResourceGetSurfaceDimensions", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9ResourceSetMapFlags
{"cudaD3D9ResourceSetMapFlags", {"hipD3D9ResourceSetMapFlags", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9UnmapResources
{"cudaD3D9UnmapResources", {"hipD3D9UnmapResources", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D9UnregisterResource
{"cudaD3D9UnregisterResource", {"hipD3D9UnregisterResource", "", CONV_D3D9, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.17. Direct3D 10 Interoperability
// cuD3D10GetDevice
{"cudaD3D10GetDevice", {"hipD3D10GetDevice", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10GetDevices
{"cudaD3D10GetDevices", {"hipD3D10GetDevices", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsD3D10RegisterResource
{"cudaGraphicsD3D10RegisterResource", {"hipGraphicsD3D10RegisterResource", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.18. Direct3D 10 Interoperability [DEPRECATED]
// cudaD3D10GetDirect3DDevice
{"cudaD3D10GetDirect3DDevice", {"hipD3D10GetDirect3DDevice", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10MapResources
{"cudaD3D10MapResources", {"hipD3D10MapResources", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10RegisterResource
{"cudaD3D10RegisterResource", {"hipD3D10RegisterResource", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10ResourceGetMappedArray
{"cudaD3D10ResourceGetMappedArray", {"hipD3D10ResourceGetMappedArray", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cudaD3D10ResourceGetMappedPitch
{"cudaD3D10ResourceGetMappedPitch", {"hipD3D10ResourceGetMappedPitch", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10ResourceGetMappedPointer
{"cudaD3D10ResourceGetMappedPointer", {"hipD3D10ResourceGetMappedPointer", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10ResourceGetMappedSize
{"cudaD3D10ResourceGetMappedSize", {"hipD3D10ResourceGetMappedSize", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10ResourceGetSurfaceDimensions
{"cudaD3D10ResourceGetSurfaceDimensions", {"hipD3D10ResourceGetSurfaceDimensions", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10ResourceSetMapFlags
{"cudaD3D10ResourceSetMapFlags", {"hipD3D10ResourceSetMapFlags", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaD3D10SetDirect3DDevice", {"hipD3D10SetDirect3DDevice", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10UnmapResources
{"cudaD3D10UnmapResources", {"hipD3D10UnmapResources", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D10UnregisterResource
{"cudaD3D10UnregisterResource", {"hipD3D10UnregisterResource", "", CONV_D3D10, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.19. Direct3D 11 Interoperability
// cuD3D11GetDevice
{"cudaD3D11GetDevice", {"hipD3D11GetDevice", "", CONV_D3D11, API_RUNTIME, HIP_UNSUPPORTED}},
// cuD3D11GetDevices
{"cudaD3D11GetDevices", {"hipD3D11GetDevices", "", CONV_D3D11, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsD3D11RegisterResource
{"cudaGraphicsD3D11RegisterResource", {"hipGraphicsD3D11RegisterResource", "", CONV_D3D11, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.20. Direct3D 11 Interoperability [DEPRECATED]
// cuD3D11GetDirect3DDevice
{"cudaD3D11GetDirect3DDevice", {"hipD3D11GetDirect3DDevice", "", CONV_D3D11, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaD3D11SetDirect3DDevice", {"hipD3D11SetDirect3DDevice", "", CONV_D3D11, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.21. VDPAU Interoperability
// cuGraphicsVDPAURegisterOutputSurface
{"cudaGraphicsVDPAURegisterOutputSurface", {"hipGraphicsVDPAURegisterOutputSurface", "", CONV_VDPAU, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsVDPAURegisterVideoSurface
{"cudaGraphicsVDPAURegisterVideoSurface", {"hipGraphicsVDPAURegisterVideoSurface", "", CONV_VDPAU, API_RUNTIME, HIP_UNSUPPORTED}},
// cuVDPAUGetDevice
{"cudaVDPAUGetDevice", {"hipVDPAUGetDevice", "", CONV_VDPAU, API_RUNTIME, HIP_UNSUPPORTED}},
// no analogue
{"cudaVDPAUSetVDPAUDevice", {"hipVDPAUSetDevice", "", CONV_VDPAU, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.22. EGL Interoperability
// cuEGLStreamConsumerAcquireFrame
{"cudaEGLStreamConsumerAcquireFrame", {"hipEGLStreamConsumerAcquireFrame", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamConsumerConnect
{"cudaEGLStreamConsumerConnect", {"hipEGLStreamConsumerConnect", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamConsumerConnectWithFlags
{"cudaEGLStreamConsumerConnectWithFlags", {"hipEGLStreamConsumerConnectWithFlags", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamConsumerDisconnect
{"cudaEGLStreamConsumerDisconnect", {"hipEGLStreamConsumerDisconnect", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamConsumerReleaseFrame
{"cudaEGLStreamConsumerReleaseFrame", {"hipEGLStreamConsumerReleaseFrame", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamProducerConnect
{"cudaEGLStreamProducerConnect", {"hipEGLStreamProducerConnect", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamProducerDisconnect
{"cudaEGLStreamProducerDisconnect", {"hipEGLStreamProducerDisconnect", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamProducerPresentFrame
{"cudaEGLStreamProducerPresentFrame", {"hipEGLStreamProducerPresentFrame", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEGLStreamProducerReturnFrame
{"cudaEGLStreamProducerReturnFrame", {"hipEGLStreamProducerReturnFrame", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuEventCreateFromEGLSync
{"cudaEventCreateFromEGLSync", {"hipEventCreateFromEGLSync", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsEGLRegisterImage
{"cudaGraphicsEGLRegisterImage", {"hipGraphicsEGLRegisterImage", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsResourceGetMappedEglFrame
{"cudaGraphicsResourceGetMappedEglFrame", {"hipGraphicsResourceGetMappedEglFrame", "", CONV_EGL, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.23. Graphics Interoperability
// cuGraphicsMapResources
{"cudaGraphicsMapResources", {"hipGraphicsMapResources", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsResourceGetMappedMipmappedArray
{"cudaGraphicsResourceGetMappedMipmappedArray", {"hipGraphicsResourceGetMappedMipmappedArray", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsResourceGetMappedPointer
{"cudaGraphicsResourceGetMappedPointer", {"hipGraphicsResourceGetMappedPointer", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsResourceSetMapFlags
{"cudaGraphicsResourceSetMapFlags", {"hipGraphicsResourceSetMapFlags", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsSubResourceGetMappedArray
{"cudaGraphicsSubResourceGetMappedArray", {"hipGraphicsSubResourceGetMappedArray", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsUnmapResources
{"cudaGraphicsUnmapResources", {"hipGraphicsUnmapResources", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphicsUnregisterResource
{"cudaGraphicsUnregisterResource", {"hipGraphicsUnregisterResource", "", CONV_GRAPHICS, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.24. Texture Reference Management [DEPRECATED]
// no analogue
{"cudaBindTexture", {"hipBindTexture", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
{"cudaBindTexture2D", {"hipBindTexture2D", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
{"cudaBindTextureToArray", {"hipBindTextureToArray", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
// NOTE: Unsupported yet on NVCC path
{"cudaBindTextureToMipmappedArray", {"hipBindTextureToMipmappedArray", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
{"cudaCreateChannelDesc", {"hipCreateChannelDesc", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
{"cudaGetChannelDesc", {"hipGetChannelDesc", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
{"cudaGetTextureAlignmentOffset", {"hipGetTextureAlignmentOffset", "", CONV_TEXTURE, API_RUNTIME}},
// TODO: double check cuModuleGetTexRef
// NOTE: Unsupported yet on NVCC path
{"cudaGetTextureReference", {"hipGetTextureReference", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
{"cudaUnbindTexture", {"hipUnbindTexture", "", CONV_TEXTURE, API_RUNTIME}},
// 5.25. Surface Reference Management [DEPRECATED]
// no analogue
{"cudaBindSurfaceToArray", {"hipBindSurfaceToArray", "", CONV_SURFACE, API_RUNTIME, HIP_UNSUPPORTED}},
// TODO: double check cuModuleGetSurfRef
{"cudaGetSurfaceReference", {"hipGetSurfaceReference", "", CONV_SURFACE, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.26. Texture Object Management
// no analogue
// NOTE: Not equal to cuTexObjectCreate due to different signatures
{"cudaCreateTextureObject", {"hipCreateTextureObject", "", CONV_TEXTURE, API_RUNTIME}},
// cuTexObjectDestroy
{"cudaDestroyTextureObject", {"hipDestroyTextureObject", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuTexObjectGetResourceDesc due to different signatures
{"cudaGetTextureObjectResourceDesc", {"hipGetTextureObjectResourceDesc", "", CONV_TEXTURE, API_RUNTIME}},
// cuTexObjectGetResourceViewDesc
{"cudaGetTextureObjectResourceViewDesc", {"hipGetTextureObjectResourceViewDesc", "", CONV_TEXTURE, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cudaGetTextureObjectTextureDesc due to different signatures
{"cuTexObjectGetTextureDesc", {"hipGetTextureObjectTextureDesc", "", CONV_TEXTURE, API_RUNTIME}},
// 5.27. Surface Object Management
// no analogue
// NOTE: Not equal to cuSurfObjectCreate due to different signatures
{"cudaCreateSurfaceObject", {"hipCreateSurfaceObject", "", CONV_SURFACE, API_RUNTIME}},
// cuSurfObjectDestroy
{"cudaDestroySurfaceObject", {"hipDestroySurfaceObject", "", CONV_SURFACE, API_RUNTIME}},
// no analogue
// NOTE: Not equal to cuSurfObjectGetResourceDesc due to different signatures
{"cudaGetSurfaceObjectResourceDesc", {"hipGetSurfaceObjectResourceDesc", "", CONV_SURFACE, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.28.Version Management
// cuDriverGetVersion
{"cudaDriverGetVersion", {"hipDriverGetVersion", "", CONV_VERSION, API_RUNTIME}},
// no analogue
{"cudaRuntimeGetVersion", {"hipRuntimeGetVersion", "", CONV_VERSION, API_RUNTIME}},
// 5.29. Graph Management
// cuGraphAddChildGraphNode
{"cudaGraphAddChildGraphNode", {"hipGraphAddChildGraphNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphAddDependencies
{"cudaGraphAddDependencies", {"hipGraphAddDependencies", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphAddEmptyNode
{"cudaGraphAddEmptyNode", {"hipGraphAddEmptyNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphAddHostNode
{"cudaGraphAddHostNode", {"hipGraphAddHostNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphAddKernelNode
{"cudaGraphAddKernelNode", {"hipGraphAddKernelNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphAddMemcpyNode
{"cudaGraphAddMemcpyNode", {"hipGraphAddMemcpyNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphAddMemsetNode
{"cudaGraphAddMemsetNode", {"hipGraphAddMemsetNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphChildGraphNodeGetGraph
{"cudaGraphChildGraphNodeGetGraph", {"hipGraphChildGraphNodeGetGraph", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphClone
{"cudaGraphClone", {"hipGraphClone", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphCreate
{"cudaGraphCreate", {"hipGraphCreate", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphDestroy
{"cudaGraphDestroy", {"hipGraphDestroy", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphDestroyNode
{"cudaGraphDestroyNode", {"hipGraphDestroyNode", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecDestroy
{"cudaGraphExecDestroy", {"hipGraphExecDestroy", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphGetEdges
{"cudaGraphGetEdges", {"hipGraphGetEdges", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphGetNodes
{"cudaGraphGetNodes", {"hipGraphGetNodes", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphGetRootNodes
{"cudaGraphGetRootNodes", {"hipGraphGetRootNodes", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphHostNodeGetParams
{"cudaGraphHostNodeGetParams", {"hipGraphHostNodeGetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphHostNodeSetParams
{"cudaGraphHostNodeSetParams", {"hipGraphHostNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphInstantiate
{"cudaGraphInstantiate", {"hipGraphInstantiate", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecKernelNodeSetParams
{"cudaGraphExecKernelNodeSetParams", {"hipGraphExecKernelNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecMemcpyNodeSetParams
{"cudaGraphExecMemcpyNodeSetParams", {"hipGraphExecMemcpyNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecMemsetNodeSetParams
{"cudaGraphExecMemsetNodeSetParams", {"hipGraphExecMemsetNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecHostNodeSetParams
{"cudaGraphExecHostNodeSetParams", {"hipGraphExecHostNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecUpdate
{"cudaGraphExecUpdate", {"hipGraphExecUpdate", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphKernelNodeGetParams
{"cudaGraphKernelNodeGetParams", {"hipGraphKernelNodeGetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphKernelNodeSetParams
{"cudaGraphKernelNodeSetParams", {"hipGraphKernelNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphLaunch
{"cudaGraphLaunch", {"hipGraphLaunch", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphMemcpyNodeGetParams
{"cudaGraphMemcpyNodeGetParams", {"hipGraphMemcpyNodeGetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphMemcpyNodeSetParams
{"cudaGraphMemcpyNodeSetParams", {"hipGraphMemcpyNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphMemsetNodeGetParams
{"cudaGraphMemsetNodeGetParams", {"hipGraphMemsetNodeGetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphMemsetNodeSetParams
{"cudaGraphMemsetNodeSetParams", {"hipGraphMemsetNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphNodeFindInClone
{"cudaGraphNodeFindInClone", {"hipGraphNodeFindInClone", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphNodeGetDependencies
{"cudaGraphNodeGetDependencies", {"hipGraphNodeGetDependencies", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphNodeGetDependentNodes
{"cudaGraphNodeGetDependentNodes", {"hipGraphNodeGetDependentNodes", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphNodeGetType
{"cudaGraphNodeGetType", {"hipGraphNodeGetType", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphRemoveDependencies
{"cudaGraphRemoveDependencies", {"hipGraphRemoveDependencies", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// 5.32. Profiler Control
// cuProfilerInitialize
{"cudaProfilerInitialize", {"hipProfilerInitialize", "", CONV_PROFILER, API_RUNTIME, HIP_UNSUPPORTED}},
// cuProfilerStart
{"cudaProfilerStart", {"hipProfilerStart", "", CONV_PROFILER, API_RUNTIME}},
// cuProfilerStop
{"cudaProfilerStop", {"hipProfilerStop", "", CONV_PROFILER, API_RUNTIME}},
};
File diff suppressed because it is too large Load Diff
@@ -1,758 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps the names of CUDA SPARSE API functions to the corresponding HIP functions
const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_FUNCTION_MAP{
// 5. cuSPARSE Helper Function Reference
{"cusparseCreate", {"hipsparseCreate", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateSolveAnalysisInfo", {"hipsparseCreateSolveAnalysisInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateHybMat", {"hipsparseCreateHybMat", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateMatDescr", {"hipsparseCreateMatDescr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroy", {"hipsparseDestroy", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroySolveAnalysisInfo", {"hipsparseDestroySolveAnalysisInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyHybMat", {"hipsparseDestroyHybMat", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroyMatDescr", {"hipsparseDestroyMatDescr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetLevelInfo", {"hipsparseGetLevelInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseGetMatDiagType", {"hipsparseGetMatDiagType", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetMatFillMode", {"hipsparseGetMatFillMode", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetMatIndexBase", {"hipsparseGetMatIndexBase", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetMatType", {"hipsparseGetMatType", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetPointerMode", {"hipsparseGetPointerMode", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetVersion", {"hipsparseGetVersion", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSetMatDiagType", {"hipsparseSetMatDiagType", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSetMatFillMode", {"hipsparseSetMatFillMode", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSetMatIndexBase", {"hipsparseSetMatIndexBase", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSetMatType", {"hipsparseSetMatType", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSetPointerMode", {"hipsparseSetPointerMode", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSetStream", {"hipsparseSetStream", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseGetStream", {"hipsparseGetStream", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateCsrsv2Info", {"hipsparseCreateCsrsv2Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroyCsrsv2Info", {"hipsparseDestroyCsrsv2Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateCsrsm2Info", {"hipsparseCreateCsrsm2Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroyCsrsm2Info", {"hipsparseDestroyCsrsm2Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateCsric02Info", {"hipsparseCreateCsric02Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyCsric02Info", {"hipsparseDestroyCsric02Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateCsrilu02Info", {"hipsparseCreateCsrilu02Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroyCsrilu02Info", {"hipsparseDestroyCsrilu02Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateBsrsv2Info", {"hipsparseCreateBsrsv2Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyBsrsv2Info", {"hipsparseDestroyBsrsv2Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateBsrsm2Info", {"hipsparseCreateBsrsm2Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyBsrsm2Info", {"hipsparseDestroyBsrsm2Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateBsric02Inf", {"hipsparseCreateBsric02Inf", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyBsric02Info", {"hipsparseDestroyBsric02Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateBsrilu02Info", {"hipsparseCreateBsrilu02Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyBsrilu02Info", {"hipsparseDestroyBsrilu02Info", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateCsrgemm2Info", {"hipsparseCreateCsrgemm2Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDestroyCsrgemm2Info", {"hipsparseDestroyCsrgemm2Info", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreatePruneInfo", {"hipsparseCreatePruneInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyPruneInfo", {"hipsparseDestroyPruneInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 6. cuSPARSE Level 1 Function Reference
{"cusparseSaxpyi", {"hipsparseSaxpyi", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDaxpyi", {"hipsparseDaxpyi", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCaxpyi", {"hipsparseCaxpyi", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZaxpyi", {"hipsparseZaxpyi", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSdoti", {"hipsparseSdoti", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDdoti", {"hipsparseDdoti", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCdoti", {"hipsparseCdoti", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZdoti", {"hipsparseZdoti", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCdotci", {"hipsparseCdotci", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZdotci", {"hipsparseZdotci", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSgthr", {"hipsparseSgthr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDgthr", {"hipsparseDgthr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCgthr", {"hipsparseCgthr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZgthr", {"hipsparseZgthr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSgthrz", {"hipsparseSgthrz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDgthrz", {"hipsparseDgthrz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCgthrz", {"hipsparseCgthrz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZgthrz", {"hipsparseZgthrz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSroti", {"hipsparseSroti", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDroti", {"hipsparseDroti", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSsctr", {"hipsparseSsctr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDsctr", {"hipsparseDsctr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCsctr", {"hipsparseCsctr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZsctr", {"hipsparseZsctr", "", CONV_LIB_FUNC, API_SPARSE}},
// 7. cuSPARSE Level 2 Function Reference
{"cusparseSbsrmv", {"hipsparseSbsrmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrmv", {"hipsparseDbsrmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrmv", {"hipsparseCbsrmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrmv", {"hipsparseZbsrmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrxmv", {"hipsparseSbsrxmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrxmv", {"hipsparseDbsrxmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrxmv", {"hipsparseCbsrxmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrxmv", {"hipsparseZbsrxmv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrmv", {"hipsparseScsrmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrmv", {"hipsparseDcsrmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrmv", {"hipsparseCcsrmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrmv", {"hipsparseZcsrmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCsrmvEx", {"hipsparseCsrmvEx", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsrmvEx_bufferSize", {"hipsparseCsrmvEx_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrmv_mp", {"hipsparseScsrmv_mp", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrmv_mp", {"hipsparseDcsrmv_mp", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrmv_mp", {"hipsparseCcsrmv_mp", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrmv_mp", {"hipsparseZcsrmv_mp", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgemvi", {"hipsparseSgemvi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgemvi", {"hipsparseDgemvi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgemvi", {"hipsparseCgemvi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgemvi", {"hipsparseZgemvi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgemvi_bufferSize", {"hipsparseSgemvi_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgemvi_bufferSize", {"hipsparseDgemvi_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgemvi_bufferSize", {"hipsparseCgemvi_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgemvi_bufferSize", {"hipsparseZgemvi_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsv2_bufferSize", {"hipsparseSbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsv2_bufferSizeExt", {"hipsparseSbsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsv2_bufferSize", {"hipsparseDbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsv2_bufferSizeExt", {"hipsparseDbsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsv2_bufferSize", {"hipsparseCbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsv2_bufferSizeExt", {"hipsparseCbsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsv2_bufferSize", {"hipsparseZbsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsv2_bufferSizeExt", {"hipsparseZbsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsv2_analysis", {"hipsparseSbsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsv2_analysis", {"hipsparseDbsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsv2_analysis", {"hipsparseCbsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsv2_analysis", {"hipsparseZbsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrsv_solve", {"hipsparseScsrsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrsv_solve", {"hipsparseDcsrsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrsv_solve", {"hipsparseCcsrsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrsv_solve", {"hipsparseZcsrsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsv2_solve", {"hipsparseSbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsv2_solve", {"hipsparseDbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsv2_solve", {"hipsparseCbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsv2_solve", {"hipsparseZbsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXbsrsv2_zeroPivot", {"hipsparseXbsrsv2_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrsv_analysis", {"hipsparseScsrsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrsv_analysis", {"hipsparseDcsrsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrsv_analysis", {"hipsparseCcsrsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrsv_analysis", {"hipsparseZcsrsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsrsv_analysisEx", {"hipsparseCsrsv_analysisEx", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsrsv_solveEx", {"hipsparseCsrsv_solveEx", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrsv2_bufferSize", {"hipsparseScsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsv2_bufferSizeExt", {"hipsparseScsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsv2_bufferSize", {"hipsparseDcsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsv2_bufferSizeExt", {"hipsparseDcsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrsv2_bufferSize", {"hipsparseCcsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrsv2_bufferSizeExt", {"hipsparseCcsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsv2_bufferSize", {"hipsparseZcsrsv2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsv2_bufferSizeExt", {"hipsparseZcsrsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsv2_analysis", {"hipsparseScsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsv2_analysis", {"hipsparseDcsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrsv2_analysis", {"hipsparseCcsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsv2_analysis", {"hipsparseZcsrsv2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsv2_solve", {"hipsparseScsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsv2_solve", {"hipsparseDcsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrsv2_solve", {"hipsparseCcsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsv2_solve", {"hipsparseZcsrsv2_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcsrsv2_zeroPivot", {"hipsparseXcsrsv2_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseShybmv", {"hipsparseShybmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDhybmv", {"hipsparseDhybmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseChybmv", {"hipsparseChybmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZhybmv", {"hipsparseZhybmv", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseShybsv_analysis", {"hipsparseShybsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDhybsv_analysis", {"hipsparseDhybsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseChybsv_analysis", {"hipsparseChybsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZhybsv_analysis", {"hipsparseZhybsv_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseShybsv_solve", {"hipsparseShybsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDhybsv_solve", {"hipsparseDhybsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseChybsv_solve", {"hipsparseChybsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZhybsv_solve", {"hipsparseZhybsv_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 8. cuSPARSE Level 3 Function Reference
{"cusparseScsrmm", {"hipsparseScsrmm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrmm", {"hipsparseDcsrmm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrmm", {"hipsparseCcsrmm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrmm", {"hipsparseZcsrmm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrmm2", {"hipsparseScsrmm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrmm2", {"hipsparseDcsrmm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrmm2", {"hipsparseCcsrmm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrmm2", {"hipsparseZcsrmm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsm_analysis", {"hipsparseScsrsm_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrsm_analysis", {"hipsparseDcsrsm_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrsm_analysis", {"hipsparseCcsrsm_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrsm_analysis", {"hipsparseZcsrsm_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrsm_solve", {"hipsparseScsrsm_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsm_solve", {"hipsparseDcsrsm_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrsm_solve", {"hipsparseCcsrsm_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsm_solve", {"hipsparseZcsrsm_solve", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsm2_bufferSizeExt", {"hipsparseScsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsm2_bufferSizeExt", {"hipsparseDcsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE,}},
{"cusparseCcsrsm2_bufferSizeExt", {"hipsparseCcsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsm2_bufferSizeExt", {"hipsparseZcsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsm2_analysis", {"hipsparseScsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrsm2_analysis", {"hipsparseDcsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrsm2_analysis", {"hipsparseCcsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrsm2_analysis", {"hipsparseZcsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrsm2_solve", {"hipsparseScsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrsm2_solve", {"hipsparseDcsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrsm2_solve", {"hipsparseCcsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrsm2_solve", {"hipsparseZcsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsrsm2_zeroPivot", {"hipsparseXcsrsm2_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSbsrmm", {"hipsparseSbsrmm", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrmm", {"hipsparseDbsrmm", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrmm", {"hipsparseCbsrmm", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrmm", {"hipsparseZbsrmm", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsm2_bufferSize", {"hipsparseCbsrsm2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsm2_bufferSizeExt", {"hipsparseCbsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsm2_bufferSize", {"hipsparseDbsrsm2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsm2_bufferSizeExt", {"hipsparseDbsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsm2_bufferSize", {"hipsparseCbsrsm2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsm2_bufferSizeExt", {"hipsparseCbsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsm2_bufferSize", {"hipsparseZbsrsm2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsm2_bufferSizeExt", {"hipsparseZbsrsm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsm2_analysis", {"hipsparseSbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsm2_analysis", {"hipsparseDbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsm2_analysis", {"hipsparseCbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsm2_analysis", {"hipsparseZbsrsm2_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrsm2_solve", {"hipsparseSbsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrsm2_solve", {"hipsparseDbsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrsm2_solve", {"hipsparseCbsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrsm2_solve", {"hipsparseZbsrsm2_solve", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXbsrsm2_zeroPivot", {"hipsparseXbsrsm2_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgemmi", {"hipsparseSgemmi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgemmi", {"hipsparseDgemmi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgemmi", {"hipsparseCgemmi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgemmi", {"hipsparseZgemmi", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 9. cuSPARSE Extra Function Reference
{"cusparseXcsrgeamNnz", {"hipsparseXcsrgeamNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrgeam", {"hipsparseScsrgeam", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrgeam", {"hipsparseDcsrgeam", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrgeam", {"hipsparseCcsrgeam", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrgeam", {"hipsparseZcsrgeam", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsrgeam2Nnz", {"hipsparseXcsrgeam2Nnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrgeam2", {"hipsparseScsrgeam2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrgeam2", {"hipsparseDcsrgeam2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrgeam2", {"hipsparseCcsrgeam2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrgeam2", {"hipsparseZcsrgeam2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrgeam2_bufferSizeExt", {"hipsparseScsrgeam2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrgeam2_bufferSizeExt", {"hipsparseDcsrgeam2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrgeam2_bufferSizeExt", {"hipsparseCcsrgeam2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrgeam2_bufferSizeExt", {"hipsparseZcsrgeam2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsrgemmNnz", {"hipsparseXcsrgemmNnz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrgemm", {"hipsparseScsrgemm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrgemm", {"hipsparseDcsrgemm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrgemm", {"hipsparseCcsrgemm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrgemm", {"hipsparseZcsrgemm", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcsrgemm2Nnz", {"hipsparseXcsrgemm2Nnz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrgemm2", {"hipsparseScsrgemm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrgemm2", {"hipsparseDcsrgemm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrgemm2", {"hipsparseCcsrgemm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrgemm2", {"hipsparseZcsrgemm2", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrgemm2_bufferSizeExt", {"hipsparseScsrgemm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrgemm2_bufferSizeExt", {"hipsparseDcsrgemm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrgemm2_bufferSizeExt", {"hipsparseCcsrgemm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrgemm2_bufferSizeExt", {"hipsparseZcsrgemm2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
// 10. cuSPARSE Preconditioners Reference
// 10.1. Incomplete Cholesky Factorization : level 0
{"cusparseScsric0", {"hipsparseScsric0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsric0", {"hipsparseDcsric0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsric0", {"hipsparseCcsric0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsric0", {"hipsparseZcsric0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsric02_bufferSize", {"hipsparseScsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsric02_bufferSizeExt", {"hipsparseScsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsric02_bufferSize", {"hipsparseDcsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsric02_bufferSizeExt", {"hipsparseDcsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsric02_bufferSize", {"hipsparseCcsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsric02_bufferSizeExt", {"hipsparseCcsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsric02_bufferSize", {"hipsparseZcsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsric02_bufferSizeExt", {"hipsparseZcsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsric02_analysis", {"hipsparseScsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsric02_analysis", {"hipsparseDcsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsric02_analysis", {"hipsparseCcsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsric02_analysis", {"hipsparseZcsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsric02", {"hipsparseScsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsric02", {"hipsparseDcsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsric02", {"hipsparseCcsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsric02", {"hipsparseZcsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsric02_zeroPivot", {"hipsparseXcsric02_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsric02_bufferSize", {"hipsparseSbsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsric02_bufferSizeExt", {"hipsparseSbsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsric02_bufferSize", {"hipsparseDbsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsric02_bufferSizeExt", {"hipsparseDbsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsric02_bufferSize", {"hipsparseCbsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsric02_bufferSizeExt", {"hipsparseCbsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsric02_bufferSize", {"hipsparseZbsric02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsric02_bufferSizeExt", {"hipsparseZbsric02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsric02_analysis", {"hipsparseSbsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsric02_analysis", {"hipsparseDbsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsric02_analysis", {"hipsparseCbsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsric02_analysis", {"hipsparseZbsric02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsric02", {"hipsparseSbsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsric02", {"hipsparseDbsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsric02", {"hipsparseCbsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsric02", {"hipsparseZbsric02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXbsric02_zeroPivot", {"hipsparseXbsric02_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 10.2. Incomplete LU Factorization: level 0
{"cusparseScsrilu0", {"hipsparseScsrilu0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrilu0", {"hipsparseDcsrilu0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrilu0", {"hipsparseCcsrilu0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrilu0", {"hipsparseZcsrilu0", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsrilu0Ex", {"hipsparseCsrilu0Ex", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsrilu02_numericBoost", {"hipsparseScsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrilu02_numericBoost", {"hipsparseDcsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrilu02_numericBoost", {"hipsparseCcsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrilu02_numericBoost", {"hipsparseZcsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsrilu02_zeroPivot", {"hipsparseXcsrilu02_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrilu02_bufferSize", {"hipsparseScsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrilu02_bufferSizeExt", {"hipsparseScsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrilu02_bufferSize", {"hipsparseDcsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrilu02_bufferSizeExt", {"hipsparseDcsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrilu02_bufferSize", {"hipsparseCcsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrilu02_bufferSizeExt", {"hipsparseCcsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrilu02_bufferSize", {"hipsparseZcsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrilu02_bufferSizeExt", {"hipsparseZcsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrilu02_analysis", {"hipsparseScsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrilu02_analysis", {"hipsparseDcsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrilu02_analysis", {"hipsparseCcsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrilu02_analysis", {"hipsparseZcsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsrilu02", {"hipsparseScsrilu02", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsrilu02", {"hipsparseDcsrilu02", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsrilu02", {"hipsparseCcsrilu02", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsrilu02", {"hipsparseZcsrilu02", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXbsric02_zeroPivot", {"hipsparseXcsrilu02_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSbsrilu02_numericBoost", {"hipsparseSbsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrilu02_numericBoost", {"hipsparseDbsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrilu02_numericBoost", {"hipsparseCbsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrilu02_numericBoost", {"hipsparseZbsrilu02_numericBoost", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrilu02_bufferSize", {"hipsparseSbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrilu02_bufferSizeExt", {"hipsparseSbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrilu02_bufferSize", {"hipsparseDbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrilu02_bufferSizeExt", {"hipsparseDbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrilu02_bufferSize", {"hipsparseCbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrilu02_bufferSizeExt", {"hipsparseCbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrilu02_bufferSize", {"hipsparseZbsrilu02_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrilu02_bufferSizeExt", {"hipsparseZbsrilu02_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrilu02_analysis", {"hipsparseSbsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrilu02_analysis", {"hipsparseDbsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrilu02_analysis", {"hipsparseCbsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrilu02_analysis", {"hipsparseZbsrilu02_analysis", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSbsrilu02", {"hipsparseSbsrilu02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsrilu02", {"hipsparseDbsrilu02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsrilu02", {"hipsparseCbsrilu02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsrilu02", {"hipsparseZbsrilu02", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXbsrilu02_zeroPivot", {"hipsparseXbsrilu02_zeroPivot", "", CONV_LIB_FUNC, API_SPARSE}},
// 10.3. Tridiagonal Solve
{"cusparseSgtsv", {"hipsparseSgtsv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv", {"hipsparseDgtsv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv", {"hipsparseCgtsv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv", {"hipsparseZgtsv", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv_nopivot", {"hipsparseSgtsv_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv_nopivot", {"hipsparseDgtsv_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv_nopivot", {"hipsparseCgtsv_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv_nopivot", {"hipsparseZgtsv_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv2_bufferSizeExt", {"hipsparseSgtsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv2_bufferSizeExt", {"hipsparseDgtsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv2_bufferSizeExt", {"hipsparseCgtsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv2_bufferSizeExt", {"hipsparseZgtsv2_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv2", {"hipsparseSgtsv2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv2", {"hipsparseDgtsv2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv2", {"hipsparseCgtsv2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv2", {"hipsparseZgtsv2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv2_nopivot_bufferSizeExt", {"hipsparseSgtsv2_nopivot_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv2_nopivot_bufferSizeExt", {"hipsparseDgtsv2_nopivot_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv2_nopivot_bufferSizeExt", {"hipsparseCgtsv2_nopivot_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv2_nopivot_bufferSizeExt", {"hipsparseZgtsv2_nopivot_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv2_nopivot", {"hipsparseSgtsv2_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv2_nopivot", {"hipsparseDgtsv2_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv2_nopivot", {"hipsparseCgtsv2_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv2_nopivot", {"hipsparseZgtsv2_nopivot", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 10.4. Batched Tridiagonal Solve
{"cusparseSgtsvStridedBatch", {"hipsparseSgtsvStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsvStridedBatch", {"hipsparseDgtsvStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsvStridedBatch", {"hipsparseCgtsvStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsvStridedBatch", {"hipsparseZgtsvStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv2StridedBatch_bufferSizeExt", {"hipsparseSgtsv2StridedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv2StridedBatch_bufferSizeExt", {"hipsparseDgtsv2StridedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv2StridedBatch_bufferSizeExt", {"hipsparseCgtsv2StridedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv2StridedBatch_bufferSizeExt", {"hipsparseZgtsv2StridedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsv2StridedBatch", {"hipsparseSgtsv2StridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsv2StridedBatch", {"hipsparseDgtsv2StridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsv2StridedBatch", {"hipsparseCgtsv2StridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsv2StridedBatch", {"hipsparseZgtsv2StridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsvInterleavedBatch_bufferSizeExt", {"hipsparseSgtsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsvInterleavedBatch_bufferSizeExt", {"hipsparseDgtsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsvInterleavedBatch_bufferSizeExt", {"hipsparseCgtsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsvInterleavedBatch_bufferSizeExt", {"hipsparseZgtsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgtsvInterleavedBatch", {"hipsparseSgtsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgtsvInterleavedBatch", {"hipsparseDgtsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgtsvInterleavedBatch", {"hipsparseCgtsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgtsvInterleavedBatch", {"hipsparseZgtsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 10.5. Batched Pentadiagonal Solve
{"cusparseSgpsvInterleavedBatch_bufferSizeExt", {"hipsparseSgpsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgpsvInterleavedBatch_bufferSizeExt", {"hipsparseDgpsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgpsvInterleavedBatch_bufferSizeExt", {"hipsparseCgpsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgpsvInterleavedBatch_bufferSizeExt", {"hipsparseZgpsvInterleavedBatch_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgpsvInterleavedBatch", {"hipsparseSgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgpsvInterleavedBatch", {"hipsparseDgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgpsvInterleavedBatch", {"hipsparseCgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgpsvInterleavedBatch", {"hipsparseZgpsvInterleavedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 11. cuSPARSE Matrix Reorderings Reference
{"cusparseScsrcolor", {"hipsparseScsrcolor", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsrcolor", {"hipsparseDcsrcolor", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsrcolor", {"hipsparseCcsrcolor", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsrcolor", {"hipsparseZcsrcolor", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 12. cuSPARSE Format Conversion Reference
{"cusparseSbsr2csr", {"hipsparseSbsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDbsr2csr", {"hipsparseDbsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCbsr2csr", {"hipsparseCbsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZbsr2csr", {"hipsparseZbsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2gebsc_bufferSize", {"hipsparseSgebsr2gebsc_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2gebsc_bufferSizeExt", {"hipsparseSgebsr2gebsc_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2gebsc_bufferSize", {"hipsparseDgebsr2gebsc_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2gebsc_bufferSizeExt", {"hipsparseDgebsr2gebsc_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2gebsc_bufferSize", {"hipsparseCgebsr2gebsc_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2gebsc_bufferSizeExt", {"hipsparseCgebsr2gebsc_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2gebsc_bufferSize", {"hipsparseZgebsr2gebsc_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2gebsc_bufferSizeExt", {"hipsparseZgebsr2gebsc_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2gebsc", {"hipsparseSgebsr2gebsc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2gebsc", {"hipsparseDgebsr2gebsc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2gebsc", {"hipsparseCgebsr2gebsc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2gebsc", {"hipsparseZgebsr2gebsc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2gebsr_bufferSize", {"hipsparseSgebsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2gebsr_bufferSizeExt", {"hipsparseSgebsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2gebsr_bufferSize", {"hipsparseDgebsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2gebsr_bufferSizeExt", {"hipsparseDgebsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2gebsr_bufferSize", {"hipsparseCgebsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2gebsr_bufferSizeExt", {"hipsparseCgebsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2gebsr_bufferSize", {"hipsparseZgebsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2gebsr_bufferSizeExt", {"hipsparseZgebsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXgebsr2csr", {"hipsparseXgebsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2csr", {"hipsparseSgebsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2csr", {"hipsparseDgebsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2csr", {"hipsparseCgebsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2csr", {"hipsparseZgebsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXgebsr2gebsrNnz", {"hipsparseXgebsr2gebsrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSgebsr2gebsr", {"hipsparseSgebsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDgebsr2gebsr", {"hipsparseDgebsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCgebsr2gebsr", {"hipsparseCgebsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZgebsr2gebsr", {"hipsparseZgebsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2gebsr_bufferSize", {"hipsparseScsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2gebsr_bufferSizeExt", {"hipsparseScsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2gebsr_bufferSize", {"hipsparseDcsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2gebsr_bufferSizeExt", {"hipsparseDcsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2gebsr_bufferSize", {"hipsparseCcsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2gebsr_bufferSizeExt", {"hipsparseCcsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2gebsr_bufferSize", {"hipsparseZcsr2gebsr_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2gebsr_bufferSizeExt", {"hipsparseZcsr2gebsr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsr2gebsrNnz", {"hipsparseXcsr2gebsrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2gebsr", {"hipsparseScsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2gebsr", {"hipsparseDcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2gebsr", {"hipsparseCcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2gebsr", {"hipsparseZcsr2gebsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcoo2csr", {"hipsparseXcoo2csr", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsc2dense", {"hipsparseScsc2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsc2dense", {"hipsparseDcsc2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsc2dense", {"hipsparseCcsc2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsc2dense", {"hipsparseZcsc2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsc2hyb", {"hipsparseScsc2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsc2hyb", {"hipsparseDcsc2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsc2hyb", {"hipsparseCcsc2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsc2hyb", {"hipsparseZcsc2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsr2bsrNnz", {"hipsparseXcsr2bsrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2bsr", {"hipsparseScsr2bsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2bsr", {"hipsparseDcsr2bsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2bsr", {"hipsparseCcsr2bsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2bsr", {"hipsparseZcsr2bsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseXcsr2coo", {"hipsparseXcsr2coo", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseScsr2csc", {"hipsparseScsr2csc", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsr2csc", {"hipsparseDcsr2csc", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsr2csc", {"hipsparseCcsr2csc", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsr2csc", {"hipsparseZcsr2csc", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCsr2cscEx", {"hipsparseCsr2cscEx", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsr2cscEx2", {"hipsparseCsr2cscEx2", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsr2cscEx2_bufferSize", {"hipsparseCsr2cscEx2_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2dense", {"hipsparseScsr2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2dense", {"hipsparseDcsr2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2dense", {"hipsparseCcsr2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2dense", {"hipsparseZcsr2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2csr_compress", {"hipsparseScsr2csr_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2csr_compress", {"hipsparseDcsr2csr_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2csr_compress", {"hipsparseCcsr2csr_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2csr_compress", {"hipsparseZcsr2csr_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2hyb", {"hipsparseScsr2hyb", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDcsr2hyb", {"hipsparseDcsr2hyb", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCcsr2hyb", {"hipsparseCcsr2hyb", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZcsr2hyb", {"hipsparseZcsr2hyb", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseSdense2csc", {"hipsparseSdense2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDdense2csc", {"hipsparseDdense2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCdense2csc", {"hipsparseCdense2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZdense2csc", {"hipsparseZdense2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSdense2csr", {"hipsparseSdense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDdense2csr", {"hipsparseDdense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCdense2csr", {"hipsparseCdense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZdense2csr", {"hipsparseZdense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSdense2hyb", {"hipsparseSdense2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDdense2hyb", {"hipsparseDdense2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCdense2hyb", {"hipsparseCdense2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZdense2hyb", {"hipsparseZdense2hyb", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseShyb2csc", {"hipsparseShyb2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDhyb2csc", {"hipsparseDhyb2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseChyb2csc", {"hipsparseChyb2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZhyb2csc", {"hipsparseZhyb2csc", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseShyb2csr", {"hipsparseShyb2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDhyb2csr", {"hipsparseDhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseChyb2csr", {"hipsparseChyb2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZhyb2csr", {"hipsparseZhyb2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseShyb2dense", {"hipsparseShyb2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDhyb2dense", {"hipsparseDhyb2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseChyb2dense", {"hipsparseChyb2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZhyb2dense", {"hipsparseZhyb2dense", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSnnz", {"hipsparseSnnz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseDnnz", {"hipsparseDnnz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCnnz", {"hipsparseCnnz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseZnnz", {"hipsparseZnnz", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateIdentityPermutation", {"hipsparseCreateIdentityPermutation", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcoosort_bufferSizeExt", {"hipsparseXcoosort_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcoosortByRow", {"hipsparseXcoosortByRow", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcoosortByColumn", {"hipsparseXcoosortByColumn", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcsrsort_bufferSizeExt", {"hipsparseXcsrsort_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcsrsort", {"hipsparseXcsrsort", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcscsort_bufferSizeExt", {"hipsparseXcscsort_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseXcscsort", {"hipsparseXcscsort", "", CONV_LIB_FUNC, API_SPARSE}},
{"cusparseCreateCsru2csrInfo", {"hipsparseCreateCsru2csrInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyCsru2csrInfo", {"hipsparseDestroyCsru2csrInfo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsru2csr_bufferSizeExt", {"hipsparseScsru2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsru2csr_bufferSizeExt", {"hipsparseDcsru2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsru2csr_bufferSizeExt", {"hipsparseCcsru2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsru2csr_bufferSizeExt", {"hipsparseZcsru2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseScsr2csru", {"hipsparseScsr2csru", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDcsr2csru", {"hipsparseDcsr2csru", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCcsr2csru", {"hipsparseCcsr2csru", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZcsr2csru", {"hipsparseZcsr2csru", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneDense2csr", {"hipsparseHpruneDense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneDense2csr", {"hipsparseSpruneDense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneDense2csr", {"hipsparseDpruneDense2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneDense2csr_bufferSizeExt", {"hipsparseHpruneDense2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneDense2csr_bufferSizeExt", {"hipsparseSpruneDense2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneDense2csr_bufferSizeExt", {"hipsparseDpruneDense2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneDense2csrNnz", {"hipsparseHpruneDense2csrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneDense2csrNnz", {"hipsparseSpruneDense2csrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneDense2csrNnz", {"hipsparseDpruneDense2csrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneCsr2csr", {"hipsparseHpruneCsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneCsr2csr", {"hipsparseSpruneCsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneCsr2csr", {"hipsparseDpruneCsr2csr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneCsr2csr_bufferSizeExt", {"hipsparseHpruneCsr2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneCsr2csr_bufferSizeExt", {"hipsparseSpruneCsr2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneCsr2csr_bufferSizeExt", {"hipsparseDpruneCsr2csr_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneCsr2csrNnz", {"hipsparseHpruneCsr2csrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneCsr2csrNnz", {"hipsparseSpruneCsr2csrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneCsr2csrNnz", {"hipsparseDpruneCsr2csrNnz", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneDense2csrByPercentage", {"hipsparseHpruneDense2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneDense2csrByPercentage", {"hipsparseSpruneDense2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneDense2csrByPercentage", {"hipsparseDpruneDense2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneDense2csrByPercentage_bufferSizeExt", {"hipsparseHpruneDense2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneDense2csrByPercentage_bufferSizeExt", {"hipsparseSpruneDense2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneDense2csrByPercentage_bufferSizeExt", {"hipsparseDpruneDense2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneDense2csrNnzByPercentage", {"hipsparseHpruneDense2csrNnzByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneDense2csrNnzByPercentage", {"hipsparseSpruneDense2csrNnzByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneDense2csrNnzByPercentage", {"hipsparseDpruneDense2csrNnzByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneCsr2csrByPercentage", {"hipsparseHpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneCsr2csrByPercentage", {"hipsparseSpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneCsr2csrByPercentage", {"hipsparseDpruneCsr2csrByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseHpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseSpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneCsr2csrByPercentage_bufferSizeExt", {"hipsparseDpruneCsr2csrByPercentage_bufferSizeExt", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHpruneCsr2csrNnzByPercentage", {"hipsparseHpruneCsr2csrNnzByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpruneCsr2csrNnzByPercentage", {"hipsparseSpruneCsr2csrNnzByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDpruneCsr2csrNnzByPercentage", {"hipsparseDpruneCsr2csrNnzByPercentage", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSnnz_compress", {"hipsparseSnnz_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnnz_compress", {"hipsparseDnnz_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCnnz_compress", {"hipsparseCnnz_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseZnnz_compress", {"hipsparseZnnz_compress", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// 13. cuSPARSE Generic API Reference
// Generic Sparse API helper functions
// Sparse Matrix descriptor
{"cusparseCreateCoo", {"hipsparseCreateCoo", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateCooAoS", {"hipsparseCreateCooAoS", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCreateCsr", {"hipsparseCreateCsr", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroySpMat", {"hipsparseDestroySpMat", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCooGet", {"hipsparseCooGet", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCooAoSGet", {"hipsparseCooAoSGet", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseCsrGet", {"hipsparseCsrGet", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatGetFormat", {"hipsparseSpMatGetFormat", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatGetIndexBase", {"hipsparseSpMatGetIndexBase", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatGetValues", {"hipsparseSpMatGetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatSetValues", {"hipsparseSpMatSetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatGetStridedBatch", {"hipsparseSpMatGetStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatSetStridedBatch", {"hipsparseSpMatSetStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatSetNumBatches", {"hipsparseSpMatSetNumBatches", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatGetNumBatches", {"hipsparseSpMatGetNumBatches", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// Sparse Vector descriptor
{"cusparseCreateSpVec", {"hipsparseCreateSpVec", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroySpVec", {"hipsparseDestroySpVec", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVecGet", {"hipsparseSpVecGet", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVecGetIndexBase", {"hipsparseSpVecGetIndexBase", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVecGetValues", {"hipsparseSpVecGetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVecSetValues", {"hipsparseSpVecSetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// Generic Dense API helper functions
// Dense Matrix descriptor
{"cusparseCreateDnMat", {"hipsparseCreateDnMat", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyDnMat", {"hipsparseDestroyDnMat", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatGet", {"hipsparseDnMatGet", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatGetValues", {"hipsparseDnMatGetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatSetValues", {"hipsparseDnMatSetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatSetStridedBatch", {"hipsparseDnMatSetStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatGetStridedBatch", {"hipsparseDnMatGetStridedBatch", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// Dense Vector descriptor
{"cusparseCreateDnVec", {"hipsparseCreateDnVec", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDestroyDnVec", {"hipsparseDestroyDnVec", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnVecGet", {"hipsparseDnVecGet", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnVecGetValues", {"hipsparseDnVecGetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnVecSetValues", {"hipsparseDnVecSetValues", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// Sparse Matrix * Matrix Multiplication
{"cusparseSpMM", {"hipsparseSpMM", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMM_bufferSize", {"hipsparseSpMM_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// Sparse Vector * Vector Multiplication
{"cusparseSpVV", {"hipsparseSpVV", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVV_bufferSize", {"hipsparseSpVV_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
// Sparse Matrix * Vector Multiplication
{"cusparseSpMV", {"hipsparseSpMV", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMV_bufferSize", {"hipsparseSpMV_bufferSize", "", CONV_LIB_FUNC, API_SPARSE, HIP_UNSUPPORTED}},
};
@@ -1,187 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "CUDA2HIP.h"
// Maps the names of CUDA SPARSE API types to the corresponding HIP types
const std::map<llvm::StringRef, hipCounter> CUDA_SPARSE_TYPE_NAME_MAP{
// 1. Structs
{"cusparseContext", {"hipsparseContext", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHandle_t", {"hipsparseHandle_t", "", CONV_TYPE, API_SPARSE}},
{"cusparseHybMat", {"hipsparseHybMat", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseHybMat_t", {"hipsparseHybMat_t", "", CONV_TYPE, API_SPARSE}},
{"cusparseMatDescr", {"hipsparseMatDescr", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseMatDescr_t", {"hipsparseMatDescr_t", "", CONV_TYPE, API_SPARSE}},
{"cusparseSolveAnalysisInfo", {"hipsparseSolveAnalysisInfo", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSolveAnalysisInfo_t", {"hipsparseSolveAnalysisInfo_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csrsv2Info", {"csrsv2Info", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csrsv2Info_t", {"csrsv2Info_t", "", CONV_TYPE, API_SPARSE}},
{"csrsm2Info", {"csrsm2Info", "", CONV_TYPE, API_SPARSE}},
{"csrsm2Info_t", {"csrsm2Info_t", "", CONV_TYPE, API_SPARSE}},
{"bsrsv2Info", {"bsrsv2Info", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"bsrsv2Info_t", {"bsrsv2Info_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"bsrsm2Info", {"bsrsm2Info", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"bsrsm2Info_t", {"bsrsm2Info_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"bsric02Info", {"bsric02Info", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"bsric02Info_t", {"bsric02Info_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csrilu02Info", {"csrilu02Info", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csrilu02Info_t", {"csrilu02Info_t", "", CONV_TYPE, API_SPARSE}},
{"bsrilu02Info", {"bsrilu02Info", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"bsrilu02Info_t", {"bsrilu02Info_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csru2csrInfo", {"csru2csrInfo", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csru2csrInfo_t", {"csru2csrInfo_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"csrgemm2Info", {"csrgemm2Info", "", CONV_TYPE, API_SPARSE}},
{"csrgemm2Info_t", {"csrgemm2Info_t", "", CONV_TYPE, API_SPARSE}},
{"cusparseColorInfo", {"hipsparseColorInfo", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseColorInfo_t", {"hipsparseColorInfo_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"pruneInfo", {"pruneInfo", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"pruneInfo_t", {"pruneInfo_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatDescr", {"hipsparseSpMatDescr", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMatDescr_t", {"hipsparseSpMatDescr_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatDescr", {"hipsparseDnMatDescr", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnMatDescr_t", {"hipsparseDnMatDescr_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVecDescr", {"hipsparseSpVecDescr", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpVecDescr_t", {"hipsparseSpVecDescr_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnVecDescr", {"hipsparseDnVecDescr", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseDnVecDescr_t", {"hipsparseDnVecDescr_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
// 2. Enums
{"cusparseAction_t", {"hipsparseAction_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_ACTION_SYMBOLIC", {"HIPSPARSE_ACTION_SYMBOLIC", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_ACTION_NUMERIC", {"HIPSPARSE_ACTION_NUMERIC", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseDirection_t", {"hipsparseDirection_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_DIRECTION_ROW", {"HIPSPARSE_DIRECTION_ROW", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_DIRECTION_COLUMN", {"HIPSPARSE_DIRECTION_COLUMN", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseHybPartition_t", {"hipsparseHybPartition_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_HYB_PARTITION_AUTO", {"HIPSPARSE_HYB_PARTITION_AUTO", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_HYB_PARTITION_USER", {"HIPSPARSE_HYB_PARTITION_USER", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_HYB_PARTITION_MAX", {"HIPSPARSE_HYB_PARTITION_MAX", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseDiagType_t", {"hipsparseDiagType_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_DIAG_TYPE_NON_UNIT", {"HIPSPARSE_DIAG_TYPE_NON_UNIT", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_DIAG_TYPE_UNIT", {"HIPSPARSE_DIAG_TYPE_UNIT", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseFillMode_t", {"hipsparseFillMode_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_FILL_MODE_LOWER", {"HIPSPARSE_FILL_MODE_LOWER", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_FILL_MODE_UPPER", {"HIPSPARSE_FILL_MODE_UPPER", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseIndexBase_t", {"hipsparseIndexBase_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_INDEX_BASE_ZERO", {"HIPSPARSE_INDEX_BASE_ZERO", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_INDEX_BASE_ONE", {"HIPSPARSE_INDEX_BASE_ONE", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseMatrixType_t", {"hipsparseMatrixType_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_MATRIX_TYPE_GENERAL", {"HIPSPARSE_MATRIX_TYPE_GENERAL", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_MATRIX_TYPE_SYMMETRIC", {"HIPSPARSE_MATRIX_TYPE_SYMMETRIC", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_MATRIX_TYPE_HERMITIAN", {"HIPSPARSE_MATRIX_TYPE_HERMITIAN", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_MATRIX_TYPE_TRIANGULAR", {"HIPSPARSE_MATRIX_TYPE_TRIANGULAR", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseOperation_t", {"hipsparseOperation_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_OPERATION_NON_TRANSPOSE", {"HIPSPARSE_OPERATION_NON_TRANSPOSE", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_OPERATION_TRANSPOSE", {"HIPSPARSE_OPERATION_TRANSPOSE", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE", {"HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparsePointerMode_t", {"hipsparsePointerMode_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_POINTER_MODE_HOST", {"HIPSPARSE_POINTER_MODE_HOST", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_POINTER_MODE_DEVICE", {"HIPSPARSE_POINTER_MODE_DEVICE", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseAlgMode_t", {"hipsparseAlgMode_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_ALG0", {"CUSPARSE_ALG0", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_ALG1", {"CUSPARSE_ALG1", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_ALG_NAIVE", {"CUSPARSE_ALG_NAIVE", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_ALG_MERGE_PATH", {"CUSPARSE_ALG_MERGE_PATH", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSolvePolicy_t", {"hipsparseSolvePolicy_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_SOLVE_POLICY_NO_LEVEL", {"HIPSPARSE_SOLVE_POLICY_NO_LEVEL", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_SOLVE_POLICY_USE_LEVEL", {"HIPSPARSE_SOLVE_POLICY_USE_LEVEL", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseStatus_t", {"hipsparseStatus_t", "", CONV_TYPE, API_SPARSE}},
{"CUSPARSE_STATUS_SUCCESS", {"HIPSPARSE_STATUS_SUCCESS", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_NOT_INITIALIZED", {"HIPSPARSE_STATUS_NOT_INITIALIZED", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_ALLOC_FAILED", {"HIPSPARSE_STATUS_ALLOC_FAILED", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_INVALID_VALUE", {"HIPSPARSE_STATUS_INVALID_VALUE", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_ARCH_MISMATCH", {"HIPSPARSE_STATUS_ARCH_MISMATCH", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_MAPPING_ERROR", {"HIPSPARSE_STATUS_MAPPING_ERROR", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_EXECUTION_FAILED", {"HIPSPARSE_STATUS_EXECUTION_FAILED", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_INTERNAL_ERROR", {"HIPSPARSE_STATUS_INTERNAL_ERROR", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED", {"HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"CUSPARSE_STATUS_ZERO_PIVOT", {"HIPSPARSE_STATUS_ZERO_PIVOT", "", CONV_NUMERIC_LITERAL, API_SPARSE}},
{"cusparseCsr2CscAlg_t", {"hipsparseCsr2CscAlg_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_CSR2CSC_ALG1", {"HIPSPARSE_CSR2CSC_ALG1", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_CSR2CSC_ALG2", {"HIPSPARSE_CSR2CSC_ALG2", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseFormat_t", {"hipsparseFormat_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_FORMAT_CSR", {"HIPSPARSE_FORMAT_CSR", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_FORMAT_CSC", {"HIPSPARSE_FORMAT_CSC", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_FORMAT_COO", {"HIPSPARSE_FORMAT_COO", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_FORMAT_COO_AOS", {"HIPSPARSE_FORMAT_COO_AOS", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseOrder_t", {"hipsparseOrder_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_ORDER_COL", {"HIPSPARSE_ORDER_COL", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_ORDER_ROW", {"HIPSPARSE_ORDER_ROW", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMVAlg_t", {"hipsparseSpMVAlg_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_MV_ALG_DEFAULT", {"HIPSPARSE_MV_ALG_DEFAULT", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_COOMV_ALG", {"HIPSPARSE_COOMV_ALG", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_CSRMV_ALG1", {"HIPSPARSE_CSRMV_ALG1", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_CSRMV_ALG2", {"HIPSPARSE_CSRMV_ALG2", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseSpMMAlg_t", {"hipsparseSpMMAlg_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_MM_ALG_DEFAULT", {"HIPSPARSE_MM_ALG_DEFAULT", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_COOMM_ALG1", {"HIPSPARSE_COOMM_ALG1", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_COOMM_ALG2", {"HIPSPARSE_COOMM_ALG2", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_COOMM_ALG3", {"HIPSPARSE_COOMM_ALG3", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_CSRMM_ALG1", {"HIPSPARSE_CSRMM_ALG1", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"cusparseIndexType_t", {"hipsparseIndexType_t", "", CONV_TYPE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_INDEX_16U", {"HIPSPARSE_INDEX_16U", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_INDEX_32I", {"HIPSPARSE_INDEX_32I", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_INDEX_64I", {"HIPSPARSE_INDEX_64I", "", CONV_NUMERIC_LITERAL, API_SPARSE, HIP_UNSUPPORTED}},
// 3. Defines
{"CUSPARSE_VER_MAJOR", {"HIPSPARSE_VER_MAJOR", "", CONV_DEFINE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_VER_MINOR", {"HIPSPARSE_VER_MINOR", "", CONV_DEFINE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_VER_PATCH", {"HIPSPARSE_VER_PATCH", "", CONV_DEFINE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_VER_BUILD", {"HIPSPARSE_VER_BUILD", "", CONV_DEFINE, API_SPARSE, HIP_UNSUPPORTED}},
{"CUSPARSE_VERSION", {"HIPSPARSE_VERSION", "", CONV_DEFINE, API_SPARSE, HIP_UNSUPPORTED}},
};
@@ -1,41 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
extern std::set<std::string> DeviceSymbolFunctions0;
extern std::set<std::string> DeviceSymbolFunctions1;
extern std::set<std::string> ReinterpretFunctions0;
extern std::set<std::string> ReinterpretFunctions1;
extern std::string sHIP_SYMBOL;
extern std::string s_reinterpret_cast;
namespace perl {
bool generate(bool Generate = true);
}
namespace python {
bool generate(bool Generate = true);
}
@@ -1,755 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <algorithm>
#include <set>
#include "HipifyAction.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Lex/HeaderSearch.h"
#include "LLVMCompat.h"
#include "CUDA2HIP.h"
#include "StringUtils.h"
#include "ArgParse.h"
const std::string sHIP = "HIP";
const std::string sROC = "ROC";
const std::string sCub = "cub";
const std::string sHipcub = "hipcub";
const std::string sHIP_DYNAMIC_SHARED = "HIP_DYNAMIC_SHARED";
const std::string sHIP_KERNEL_NAME = "HIP_KERNEL_NAME";
std::string sHIP_SYMBOL = "HIP_SYMBOL";
std::string s_reinterpret_cast = "reinterpret_cast<const void*>";
const std::string sHipLaunchKernelGGL = "hipLaunchKernelGGL";
const std::string sDim3 = "dim3(";
const std::string s_hiprand_kernel_h = "hiprand_kernel.h";
const std::string s_hiprand_h = "hiprand.h";
const std::string sOnce = "once";
const std::string s_string_literal = "[string literal]";
// CUDA identifiers, used in matchers
const std::string sCudaMemcpyToSymbol = "cudaMemcpyToSymbol";
const std::string sCudaMemcpyToSymbolAsync = "cudaMemcpyToSymbolAsync";
const std::string sCudaGetSymbolSize = "cudaGetSymbolSize";
const std::string sCudaGetSymbolAddress = "cudaGetSymbolAddress";
const std::string sCudaMemcpyFromSymbol = "cudaMemcpyFromSymbol";
const std::string sCudaMemcpyFromSymbolAsync = "cudaMemcpyFromSymbolAsync";
const std::string sCudaFuncSetCacheConfig = "cudaFuncSetCacheConfig";
const std::string sCudaFuncGetAttributes = "cudaFuncGetAttributes";
// Matchers' names
const StringRef sCudaSharedIncompleteArrayVar = "cudaSharedIncompleteArrayVar";
const StringRef sCudaLaunchKernel = "cudaLaunchKernel";
const StringRef sCudaHostFuncCall = "cudaHostFuncCall";
const StringRef sCudaDeviceFuncCall = "cudaDeviceFuncCall";
const StringRef sCubNamespacePrefix = "cubNamespacePrefix";
const StringRef sCubFunctionTemplateDecl = "cubFunctionTemplateDecl";
const StringRef sCubUsingNamespaceDecl = "cubUsingNamespaceDecl";
std::set<std::string> DeviceSymbolFunctions0 {
{sCudaMemcpyToSymbol},
{sCudaMemcpyToSymbolAsync}
};
std::set<std::string> DeviceSymbolFunctions1 {
{sCudaGetSymbolSize},
{sCudaGetSymbolAddress},
{sCudaMemcpyFromSymbol},
{sCudaMemcpyFromSymbolAsync}
};
std::set<std::string> ReinterpretFunctions{
{sCudaFuncSetCacheConfig},
{sCudaFuncGetAttributes}
};
std::set<std::string> ReinterpretFunctions0{
{sCudaFuncSetCacheConfig}
};
std::set<std::string> ReinterpretFunctions1{
{sCudaFuncGetAttributes}
};
void HipifyAction::RewriteString(StringRef s, clang::SourceLocation start) {
auto &SM = getCompilerInstance().getSourceManager();
size_t begin = 0;
while ((begin = s.find("cu", begin)) != StringRef::npos) {
const size_t end = s.find_first_of(" ", begin + 4);
StringRef name = s.slice(begin, end);
const auto found = CUDA_RENAMES_MAP().find(name);
if (found != CUDA_RENAMES_MAP().end()) {
StringRef repName = Statistics::isToRoc(found->second) ? found->second.rocName : found->second.hipName;
hipCounter counter = {s_string_literal, "", ConvTypes::CONV_LITERAL, ApiTypes::API_RUNTIME, found->second.supportDegree};
Statistics::current().incrementCounter(counter, name.str());
if (!Statistics::isUnsupported(counter)) {
clang::SourceLocation sl = start.getLocWithOffset(begin + 1);
ct::Replacement Rep(SM, sl, name.size(), repName.str());
clang::FullSourceLoc fullSL(sl, SM);
insertReplacement(Rep, fullSL);
}
}
if (end == StringRef::npos) break;
begin = end + 1;
}
}
clang::SourceLocation HipifyAction::GetSubstrLocation(const std::string &str, const clang::SourceRange &sr) {
clang::SourceLocation sl(sr.getBegin());
clang::SourceLocation end(sr.getEnd());
auto &SM = getCompilerInstance().getSourceManager();
size_t length = SM.getCharacterData(end) - SM.getCharacterData(sl);
StringRef sfull = StringRef(SM.getCharacterData(sl), length);
size_t offset = sfull.find(str);
if (offset > 0) {
sl = sl.getLocWithOffset(offset);
}
return sl;
}
/**
* Look at, and consider altering, a given token.
*
* If it's not a CUDA identifier, nothing happens.
* If it's an unsupported CUDA identifier, a warning is emitted.
* Otherwise, the source file is updated with the corresponding hipification.
*/
void HipifyAction::RewriteToken(const clang::Token &t) {
// String literals containing CUDA references need fixing.
if (t.is(clang::tok::string_literal)) {
StringRef s(t.getLiteralData(), t.getLength());
RewriteString(unquoteStr(s), t.getLocation());
return;
} else if (!t.isAnyIdentifier()) {
// If it's neither a string nor an identifier, we don't care.
return;
}
StringRef name = t.getRawIdentifier();
clang::SourceLocation sl = t.getLocation();
FindAndReplace(name, sl, CUDA_RENAMES_MAP());
}
void HipifyAction::FindAndReplace(StringRef name,
clang::SourceLocation sl,
const std::map<StringRef, hipCounter> &repMap,
bool bReplace) {
const auto found = repMap.find(name);
if (found == repMap.end()) {
// So it's an identifier, but not CUDA? Boring.
return;
}
Statistics::current().incrementCounter(found->second, name.str());
clang::DiagnosticsEngine &DE = getCompilerInstance().getDiagnostics();
// Warn the user about unsupported identifier.
if (Statistics::isUnsupported(found->second)) {
std::string sWarn;
Statistics::isToRoc(found->second) ? sWarn = sROC : sWarn = sHIP;
sWarn = "" + sWarn;
const auto ID = DE.getCustomDiagID(clang::DiagnosticsEngine::Warning, "CUDA identifier is unsupported in %0.");
DE.Report(sl, ID) << sWarn;
return;
}
if (!bReplace) {
return;
}
StringRef repName = Statistics::isToRoc(found->second) ? found->second.rocName : found->second.hipName;
auto &SM = getCompilerInstance().getSourceManager();
ct::Replacement Rep(SM, sl, name.size(), repName.str());
clang::FullSourceLoc fullSL(sl, SM);
insertReplacement(Rep, fullSL);
}
namespace {
clang::SourceRange getReadRange(clang::SourceManager &SM, const clang::SourceRange &exprRange) {
clang::SourceLocation begin = exprRange.getBegin();
clang::SourceLocation end = exprRange.getEnd();
bool beginSafe = !SM.isMacroBodyExpansion(begin) || clang::Lexer::isAtStartOfMacroExpansion(begin, SM, clang::LangOptions{});
bool endSafe = !SM.isMacroBodyExpansion(end) || clang::Lexer::isAtEndOfMacroExpansion(end, SM, clang::LangOptions{});
if (beginSafe && endSafe) {
return {SM.getFileLoc(begin), SM.getFileLoc(end)};
} else {
return {SM.getSpellingLoc(begin), SM.getSpellingLoc(end)};
}
}
clang::SourceRange getWriteRange(clang::SourceManager &SM, const clang::SourceRange &exprRange) {
clang::SourceLocation begin = exprRange.getBegin();
clang::SourceLocation end = exprRange.getEnd();
// If the range is contained within a macro, update the macro definition.
// Otherwise, use the file location and hope for the best.
if (!SM.isMacroBodyExpansion(begin) || !SM.isMacroBodyExpansion(end)) {
return {SM.getExpansionLoc(begin), SM.getExpansionLoc(end)};
}
return {SM.getSpellingLoc(begin), SM.getSpellingLoc(end)};
}
StringRef readSourceText(clang::SourceManager &SM, const clang::SourceRange &exprRange) {
return clang::Lexer::getSourceText(clang::CharSourceRange::getTokenRange(getReadRange(SM, exprRange)), SM, clang::LangOptions(), nullptr);
}
/**
* Get a string representation of the expression `arg`, unless it's a defaulting function
* call argument, in which case get a 0. Used for building argument lists to kernel calls.
*/
std::string stringifyZeroDefaultedArg(clang::SourceManager &SM, const clang::Expr *arg) {
if (clang::isa<clang::CXXDefaultArgExpr>(arg)) return "0";
else return std::string(readSourceText(SM, arg->getSourceRange()));
}
} // anonymous namespace
bool HipifyAction::Exclude(const hipCounter &hipToken) {
switch (hipToken.type) {
case CONV_INCLUDE_CUDA_MAIN_H:
switch (hipToken.apiType) {
case API_DRIVER:
case API_RUNTIME:
if (insertedRuntimeHeader) return true;
insertedRuntimeHeader = true;
return false;
case API_BLAS:
if (insertedBLASHeader) return true;
insertedBLASHeader = true;
return false;
case API_RAND:
if (hipToken.hipName == s_hiprand_kernel_h) {
if (insertedRAND_kernelHeader) return true;
insertedRAND_kernelHeader = true;
return false;
} else if (hipToken.hipName == s_hiprand_h) {
if (insertedRANDHeader) return true;
insertedRANDHeader = true;
return false;
}
case API_DNN:
if (insertedDNNHeader) return true;
insertedDNNHeader = true;
return false;
case API_FFT:
if (insertedFFTHeader) return true;
insertedFFTHeader = true;
return false;
case API_COMPLEX:
if (insertedComplexHeader) return true;
insertedComplexHeader = true;
return false;
case API_SPARSE:
if (insertedSPARSEHeader) return true;
insertedSPARSEHeader = true;
return false;
default:
return false;
}
return false;
case CONV_INCLUDE:
if (hipToken.hipName.empty()) return true;
switch (hipToken.apiType) {
case API_RAND:
if (hipToken.hipName == s_hiprand_kernel_h) {
if (insertedRAND_kernelHeader) return true;
insertedRAND_kernelHeader = true;
}
return false;
default:
return false;
}
return false;
default:
return false;
}
return false;
}
void HipifyAction::InclusionDirective(clang::SourceLocation hash_loc,
const clang::Token&,
StringRef file_name,
bool is_angled,
clang::CharSourceRange filename_range,
const clang::FileEntry*, StringRef,
StringRef, const clang::Module*) {
auto &SM = getCompilerInstance().getSourceManager();
if (!SM.isWrittenInMainFile(hash_loc)) return;
if (!firstHeader) {
firstHeader = true;
firstHeaderLoc = hash_loc;
}
const auto found = CUDA_INCLUDE_MAP.find(file_name);
if (found == CUDA_INCLUDE_MAP.end()) return;
bool exclude = Exclude(found->second);
Statistics::current().incrementCounter(found->second, file_name.str());
clang::SourceLocation sl = filename_range.getBegin();
if (Statistics::isUnsupported(found->second)) {
clang::DiagnosticsEngine &DE = getCompilerInstance().getDiagnostics();
DE.Report(sl, DE.getCustomDiagID(clang::DiagnosticsEngine::Warning, "Unsupported CUDA header."));
return;
}
clang::StringRef newInclude;
// Keep the same include type that the user gave.
if (!exclude) {
clang::SmallString<128> includeBuffer;
llvm::StringRef name = Statistics::isToRoc(found->second) ? found->second.rocName : found->second.hipName;
if (is_angled) newInclude = llvm::Twine("<" + name+ ">").toStringRef(includeBuffer);
else newInclude = llvm::Twine("\"" + name + "\"").toStringRef(includeBuffer);
} else {
// hashLoc is location of the '#', thus replacing the whole include directive by empty newInclude starting with '#'.
sl = hash_loc;
}
const char *B = SM.getCharacterData(sl);
const char *E = SM.getCharacterData(filename_range.getEnd());
ct::Replacement Rep(SM, sl, E - B, newInclude.str());
insertReplacement(Rep, clang::FullSourceLoc{sl, SM});
}
void HipifyAction::PragmaDirective(clang::SourceLocation Loc, clang::PragmaIntroducerKind Introducer) {
if (pragmaOnce) return;
auto &SM = getCompilerInstance().getSourceManager();
if (!SM.isWrittenInMainFile(Loc)) return;
clang::Preprocessor &PP = getCompilerInstance().getPreprocessor();
clang::Token tok;
PP.Lex(tok);
StringRef Text(SM.getCharacterData(tok.getLocation()), tok.getLength());
if (Text == sOnce) {
pragmaOnce = true;
pragmaOnceLoc = tok.getEndLoc();
}
}
bool HipifyAction::cudaLaunchKernel(const mat::MatchFinder::MatchResult &Result) {
auto *launchKernel = Result.Nodes.getNodeAs<clang::CUDAKernelCallExpr>(sCudaLaunchKernel);
if (!launchKernel) return false;
auto *calleeExpr = launchKernel->getCallee();
if (!calleeExpr) return false;
auto *caleeDecl = launchKernel->getDirectCallee();
if (!caleeDecl) return false;
auto *config = launchKernel->getConfig();
if (!config) return false;
clang::SmallString<40> XStr;
llvm::raw_svector_ostream OS(XStr);
clang::LangOptions DefaultLangOptions;
auto *SM = Result.SourceManager;
clang::SourceRange sr = calleeExpr->getSourceRange();
std::string kern = readSourceText(*SM, sr).str();
OS << sHipLaunchKernelGGL << "(";
if (caleeDecl->isTemplateInstantiation()) {
OS << sHIP_KERNEL_NAME << "(";
std::string cub = sCub + "::";
std::string hipcub;
const auto found = CUDA_CUB_TYPE_NAME_MAP.find(sCub);
if (found != CUDA_CUB_TYPE_NAME_MAP.end()) {
hipcub = found->second.hipName.str() + "::";
} else {
hipcub = sHipcub + "::";
}
size_t pos = kern.find(cub);
while (pos != std::string::npos) {
kern.replace(pos, cub.size(), hipcub);
pos = kern.find(cub, pos + hipcub.size());
}
}
OS << kern;
if (caleeDecl->isTemplateInstantiation()) OS << ")";
OS << ", ";
// Next up are the four kernel configuration parameters, the last two of which are optional and default to zero.
// Copy the two dimensional arguments verbatim.
for (unsigned int i = 0; i < 2; ++i) {
const std::string sArg = readSourceText(*SM, config->getArg(i)->getSourceRange()).str();
bool bDim3 = std::equal(sDim3.begin(), sDim3.end(), sArg.c_str());
OS << (bDim3 ? "" : sDim3) << sArg << (bDim3 ? "" : ")") << ", ";
}
// The stream/memory arguments default to zero if omitted.
OS << stringifyZeroDefaultedArg(*SM, config->getArg(2)) << ", ";
OS << stringifyZeroDefaultedArg(*SM, config->getArg(3));
// If there are ordinary arguments to the kernel, just copy them verbatim into our new call.
int numArgs = launchKernel->getNumArgs();
if (numArgs > 0) {
OS << ", ";
// Start of the first argument.
clang::SourceLocation argStart = llcompat::getBeginLoc(launchKernel->getArg(0));
// End of the last argument.
clang::SourceLocation argEnd = llcompat::getEndLoc(launchKernel->getArg(numArgs - 1));
OS << readSourceText(*SM, {argStart, argEnd});
}
OS << ")";
clang::SourceLocation launchKernelExprLocBeg = launchKernel->getExprLoc();
clang::SourceLocation launchKernelExprLocEnd = launchKernelExprLocBeg.isMacroID() ? llcompat::getEndOfExpansionRangeForLoc(*SM, launchKernelExprLocBeg) : llcompat::getEndLoc(launchKernel);
clang::SourceLocation launchKernelEnd = llcompat::getEndLoc(launchKernel);
clang::BeforeThanCompare<clang::SourceLocation> isBefore(*SM);
launchKernelExprLocEnd = isBefore(launchKernelEnd, launchKernelExprLocEnd) ? launchKernelExprLocEnd : launchKernelEnd;
clang::SourceRange replacementRange = getWriteRange(*SM, {launchKernelExprLocBeg, launchKernelExprLocEnd});
clang::SourceLocation launchBeg = replacementRange.getBegin();
clang::SourceLocation launchEnd = replacementRange.getEnd();
if (isBefore(launchBeg, launchEnd)) {
size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchEnd, 0, *SM, DefaultLangOptions)) - SM->getCharacterData(launchBeg);
ct::Replacement Rep(*SM, launchBeg, length, OS.str());
clang::FullSourceLoc fullSL(launchBeg, *SM);
insertReplacement(Rep, fullSL);
hipCounter counter = {sHipLaunchKernelGGL, "", ConvTypes::CONV_KERNEL_LAUNCH, ApiTypes::API_RUNTIME};
Statistics::current().incrementCounter(counter, sCudaLaunchKernel.str());
return true;
}
return false;
}
bool HipifyAction::cudaSharedIncompleteArrayVar(const mat::MatchFinder::MatchResult &Result) {
auto *sharedVar = Result.Nodes.getNodeAs<clang::VarDecl>(sCudaSharedIncompleteArrayVar);
if (!sharedVar) return false;
// Example: extern __shared__ uint sRadix1[];
if (!sharedVar->hasExternalFormalLinkage()) return false;
clang::QualType QT = sharedVar->getType();
std::string typeName;
if (QT->isIncompleteArrayType()) {
const clang::ArrayType *AT = QT.getTypePtr()->getAsArrayTypeUnsafe();
QT = AT->getElementType();
if (QT.getTypePtr()->isBuiltinType()) {
QT = QT.getCanonicalType();
auto *BT = clang::dyn_cast<clang::BuiltinType>(QT);
if (BT) {
clang::LangOptions LO;
LO.CUDA = true;
clang::PrintingPolicy policy(LO);
typeName = std::string(BT->getName(policy));
}
} else {
typeName = QT.getAsString();
}
}
if (!typeName.empty()) {
clang::SourceLocation slStart = sharedVar->getOuterLocStart();
clang::SourceLocation slEnd = llcompat::getEndLoc(sharedVar->getTypeSourceInfo()->getTypeLoc());
auto *SM = Result.SourceManager;
size_t repLength = SM->getCharacterData(slEnd) - SM->getCharacterData(slStart) + 1;
std::string varName = sharedVar->getNameAsString();
std::string repName = sHIP_DYNAMIC_SHARED + "(" + typeName + ", " + varName + ")";
ct::Replacement Rep(*SM, slStart, repLength, repName);
clang::FullSourceLoc fullSL(slStart, *SM);
insertReplacement(Rep, fullSL);
hipCounter counter = {sHIP_DYNAMIC_SHARED, "", ConvTypes::CONV_EXTERN_SHARED, ApiTypes::API_RUNTIME};
Statistics::current().incrementCounter(counter, sCudaSharedIncompleteArrayVar.str());
return true;
}
return false;
}
bool HipifyAction::cudaDeviceFuncCall(const mat::MatchFinder::MatchResult &Result) {
if (const clang::CallExpr *call = Result.Nodes.getNodeAs<clang::CallExpr>(sCudaDeviceFuncCall)) {
auto *funcDcl = call->getDirectCallee();
if (!funcDcl) return false;
FindAndReplace(funcDcl->getDeclName().getAsString(), llcompat::getBeginLoc(call), CUDA_DEVICE_FUNC_MAP, false);
return true;
}
return false;
}
bool HipifyAction::cubNamespacePrefix(const mat::MatchFinder::MatchResult &Result) {
if (auto *decl = Result.Nodes.getNodeAs<clang::TypedefNameDecl>(sCubNamespacePrefix)) {
clang::QualType QT = decl->getUnderlyingType();
auto *t = QT.getTypePtr();
if (!t) return false;
const clang::ElaboratedType *et = t->getAs<clang::ElaboratedType>();
if (!et) return false;
const clang::NestedNameSpecifier *nns = et->getQualifier();
if (!nns) return false;
const clang::NamespaceDecl *nsd = nns->getAsNamespace();
if (!nsd) return false;
const clang::TypeSourceInfo *si = decl->getTypeSourceInfo();
const clang::TypeLoc tloc = si->getTypeLoc();
const clang::SourceRange sr = tloc.getSourceRange();
std::string name = nsd->getDeclName().getAsString();
FindAndReplace(name, GetSubstrLocation(name, sr), CUDA_CUB_TYPE_NAME_MAP);
return true;
}
return false;
}
bool HipifyAction::cubUsingNamespaceDecl(const mat::MatchFinder::MatchResult &Result) {
if (auto *decl = Result.Nodes.getNodeAs<clang::UsingDirectiveDecl>(sCubUsingNamespaceDecl)) {
if (auto nsd = decl->getNominatedNamespace()) {
FindAndReplace(nsd->getDeclName().getAsString(), decl->getIdentLocation(), CUDA_CUB_TYPE_NAME_MAP);
return true;
}
}
return false;
}
bool HipifyAction::cubFunctionTemplateDecl(const mat::MatchFinder::MatchResult &Result) {
if (auto *decl = Result.Nodes.getNodeAs<clang::FunctionTemplateDecl>(sCubFunctionTemplateDecl)) {
auto *Tparams = decl->getTemplateParameters();
bool ret = false;
for (size_t I = 0; I < Tparams->size(); ++I) {
const clang::ValueDecl *valueDecl = dyn_cast<clang::ValueDecl>(Tparams->getParam(I));
if (!valueDecl) continue;
clang::QualType QT = valueDecl->getType();
auto *t = QT.getTypePtr();
if (!t) continue;
const clang::ElaboratedType *et = t->getAs<clang::ElaboratedType>();
if (!et) continue;
const clang::NestedNameSpecifier *nns = et->getQualifier();
if (!nns) continue;
const clang::NamespaceDecl *nsd = nns->getAsNamespace();
if (!nsd) continue;
const clang::SourceRange sr = valueDecl->getSourceRange();
std::string name = nsd->getDeclName().getAsString();
FindAndReplace(name, GetSubstrLocation(name, sr), CUDA_CUB_TYPE_NAME_MAP);
ret = true;
}
return ret;
}
return false;
}
bool HipifyAction::cudaHostFuncCall(const mat::MatchFinder::MatchResult &Result) {
if (auto *call = Result.Nodes.getNodeAs<clang::CallExpr>(sCudaHostFuncCall)) {
if (!call->getNumArgs()) return false;
auto *funcDcl = call->getDirectCallee();
if (!funcDcl) return false;
std::string sName = funcDcl->getDeclName().getAsString();
unsigned int argNum = 0;
bool b_reinterpret = (ReinterpretFunctions.find(sName) != ReinterpretFunctions.end()) ? true : false;
if (DeviceSymbolFunctions0.find(sName) != DeviceSymbolFunctions0.end() || sCudaFuncSetCacheConfig == sName) {
argNum = 0;
} else if (call->getNumArgs() > 1 && (DeviceSymbolFunctions1.find(sName) != DeviceSymbolFunctions1.end() || sCudaFuncGetAttributes == sName)) {
argNum = 1;
} else {
return false;
}
clang::SmallString<40> XStr;
llvm::raw_svector_ostream OS(XStr);
clang::SourceRange sr = call->getArg(argNum)->getSourceRange();
auto *SM = Result.SourceManager;
OS << (b_reinterpret ? s_reinterpret_cast : sHIP_SYMBOL) << "(" << readSourceText(*SM, sr) << ")";
clang::SourceRange replacementRange = getWriteRange(*SM, { sr.getBegin(), sr.getEnd() });
clang::SourceLocation s = replacementRange.getBegin();
clang::SourceLocation e = replacementRange.getEnd();
clang::LangOptions DefaultLangOptions;
size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(e, 0, *SM, DefaultLangOptions)) - SM->getCharacterData(s);
ct::Replacement Rep(*SM, s, length, OS.str());
clang::FullSourceLoc fullSL(s, *SM);
insertReplacement(Rep, fullSL);
return true;
}
return false;
}
void HipifyAction::insertReplacement(const ct::Replacement &rep, const clang::FullSourceLoc &fullSL) {
llcompat::insertReplacement(*replacements, rep);
if (PrintStats) {
rep.getLength();
Statistics::current().lineTouched(fullSL.getExpansionLineNumber());
Statistics::current().bytesChanged(rep.getLength());
}
}
std::unique_ptr<clang::ASTConsumer> HipifyAction::CreateASTConsumer(clang::CompilerInstance &CI, StringRef) {
Finder.reset(new mat::MatchFinder);
// Replace the <<<...>>> language extension with a hip kernel launch
Finder->addMatcher(mat::cudaKernelCallExpr(mat::isExpansionInMainFile()).bind(sCudaLaunchKernel), this);
Finder->addMatcher(
mat::varDecl(
mat::isExpansionInMainFile(),
mat::allOf(
mat::hasAttr(clang::attr::CUDAShared),
mat::hasType(mat::incompleteArrayType())
)
).bind(sCudaSharedIncompleteArrayVar),
this
);
Finder->addMatcher(
mat::callExpr(
mat::isExpansionInMainFile(),
mat::callee(
mat::functionDecl(
mat::hasAnyName(
sCudaGetSymbolAddress,
sCudaGetSymbolSize,
sCudaMemcpyFromSymbol,
sCudaMemcpyFromSymbolAsync,
sCudaMemcpyToSymbol,
sCudaMemcpyToSymbolAsync,
sCudaFuncSetCacheConfig,
sCudaFuncGetAttributes
)
)
)
).bind(sCudaHostFuncCall),
this
);
Finder->addMatcher(
mat::callExpr(
mat::isExpansionInMainFile(),
mat::callee(
mat::functionDecl(
mat::anyOf(
mat::hasAttr(clang::attr::CUDADevice),
mat::hasAttr(clang::attr::CUDAGlobal)
),
mat::unless(mat::hasAttr(clang::attr::CUDAHost))
)
)
).bind(sCudaDeviceFuncCall),
this
);
Finder->addMatcher(
mat::typedefDecl(
mat::isExpansionInMainFile(),
mat::hasType(
mat::elaboratedType(
mat::hasQualifier(
mat::specifiesNamespace(
mat::hasName(sCub)
)
)
)
)
).bind(sCubNamespacePrefix),
this
);
// TODO: Maybe worth to make it more concrete based on final cubFunctionTemplateDecl
Finder->addMatcher(
mat::functionTemplateDecl(
mat::isExpansionInMainFile()
).bind(sCubFunctionTemplateDecl),
this
);
// TODO: Maybe worth to make it more concrete
Finder->addMatcher(
mat::usingDirectiveDecl(
mat::isExpansionInMainFile()
).bind(sCubUsingNamespaceDecl),
this
);
// Ownership is transferred to the caller.
return Finder->newASTConsumer();
}
void HipifyAction::Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) {
auto &SM = getCompilerInstance().getSourceManager();
if (!SM.isWrittenInMainFile(Loc)) return;
StringRef Text(SM.getCharacterData(MacroNameTok.getLocation()), MacroNameTok.getLength());
Ifndefs.insert(std::make_pair(Text.str(), MacroNameTok.getEndLoc()));
}
void HipifyAction::EndSourceFileAction() {
// Insert the hip header, if we didn't already do it by accident during substitution.
if (!insertedRuntimeHeader) {
// It's not sufficient to just replace CUDA headers with hip ones, because numerous CUDA headers are
// implicitly included by the compiler. Instead, we _delete_ CUDA headers, and unconditionally insert
// one copy of the hip include into every file.
bool placeForIncludeCalculated = false;
clang::SourceLocation sl, controllingMacroLoc;
auto &SM = getCompilerInstance().getSourceManager();
clang::Preprocessor &PP = getCompilerInstance().getPreprocessor();
clang::HeaderSearch &HS = PP.getHeaderSearchInfo();
clang::ExternalPreprocessorSource *EPL = HS.getExternalLookup();
const clang::FileEntry *FE = SM.getFileEntryForID(SM.getMainFileID());
const clang::IdentifierInfo *controllingMacro = HS.getFileInfo(FE).getControllingMacro(EPL);
if (controllingMacro) {
auto found = Ifndefs.find(controllingMacro->getName().str());
if (found != Ifndefs.end()) {
controllingMacroLoc = found->second;
placeForIncludeCalculated = true;
}
}
if (pragmaOnce) {
if (placeForIncludeCalculated) sl = pragmaOnceLoc < controllingMacroLoc ? pragmaOnceLoc : controllingMacroLoc;
else sl = pragmaOnceLoc;
placeForIncludeCalculated = true;
}
if (!placeForIncludeCalculated) {
if (firstHeader) sl = firstHeaderLoc;
else sl = SM.getLocForStartOfFile(SM.getMainFileID());
}
clang::FullSourceLoc fullSL(sl, SM);
ct::Replacement Rep(SM, sl, 0, "\n#include <hip/hip_runtime.h>\n");
insertReplacement(Rep, fullSL);
}
clang::ASTFrontendAction::EndSourceFileAction();
}
namespace {
/**
* A silly little class to proxy PPCallbacks back to the HipifyAction class.
*/
class PPCallbackProxy : public clang::PPCallbacks {
HipifyAction &hipifyAction;
public:
explicit PPCallbackProxy(HipifyAction &action): hipifyAction(action) {}
void InclusionDirective(clang::SourceLocation hash_loc, const clang::Token &include_token,
StringRef file_name, bool is_angled, clang::CharSourceRange filename_range,
const clang::FileEntry *file, StringRef search_path, StringRef relative_path,
const clang::Module *imported
#if LLVM_VERSION_MAJOR > 6
, clang::SrcMgr::CharacteristicKind FileType
#endif
) override {
hipifyAction.InclusionDirective(hash_loc, include_token, file_name, is_angled, filename_range, file, search_path, relative_path, imported);
}
void PragmaDirective(clang::SourceLocation Loc, clang::PragmaIntroducerKind Introducer) override {
hipifyAction.PragmaDirective(Loc, Introducer);
}
void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD) override {
hipifyAction.Ifndef(Loc, MacroNameTok, MD);
}
};
}
bool HipifyAction::BeginInvocation(clang::CompilerInstance &CI) {
llcompat::RetainExcludedConditionalBlocks(CI);
return true;
}
void HipifyAction::ExecuteAction() {
clang::Preprocessor &PP = getCompilerInstance().getPreprocessor();
auto &SM = getCompilerInstance().getSourceManager();
// Start lexing the specified input file.
const llvm::MemoryBuffer *FromFile = SM.getBuffer(SM.getMainFileID());
clang::Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOpts());
RawLex.SetKeepWhitespaceMode(true);
// Perform a token-level rewrite of CUDA identifiers to hip ones. The raw-mode lexer gives us enough
// information to tell the difference between identifiers, string literals, and "other stuff". It also
// ignores preprocessor directives, so this transformation will operate inside preprocessor-deleted code.
clang::Token RawTok;
RawLex.LexFromRawLexer(RawTok);
while (RawTok.isNot(clang::tok::eof)) {
RewriteToken(RawTok);
RawLex.LexFromRawLexer(RawTok);
}
// Register yourself as the preprocessor callback, by proxy.
PP.addPPCallbacks(std::unique_ptr<PPCallbackProxy>(new PPCallbackProxy(*this)));
// Now we're done futzing with the lexer, have the subclass proceeed with Sema and AST matching.
clang::ASTFrontendAction::ExecuteAction();
}
void HipifyAction::run(const mat::MatchFinder::MatchResult &Result) {
if (cudaLaunchKernel(Result)) return;
if (cudaSharedIncompleteArrayVar(Result)) return;
if (cudaHostFuncCall(Result)) return;
if (cudaDeviceFuncCall(Result)) return;
if (cubNamespacePrefix(Result)) return;
if (cubFunctionTemplateDecl(Result)) return;
if (cubUsingNamespaceDecl(Result)) return;
}
@@ -1,110 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include "clang/Lex/PPCallbacks.h"
#include "clang/Tooling/Tooling.h"
#include "clang/Tooling/Core/Replacement.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "ReplacementsFrontendActionFactory.h"
#include "Statistics.h"
namespace ct = clang::tooling;
namespace mat = clang::ast_matchers;
using namespace llvm;
/**
* A FrontendAction that hipifies CUDA programs.
*/
class HipifyAction : public clang::ASTFrontendAction,
public mat::MatchFinder::MatchCallback {
private:
ct::Replacements *replacements;
std::map<std::string, clang::SourceLocation> Ifndefs;
std::unique_ptr<mat::MatchFinder> Finder;
// CUDA implicitly adds its runtime header. We rewrite explicitly-provided CUDA includes with equivalent
// ones, and track - using this flag - if the result led to us including the hip runtime header. If it did
// not, we insert it at the top of the file when we finish processing it.
// This approach means we do the best it's possible to do w.r.t preserving the user's include order.
bool insertedRuntimeHeader = false;
bool insertedBLASHeader = false;
bool insertedRANDHeader = false;
bool insertedRAND_kernelHeader = false;
bool insertedDNNHeader = false;
bool insertedFFTHeader = false;
bool insertedSPARSEHeader = false;
bool insertedComplexHeader = false;
bool firstHeader = false;
bool pragmaOnce = false;
clang::SourceLocation firstHeaderLoc;
clang::SourceLocation pragmaOnceLoc;
// Rewrite a string literal to refer to hip, not CUDA.
void RewriteString(StringRef s, clang::SourceLocation start);
// Replace a CUDA identifier with the corresponding hip identifier, if applicable.
void RewriteToken(const clang::Token &t);
// Calculate str's SourceLocation in SourceRange sr
clang::SourceLocation GetSubstrLocation(const std::string &str, const clang::SourceRange &sr);
public:
explicit HipifyAction(ct::Replacements *replacements): clang::ASTFrontendAction(),
replacements(replacements) {}
// MatchCallback listeners
bool cudaLaunchKernel(const mat::MatchFinder::MatchResult &Result);
bool cudaSharedIncompleteArrayVar(const mat::MatchFinder::MatchResult &Result);
bool cudaDeviceFuncCall(const mat::MatchFinder::MatchResult &Result);
bool cudaHostFuncCall(const mat::MatchFinder::MatchResult &Result);
bool cubNamespacePrefix(const mat::MatchFinder::MatchResult &Result);
bool cubFunctionTemplateDecl(const mat::MatchFinder::MatchResult &Result);
bool cubUsingNamespaceDecl(const mat::MatchFinder::MatchResult &Result);
// Called by the preprocessor for each include directive during the non-raw lexing pass.
void InclusionDirective(clang::SourceLocation hash_loc,
const clang::Token &include_token,
StringRef file_name,
bool is_angled,
clang::CharSourceRange filename_range,
const clang::FileEntry *file,
StringRef search_path,
StringRef relative_path,
const clang::Module *imported);
// Called by the preprocessor for each pragma directive during the non-raw lexing pass.
void PragmaDirective(clang::SourceLocation Loc, clang::PragmaIntroducerKind Introducer);
// Called by the preprocessor for each ifndef directive during the non-raw lexing pass.
// Found ifndef will be used in EndSourceFileAction() for catching include guard controlling macro.
void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDefinition &MD);
protected:
// Add a Replacement for the current file. These will all be applied after executing the FrontendAction.
void insertReplacement(const ct::Replacement &rep, const clang::FullSourceLoc &fullSL);
// FrontendAction entry point.
void ExecuteAction() override;
// Callback before starting processing a single input; used by hipify-clang for setting Preprocessor options.
bool BeginInvocation(clang::CompilerInstance &CI) override;
// Called at the start of each new file to process.
void EndSourceFileAction() override;
// MatchCallback API entry point. Called by the AST visitor while searching the AST for things we registered an interest for.
void run(const mat::MatchFinder::MatchResult &Result) override;
std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &CI, StringRef InFile) override;
bool Exclude(const hipCounter &hipToken);
void FindAndReplace(StringRef name, clang::SourceLocation sl, const std::map<StringRef, hipCounter> &repMap, bool bReplace = true);
};
@@ -1,154 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "ArgParse.h"
#include "LLVMCompat.h"
#include "llvm/Support/Path.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Frontend/CompilerInstance.h"
const std::string sHipify = "[HIPIFY] ", sConflict = "conflict: ", sError = "error: ", sWarning = "warning: ";
namespace llcompat {
void PrintStackTraceOnErrorSignal() {
// The signature of PrintStackTraceOnErrorSignal changed in llvm 3.9. We don't support
// anything older than 3.8, so let's specifically detect the one old version we support.
#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 8)
llvm::sys::PrintStackTraceOnErrorSignal();
#else
llvm::sys::PrintStackTraceOnErrorSignal(StringRef());
#endif
}
ct::Replacements &getReplacements(ct::RefactoringTool &Tool, StringRef file) {
#if LLVM_VERSION_MAJOR > 3
// getReplacements() now returns a map from filename to Replacements - so create an entry
// for this source file and return a reference to it.
return Tool.getReplacements()[std::string(file)];
#else
return Tool.getReplacements();
#endif
}
void insertReplacement(ct::Replacements &replacements, const ct::Replacement &rep) {
#if LLVM_VERSION_MAJOR > 3
// New clang added error checking to Replacements, and *insists* that you explicitly check it.
llvm::consumeError(replacements.add(rep));
#else
// In older versions, it's literally an std::set<Replacement>
replacements.insert(rep);
#endif
}
void EnterPreprocessorTokenStream(clang::Preprocessor &_pp, const clang::Token *start, size_t len, bool DisableMacroExpansion) {
#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR == 8)
_pp.EnterTokenStream(start, len, false, DisableMacroExpansion);
#else
#if (LLVM_VERSION_MAJOR < 9)
_pp.EnterTokenStream(clang::ArrayRef<clang::Token>{start, len}, DisableMacroExpansion);
#else
_pp.EnterTokenStream(clang::ArrayRef<clang::Token>{start, len}, DisableMacroExpansion, false);
#endif
#endif
}
clang::SourceLocation getBeginLoc(const clang::Stmt *stmt) {
#if LLVM_VERSION_MAJOR < 8
return stmt->getLocStart();
#else
return stmt->getBeginLoc();
#endif
}
clang::SourceLocation getBeginLoc(const clang::TypeLoc &typeLoc) {
#if LLVM_VERSION_MAJOR < 8
return typeLoc.getLocStart();
#else
return typeLoc.getBeginLoc();
#endif
}
clang::SourceLocation getEndLoc(const clang::Stmt *stmt) {
#if LLVM_VERSION_MAJOR < 8
return stmt->getLocEnd();
#else
return stmt->getEndLoc();
#endif
}
clang::SourceLocation getEndLoc(const clang::TypeLoc &typeLoc) {
#if LLVM_VERSION_MAJOR < 8
return typeLoc.getLocEnd();
#else
return typeLoc.getEndLoc();
#endif
}
std::error_code real_path(const Twine &path, SmallVectorImpl<char> &output,
bool expand_tilde) {
#if LLVM_VERSION_MAJOR < 5
output.clear();
std::string s = path.str();
output.append(s.begin(), s.end());
if (sys::path::is_relative(path)) {
return sys::fs::make_absolute(output);
}
return std::error_code();
#else
return sys::fs::real_path(path, output, expand_tilde);
#endif
}
bool pragma_once_outside_header() {
#if LLVM_VERSION_MAJOR < 4
return false;
#else
return true;
#endif
}
void RetainExcludedConditionalBlocks(clang::CompilerInstance &CI) {
#if LLVM_VERSION_MAJOR > 9
clang::PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
PPOpts.RetainExcludedConditionalBlocks = !SkipExcludedPPConditionalBlocks;
#endif
}
bool CheckCompatibility() {
#if LLVM_VERSION_MAJOR < 10
if (SkipExcludedPPConditionalBlocks) {
llvm::errs() << "\n" << sHipify << sWarning << "Option '" << SkipExcludedPPConditionalBlocks.ArgStr.str() << "' is supported starting from LLVM version 10.0\n";
}
#endif
return true;
}
clang::SourceLocation getEndOfExpansionRangeForLoc(const clang::SourceManager &SM, const clang::SourceLocation &loc) {
#if LLVM_VERSION_MAJOR > 6
return SM.getExpansionRange(loc).getEnd();
#else
return SM.getExpansionRange(loc).second;
#endif
}
} // namespace llcompat
@@ -1,94 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include <clang/Tooling/Core/Replacement.h>
#include <clang/Tooling/Refactoring.h>
#include <llvm/Support/Signals.h>
#include <clang/Lex/Token.h>
#include <clang/Lex/Preprocessor.h>
namespace ct = clang::tooling;
extern const std::string sHipify, sConflict, sError, sWarning;
// Things for papering over the differences between different LLVM versions.
namespace llcompat {
/**
* The getNumArgs function on macros was rather unhelpfully renamed in clang 4.0. Its semantics
* remain unchanged, so let's be slightly ugly about it here. :D
*/
#if LLVM_VERSION_MAJOR > 4
#define GET_NUM_ARGS() getNumParams()
#else
#define GET_NUM_ARGS() getNumArgs()
#endif
#if LLVM_VERSION_MAJOR < 7
#define LLVM_DEBUG(X) DEBUG(X)
#endif
clang::SourceLocation getBeginLoc(const clang::Stmt *stmt);
clang::SourceLocation getBeginLoc(const clang::TypeLoc &typeLoc);
clang::SourceLocation getEndLoc(const clang::Stmt *stmt);
clang::SourceLocation getEndLoc(const clang::TypeLoc &typeLoc);
void PrintStackTraceOnErrorSignal();
using namespace llvm;
/**
* Get the replacement map for a given filename in a RefactoringTool.
*
* Older LLVM versions don't actually support multiple filenames, so everything all gets
* smushed together. It is the caller's responsibility to cope with this.
*/
ct::Replacements &getReplacements(ct::RefactoringTool &Tool, StringRef file);
/**
* Add a Replacement to a Replacements.
*/
void insertReplacement(ct::Replacements &replacements, const ct::Replacement &rep);
/**
* Version-agnostic version of Preprocessor::EnterTokenStream().
*/
void EnterPreprocessorTokenStream(clang::Preprocessor &_pp,
const clang::Token *start,
size_t len,
bool DisableMacroExpansion);
std::error_code real_path(const Twine &path, SmallVectorImpl<char> &output,
bool expand_tilde = false);
bool pragma_once_outside_header();
void RetainExcludedConditionalBlocks(clang::CompilerInstance &CI);
bool CheckCompatibility();
clang::SourceLocation getEndOfExpansionRangeForLoc(const clang::SourceManager &SM, const clang::SourceLocation &loc);
} // namespace llcompat
@@ -1,55 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include "clang/Tooling/Tooling.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Tooling/Core/Replacement.h"
namespace ct = clang::tooling;
/**
* A FrontendActionFactory that propagates a set of Replacements into the FrontendAction.
* This is necessary boilerplate for using a custom FrontendAction with a RefactoringTool.
*
* @tparam T The FrontendAction to create.
*/
template <typename T>
class ReplacementsFrontendActionFactory : public ct::FrontendActionFactory {
ct::Replacements *replacements;
public:
explicit ReplacementsFrontendActionFactory(ct::Replacements *r):
ct::FrontendActionFactory(),
replacements(r) {}
#if LLVM_VERSION_MAJOR < 10
clang::FrontendAction *create() override {
return new T(replacements);
}
#else
std::unique_ptr <clang::FrontendAction> create() override {
return std::unique_ptr<clang::FrontendAction>(new T(replacements));
}
#endif
};
@@ -1,368 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "Statistics.h"
#include <assert.h>
#include <sstream>
#include <iomanip>
#include "ArgParse.h"
const char *counterNames[NUM_CONV_TYPES] = {
"error", // CONV_ERROR
"init", // CONV_INIT
"version", // CONV_VERSION
"device", // CONV_DEVICE
"context", // CONV_CONTEXT
"module", // CONV_MODULE
"memory", // CONV_MEMORY
"virtual_memory", // CONV_VIRTUAL_MEMORY
"addressing", // CONV_ADDRESSING
"stream", // CONV_STREAM
"event", // CONV_EVENT
"external_resource_interop", // CONV_EXT_RES
"stream_memory", // CONV_STREAM_MEMORY
"execution", // CONV_EXECUTION
"graph", // CONV_GRAPH
"occupancy", // CONV_OCCUPANCY
"texture", // CONV_TEXTURE
"surface", // CONV_SURFACE
"peer", // CONV_PEER
"graphics", // CONV_GRAPHICS
"profiler", // CONV_PROFILER
"openGL", // CONV_OPENGL
"D3D9", // CONV_D3D9
"D3D10", // CONV_D3D10
"D3D11", // CONV_D3D11
"VDPAU", // CONV_VDPAU
"EGL", // CONV_EGL
"thread", // CONV_THREAD
"complex", // CONV_COMPLEX
"library", // CONV_LIB_FUNC
"device_library", // CONV_LIB_DEVICE_FUNC
"device_function", // CONV_DEVICE_FUNC
"include", // CONV_INCLUDE
"include_cuda_main_header", // CONV_INCLUDE_CUDA_MAIN_H
"type", // CONV_TYPE
"literal", // CONV_LITERAL
"numeric_literal", // CONV_NUMERIC_LITERAL
"define", // CONV_DEFINE
"extern_shared", // CONV_EXTERN_SHARED
"kernel_launch" // CONV_KERNEL_LAUNCH
};
const char *counterTypes[NUM_CONV_TYPES] = {
"CONV_ERROR",
"CONV_INIT",
"CONV_VERSION",
"CONV_DEVICE",
"CONV_CONTEXT",
"CONV_MODULE",
"CONV_MEMORY",
"CONV_VIRTUAL_MEMORY",
"CONV_ADDRESSING",
"CONV_STREAM",
"CONV_EVENT",
"CONV_EXT_RES",
"CONV_STREAM_MEMORY",
"CONV_EXECUTION",
"CONV_GRAPH",
"CONV_OCCUPANCY",
"CONV_TEXTURE",
"CONV_SURFACE",
"CONV_PEER",
"CONV_GRAPHICS",
"CONV_PROFILER",
"CONV_OPENGL",
"CONV_D3D9",
"CONV_D3D10",
"CONV_D3D11",
"CONV_VDPAU",
"CONV_EGL",
"CONV_THREAD",
"CONV_COMPLEX",
"CONV_LIB_FUNC",
"CONV_LIB_DEVICE_FUNC",
"CONV_INCLUDE",
"CONV_INCLUDE_CUDA_MAIN_H",
"CONV_TYPE",
"CONV_LITERAL",
"CONV_NUMERIC_LITERAL",
"CONV_DEFINE",
"CONV_EXTERN_SHARED",
"CONV_KERNEL_LAUNCH"
};
const char *apiNames[NUM_API_TYPES] = {
"CUDA Driver API",
"CUDA RT API",
"cuComplex API",
"cuBLAS API",
"cuRAND API",
"cuDNN API",
"cuFFT API",
"cuSPARSE API",
"CUB API",
"CAFFE2 API"
};
const char *apiTypes[NUM_API_TYPES] = {
"API_DRIVER",
"API_RUNTIME",
"API_COMPLEX",
"API_BLAS",
"API_RAND",
"API_DNN",
"API_FFT",
"API_CUB",
"API_SPARSE",
"API_CAFFE2"
};
namespace {
template<typename ST, typename ST2>
void conditionalPrint(ST *stream1,
ST2* stream2,
const std::string& s1,
const std::string& s2) {
if (stream1) {
*stream1 << s1;
}
if (stream2) {
*stream2 << s2;
}
}
// Print a named stat value to both the terminal and the CSV file.
template<typename T>
void printStat(std::ostream *csv, llvm::raw_ostream* printOut, const std::string &name, T value) {
if (printOut) {
*printOut << " " << name << ": " << value << "\n";
}
if (csv) {
*csv << name << ";" << value << "\n";
}
}
} // Anonymous namespace
void StatCounter::incrementCounter(const hipCounter &counter, const std::string &name) {
counters[name]++;
apiCounters[(int) counter.apiType]++;
convTypeCounters[(int) counter.type]++;
}
void StatCounter::add(const StatCounter &other) {
for (const auto &p : other.counters) {
counters[p.first] += p.second;
}
for (int i = 0; i < NUM_API_TYPES; ++i) {
apiCounters[i] += other.apiCounters[i];
}
for (int i = 0; i < NUM_CONV_TYPES; ++i) {
convTypeCounters[i] += other.convTypeCounters[i];
}
}
int StatCounter::getConvSum() {
int acc = 0;
for (const int &i : convTypeCounters) {
acc += i;
}
return acc;
}
void StatCounter::print(std::ostream* csv, llvm::raw_ostream* printOut, const std::string &prefix) {
for (int i = 0; i < NUM_CONV_TYPES; ++i) {
if (convTypeCounters[i] > 0) {
conditionalPrint(csv, printOut, "\nCUDA ref type;Count\n", "[HIPIFY] info: " + prefix + " refs by type:\n");
break;
}
}
for (int i = 0; i < NUM_CONV_TYPES; ++i) {
if (convTypeCounters[i] > 0) {
printStat(csv, printOut, counterNames[i], convTypeCounters[i]);
}
}
for (int i = 0; i < NUM_API_TYPES; ++i) {
if (apiCounters[i] > 0) {
conditionalPrint(csv, printOut, "\nCUDA API;Count\n", "[HIPIFY] info: " + prefix + " refs by API:\n");
break;
}
}
for (int i = 0; i < NUM_API_TYPES; ++i) {
if (apiCounters[i] > 0) {
printStat(csv, printOut, apiNames[i], apiCounters[i]);
}
}
if (counters.size() > 0) {
conditionalPrint(csv, printOut, "\nCUDA ref name;Count\n", "[HIPIFY] info: " + prefix + " refs by names:\n");
for (const auto &it : counters) {
printStat(csv, printOut, it.first, it.second);
}
}
}
Statistics::Statistics(const std::string &name): fileName(name) {
// Compute the total bytes/lines in the input file.
std::ifstream src_file(name, std::ios::binary | std::ios::ate);
src_file.clear();
src_file.seekg(0);
totalLines = (unsigned) std::count(std::istreambuf_iterator<char>(src_file), std::istreambuf_iterator<char>(), '\n');
totalBytes = (int) src_file.tellg();
if (totalBytes < 0) {
totalBytes = 0;
}
startTime = chr::steady_clock::now();
}
///////// Counter update routines //////////
void Statistics::incrementCounter(const hipCounter &counter, const std::string &name) {
if (Statistics::isUnsupported(counter)) {
unsupported.incrementCounter(counter, name);
} else {
supported.incrementCounter(counter, name);
}
}
void Statistics::add(const Statistics &other) {
supported.add(other.supported);
unsupported.add(other.unsupported);
touchedBytes += other.touchedBytes;
totalBytes += other.totalBytes;
touchedLines += other.touchedLines;
totalLines += other.totalLines;
if (other.hasErrors && !hasErrors) {
hasErrors = true;
}
if (startTime > other.startTime) {
startTime = other.startTime;
}
}
void Statistics::lineTouched(int lineNumber) {
touchedLinesSet.insert(lineNumber);
touchedLines = unsigned(touchedLinesSet.size());
}
void Statistics::bytesChanged(int bytes) {
touchedBytes += bytes;
}
void Statistics::markCompletion() {
completionTime = chr::steady_clock::now();
}
///////// Output functions //////////
void Statistics::print(std::ostream* csv, llvm::raw_ostream* printOut, bool skipHeader) {
if (!skipHeader) {
std::string str = "file \'" + fileName + "\' statistics:\n";
conditionalPrint(csv, printOut, "\n" + str, "\n[HIPIFY] info: " + str);
}
if (hasErrors || totalBytes <= 0 || totalLines <= 0) {
std::string str = "\n ERROR: Statistics is invalid due to failed hipification.\n\n";
conditionalPrint(csv, printOut, str, str);
}
// Total number of (un)supported refs that were converted.
int supportedSum = supported.getConvSum();
int unsupportedSum = unsupported.getConvSum();
int allSum = supportedSum + unsupportedSum;
printStat(csv, printOut, "CONVERTED refs count", supportedSum);
printStat(csv, printOut, "UNCONVERTED refs count", unsupportedSum);
printStat(csv, printOut, "CONVERSION %", 100 - (0 == allSum ? 100 : std::lround(double(unsupportedSum * 100) / double(allSum))));
printStat(csv, printOut, "REPLACED bytes", touchedBytes);
printStat(csv, printOut, "TOTAL bytes", totalBytes);
printStat(csv, printOut, "CHANGED lines of code", touchedLines);
printStat(csv, printOut, "TOTAL lines of code", totalLines);
printStat(csv, printOut, "CODE CHANGED (in bytes) %", 0 == totalBytes ? 0 : std::lround(double(touchedBytes * 100) / double(totalBytes)));
printStat(csv, printOut, "CODE CHANGED (in lines) %", 0 == totalLines ? 0 : std::lround(double(touchedLines * 100) / double(totalLines)));
typedef std::chrono::duration<double, std::milli> duration;
duration elapsed = completionTime - startTime;
std::stringstream stream;
stream << std::fixed << std::setprecision(2) << elapsed.count() / 1000;
printStat(csv, printOut, "TIME ELAPSED s", stream.str());
supported.print(csv, printOut, "CONVERTED");
unsupported.print(csv, printOut, "UNCONVERTED");
}
void Statistics::printAggregate(std::ostream *csv, llvm::raw_ostream* printOut) {
Statistics globalStats = getAggregate();
// A file is considered "converted" if we made any changes to it.
int convertedFiles = 0;
for (const auto &p : stats) {
if (p.second.touchedLines && p.second.totalBytes &&
p.second.totalLines && !p.second.hasErrors) {
convertedFiles++;
}
}
globalStats.markCompletion();
globalStats.print(csv, printOut);
std::string str = "TOTAL statistics:";
conditionalPrint(csv, printOut, "\n" + str + "\n", "\n[HIPIFY] info: " + str + "\n");
printStat(csv, printOut, "CONVERTED files", convertedFiles);
printStat(csv, printOut, "PROCESSED files", stats.size());
}
//// Static state management ////
Statistics Statistics::getAggregate() {
Statistics globalStats("GLOBAL");
for (const auto &p : stats) {
globalStats.add(p.second);
}
return globalStats;
}
Statistics &Statistics::current() {
assert(Statistics::currentStatistics);
return *Statistics::currentStatistics;
}
void Statistics::setActive(const std::string &name) {
stats.emplace(std::make_pair(name, Statistics{name}));
Statistics::currentStatistics = &stats.at(name);
}
bool Statistics::isToRoc(const hipCounter &counter) {
return TranslateToRoc && counter.apiType == API_BLAS;
}
bool Statistics::isHipUnsupported(const hipCounter &counter) {
return HIP_UNSUPPORTED == (counter.supportDegree & HIP_UNSUPPORTED);
}
bool Statistics::isRocUnsupported(const hipCounter &counter) {
return ROC_UNSUPPORTED == (counter.supportDegree & ROC_UNSUPPORTED);
}
bool Statistics::isUnsupported(const hipCounter &counter) {
if (Statistics::isToRoc(counter)) {
return Statistics::isRocUnsupported(counter);
} else {
return Statistics::isHipUnsupported(counter);
}
}
std::map<std::string, Statistics> Statistics::stats = {};
Statistics* Statistics::currentStatistics = nullptr;
-250
View File
@@ -1,250 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include <chrono>
#include <string>
#include <fstream>
#include <map>
#include <set>
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/raw_ostream.h>
namespace chr = std::chrono;
enum ConvTypes {
// Driver API: 5.2. Error Handling
// Runtime API: 5.3. Error Handling
CONV_ERROR = 0,
// Driver API : 5.3. Initialization
CONV_INIT,
// Driver API : 5.4. Version Management
// Runtime API: 5.28. Version Management
CONV_VERSION,
// Driver API : 5.5. Device Management, 5.6. Device Management [DEPRECATED]
// Runtime API: 5.1. Device Management
CONV_DEVICE,
// Driver API : 5.7. Primary Context Management, 5.8.Context Management, 5.9. Context Management [DEPRECATED]
CONV_CONTEXT,
// Driver API : 5.10. Module Management
CONV_MODULE,
// Driver API : 5.11. Memory Management
// Runtime API: 5.9. Memory Management, 5.10. Memory Management [DEPRECATED]
CONV_MEMORY,
// Driver API : 5.12. Virtual Memory Management
CONV_VIRTUAL_MEMORY,
// Driver API : 5.13. Unified Addressing
// Runtime API: 5.11. Unified Addressing
CONV_ADDRESSING,
// Driver API : 5.14. Stream Management
// Runtime API: 5.4. Stream Management
CONV_STREAM,
// Driver API : 5.15. Event Management
// Runtime API: 5.5. Event Management
CONV_EVENT,
// Driver API : 5.16. External Resource Interoperability
// Runtime API: 5.6.External Resource Interoperability
CONV_EXT_RES,
// Driver API : 5.17. Stream memory operations
CONV_STREAM_MEMORY,
// Driver API : 5.18. Execution Control, 5.19. Execution Control [DEPRECATED]
// Runtime API: 5.7.Execution Control, Former 5.9. Execution Control [DEPRECATED]
CONV_EXECUTION,
// Driver API : 5.20. Graph Management
// Runtime API: 5.29. Graph Management
CONV_GRAPH,
// Driver API : 5.21. Occupancy
// Runtime API: 5.8. Occupancy
CONV_OCCUPANCY,
// Driver API : 5.22. Texture Reference Management [DEPRECATED], 5.24. Texture Object Management
// Runtime API: 5.24. Texture Reference Management [DEPRECATED], 5.26. Texture Object Management
CONV_TEXTURE,
// Driver API : 5.23. Surface Reference Management [DEPRECATED], 5.25. Surface Object Management
// Runtime API: 5.25. Surface Reference Management [DEPRECATED], 5.27. Surface Object Management
CONV_SURFACE,
// Driver API : 5.26. Peer Context Memory Access
// Runtime API: 5.12. Peer Device Memory Access
CONV_PEER,
// Driver API : 5.27. Graphics Interoperability
// Runtime API: 5.23. Graphics Interoperability
CONV_GRAPHICS,
// Driver API : 5.28. Profiler Control
// Runtime API: 5.32. Profiler Control
CONV_PROFILER,
// Driver API : 5.29. OpenGL Interoperability
// Runtime API: 5.13. OpenGL Interoperability, 5.14. OpenGL Interoperability [DEPRECATED]
CONV_OPENGL,
// Driver API : 5.30. Direct3D 9 Interoperability
// Runtime API: 5.15. Direct3D 9 Interoperability, 5.16. Direct3D 9 Interoperability [DEPRECATED]
CONV_D3D9,
// Driver API : 5.31. Direct3D 10 Interoperability
// Runtime API: 5.17. Direct3D 10 Interoperability, 5.18. Direct3D 10 Interoperability [DEPRECATED]
CONV_D3D10,
// Driver API : 5.32. Direct3D 11 Interoperability
// Runtime API: 5.19. Direct3D 11 Interoperability, 5.20. Direct3D 11 Interoperability [DEPRECATED]
CONV_D3D11,
// Driver API : 5.33. VDPAU Interoperability
// Runtime API: 5.21. VDPAU Interoperability
CONV_VDPAU,
// Driver API : 5.34. EGL Interoperability
// Runtime API: 5.22. EGL Interoperability
CONV_EGL,
// Runtime API: 5.2. Thread Management [DEPRECATED]
CONV_THREAD,
CONV_COMPLEX,
CONV_LIB_FUNC,
CONV_LIB_DEVICE_FUNC,
CONV_DEVICE_FUNC,
CONV_INCLUDE,
CONV_INCLUDE_CUDA_MAIN_H,
CONV_TYPE,
CONV_LITERAL,
CONV_NUMERIC_LITERAL,
CONV_DEFINE,
CONV_EXTERN_SHARED,
CONV_KERNEL_LAUNCH,
CONV_LAST
};
constexpr int NUM_CONV_TYPES = (int) ConvTypes::CONV_LAST;
enum ApiTypes {
API_DRIVER = 0,
API_RUNTIME,
API_COMPLEX,
API_BLAS,
API_RAND,
API_DNN,
API_FFT,
API_SPARSE,
API_CUB,
API_CAFFE2,
API_LAST
};
constexpr int NUM_API_TYPES = (int) ApiTypes::API_LAST;
enum SupportDegree {
FULL = 0,
HIP_UNSUPPORTED = 1,
ROC_UNSUPPORTED = 2,
UNSUPPORTED = 3
};
// The names of various fields in in the statistics reports.
extern const char *counterNames[NUM_CONV_TYPES];
extern const char *counterTypes[NUM_CONV_TYPES];
extern const char *apiNames[NUM_API_TYPES];
extern const char *apiTypes[NUM_API_TYPES];
struct hipCounter {
llvm::StringRef hipName;
llvm::StringRef rocName;
ConvTypes type;
ApiTypes apiType;
SupportDegree supportDegree;
};
/**
* Tracks a set of named counters, as well as counters for each of the type enums defined above.
*/
class StatCounter {
private:
// Each thing we track is either "supported" or "unsupported"...
std::map<std::string, int> counters;
int apiCounters[NUM_API_TYPES] = {};
int convTypeCounters[NUM_CONV_TYPES] = {};
public:
void incrementCounter(const hipCounter &counter, const std::string &name);
// Add the counters from `other` onto the counters of this object.
void add(const StatCounter &other);
int getConvSum();
void print(std::ostream* csv, llvm::raw_ostream* printOut, const std::string &prefix);
};
/**
* Tracks the statistics for a single input file.
*/
class Statistics {
StatCounter supported;
StatCounter unsupported;
std::string fileName;
std::set<int> touchedLinesSet = {};
unsigned touchedLines = 0;
unsigned totalLines = 0;
unsigned touchedBytes = 0;
int totalBytes = 0;
chr::steady_clock::time_point startTime;
chr::steady_clock::time_point completionTime;
public:
Statistics(const std::string &name);
void incrementCounter(const hipCounter &counter, const std::string &name);
// Add the counters from `other` onto the counters of this object.
void add(const Statistics &other);
void lineTouched(int lineNumber);
void bytesChanged(int bytes);
// Set the completion timestamp to now.
void markCompletion();
public:
/**
* Pretty-print the statistics stored in this object.
*
* @param csv Pointer to an output stream for the CSV to write. If null, no CSV is written
* @param printOut Pointer to an output stream to print human-readable textual stats to. If null, no
* such stats are produced.
*/
void print(std::ostream* csv, llvm::raw_ostream* printOut, bool skipHeader = false);
// Print aggregated statistics for all registered counters.
static void printAggregate(std::ostream *csv, llvm::raw_ostream* printOut);
// The Statistics for each input file.
static std::map<std::string, Statistics> stats;
// The Statistics objects for the currently-being-processed input file.
static Statistics* currentStatistics;
// Aggregate statistics over all entries in `stats` and return the resulting Statistics object.
static Statistics getAggregate();
/**
* Convenient global entry point for updating the "active" Statistics. Since we operate single-threadedly
* processing one file at a time, this allows us to simply expose the stats for the current file globally,
* simplifying things.
*/
static Statistics &current();
/**
* Set the active Statistics object to the named one, creating it if necessary, and write the completion
* timestamp into the currently active one.
*/
static void setActive(const std::string &name);
// Check the counter and option TranslateToRoc whether it should be translated to Roc or not.
static bool isToRoc(const hipCounter &counter);
// Check whether the counter is HIP_UNSUPPORTED or not.
static bool isHipUnsupported(const hipCounter &counter);
// Check whether the counter is ROC_UNSUPPORTED or not.
static bool isRocUnsupported(const hipCounter &counter);
/**
* Check whether the counter is ROC_UNSUPPORTED/HIP_UNSUPPORTED/UNSUPPORTED or not
* based on counter's API_TYPE and option TranslateToRoc.
*/
static bool isUnsupported(const hipCounter &counter);
// Set this flag in case of hipification errors
bool hasErrors = false;
};
@@ -1,97 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "StringUtils.h"
#include "LLVMCompat.h"
#include "llvm/ADT/SmallString.h"
using namespace llvm;
llvm::StringRef unquoteStr(llvm::StringRef s) {
if (s.size() > 1 && s.front() == '"' && s.back() == '"') {
return s.substr(1, s.size() - 2);
}
return s;
}
void removePrefixIfPresent(std::string &s, const std::string &prefix) {
if (s.find(prefix) != 0) {
return;
}
s.erase(0, prefix.size());
}
std::string getAbsoluteFilePath(const std::string &sFile, std::error_code &EC) {
if (sFile.empty()) {
return sFile;
}
if (!sys::fs::exists(sFile)) {
llvm::errs() << "\n" << sHipify << sError << "source file: " << sFile << " doesn't exist\n";
EC = std::error_code(static_cast<int>(std::errc::no_such_file_or_directory), std::generic_category());
return "";
}
SmallString<256> fileAbsPath;
EC = llcompat::real_path(sFile, fileAbsPath, true);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": source file: " << sFile << "\n";
return "";
}
EC = std::error_code();
return fileAbsPath.c_str();
}
std::string getAbsoluteDirectoryPath(const std::string &sDir, std::error_code &EC,
const std::string &sDirType, bool bCreateDir) {
if (sDir.empty()) {
return sDir;
}
EC = std::error_code();
SmallString<256> dirAbsPath;
if (sys::fs::exists(sDir)) {
if (sys::fs::is_regular_file(sDir)) {
llvm::errs() << "\n" << sHipify << sError << sDir << " is not a directory\n";
EC = std::error_code(static_cast<int>(std::errc::not_a_directory), std::generic_category());
return "";
}
}
else {
if (bCreateDir) {
EC = sys::fs::create_directory(sDir);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": " << sDirType << " directory: " << sDir << "\n";
return "";
}
}
else {
llvm::errs() << "\n" << sHipify << sError << sDirType << " directory: " << sDir << " doesn't exist\n";
EC = std::error_code(static_cast<int>(std::errc::no_such_file_or_directory), std::generic_category());
return "";
}
}
EC = llcompat::real_path(sDir, dirAbsPath, true);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": " << sDirType << " directory: " << sDir << "\n";
return "";
}
return dirAbsPath.c_str();
}
@@ -1,48 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#include <string>
#include "llvm/ADT/StringRef.h"
/**
* Remove double-quotes from the start/end of a string, if present.
*/
llvm::StringRef unquoteStr(llvm::StringRef s);
/**
* If `s` starts with `prefix`, remove it. Otherwise, does nothing.
*/
void removePrefixIfPresent(std::string &s, const std::string &prefix);
/**
* Returns Absolute File Path based on filename, otherwise - error.
*/
std::string getAbsoluteFilePath(const std::string &sFile, std::error_code &EC);
/**
* Returns Absolute Directory Path based on directory name, otherwise - error;
* by default the directory is temporary and created.
*/
std::string getAbsoluteDirectoryPath(const std::string &sDir, std::error_code &EC,
const std::string &sDirType = "temporary", bool bCreateDir = true);
-352
View File
@@ -1,352 +0,0 @@
/*
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <cstdio>
#include <fstream>
#include <set>
#include <cmath>
#include <chrono>
#include <iomanip>
#include <sstream>
#include "CUDA2HIP.h"
#include "CUDA2HIP_Scripting.h"
#include "LLVMCompat.h"
#include "HipifyAction.h"
#include "ArgParse.h"
#include "StringUtils.h"
#include "llvm/Support/Debug.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Tool.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#if LLVM_VERSION_MAJOR < 8
#include "llvm/Support/Path.h"
#endif
constexpr auto DEBUG_TYPE = "cuda2hip";
namespace ct = clang::tooling;
void cleanupHipifyOptions(std::vector<const char*> &args) {
std::vector<std::string> hipifyOptions = {"-perl", "-python", "-roc", "-inplace",
"-no-backup", "-no-output", "-print-stats",
"-print-stats-csv", "-examine", "-save-temps",
"-skip-excluded-preprocessor-conditional-blocks"};
for (const auto &a : hipifyOptions) {
args.erase(std::remove(args.begin(), args.end(), a), args.end());
args.erase(std::remove(args.begin(), args.end(), "-" + a), args.end());
}
std::vector<std::string> hipifyDirOptions = {"-o-dir", "-o-hipify-perl-dir", "-o-stats",
"-o-python-map-dir", "-temp-dir"};
for (const auto &a : hipifyDirOptions) {
// remove all pairs of arguments "-option value"
auto it = args.erase(std::remove(args.begin(), args.end(), a), args.end());
if (it != args.end()) {
args.erase(it);
}
// remove all pairs of arguments "--option value"
it = args.erase(std::remove(args.begin(), args.end(), "-" + a), args.end());
if (it != args.end()) {
args.erase(it);
}
// remove all "-option=value" and "--option=value"
args.erase(
std::remove_if(args.begin(), args.end(),
[a](const std::string &s) { return s.find(a + "=") == 0 || s.find("-" + a + "=") == 0; }
),
args.end()
);
}
}
void sortInputFiles(int argc, const char **argv, std::vector<std::string> &files) {
if (files.size() < 2) return;
IntrusiveRefCntPtr<clang::DiagnosticOptions> diagOpts(new clang::DiagnosticOptions());
clang::TextDiagnosticPrinter diagClient(llvm::errs(), &*diagOpts);
clang::DiagnosticsEngine Diagnostics(IntrusiveRefCntPtr<clang::DiagnosticIDs>(new clang::DiagnosticIDs()), &*diagOpts, &diagClient, false);
std::unique_ptr<clang::driver::Driver> driver(new clang::driver::Driver("", "nvptx64-nvidia-cuda", Diagnostics));
std::vector<const char*> Args(argv, argv + argc);
cleanupHipifyOptions(Args);
std::unique_ptr<clang::driver::Compilation> C(driver->BuildCompilation(Args));
std::vector<std::string> sortedFiles;
for (const auto &J : C->getJobs()) {
if (std::string(J.getCreator().getName()) != "clang") continue;
const auto &JA = J.getArguments();
for (size_t i = 0; i < JA.size(); ++i) {
const auto &A = std::string(JA[i]);
if (std::find(files.begin(), files.end(), A) != files.end() &&
i > 0 && std::string(JA[i - 1]) == "-main-file-name") {
sortedFiles.push_back(A);
}
}
}
if (sortedFiles.empty()) return;
std::reverse(sortedFiles.begin(), sortedFiles.end());
files.assign(sortedFiles.begin(), sortedFiles.end());
}
void appendArgumentsAdjusters(ct::RefactoringTool &Tool, const std::string &sSourceAbsPath, const char *hipify_exe) {
if (!IncludeDirs.empty()) {
for (std::string s : IncludeDirs) {
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(s.c_str(), ct::ArgumentInsertPosition::BEGIN));
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-I", ct::ArgumentInsertPosition::BEGIN));
}
}
if (!MacroNames.empty()) {
for (std::string s : MacroNames) {
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(s.c_str(), ct::ArgumentInsertPosition::BEGIN));
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-D", ct::ArgumentInsertPosition::BEGIN));
}
}
// Includes for clang's CUDA wrappers for using by packaged hipify-clang
static int Dummy;
std::string hipify = llvm::sys::fs::getMainExecutable(hipify_exe, (void *)&Dummy);
std::string clang_inc_path = std::string(llvm::sys::path::parent_path(hipify));
clang_inc_path.append("/include");
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(clang_inc_path.c_str(), ct::ArgumentInsertPosition::BEGIN));
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-isystem", ct::ArgumentInsertPosition::BEGIN));
clang_inc_path.append("/cuda_wrappers");
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(clang_inc_path.c_str(), ct::ArgumentInsertPosition::BEGIN));
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-isystem", ct::ArgumentInsertPosition::BEGIN));
// Ensure at least c++11 is used.
std::string stdCpp = "-std=c++11";
#if defined(_MSC_VER)
stdCpp = "-std=c++14";
#endif
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(stdCpp.c_str(), ct::ArgumentInsertPosition::BEGIN));
std::string sInclude = "-I" + sys::path::parent_path(sSourceAbsPath).str();
#if defined(HIPIFY_CLANG_RES)
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-resource-dir=" HIPIFY_CLANG_RES, ct::ArgumentInsertPosition::BEGIN));
#endif
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(sInclude.c_str(), ct::ArgumentInsertPosition::BEGIN));
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-fno-delayed-template-parsing", ct::ArgumentInsertPosition::BEGIN));
if (llcompat::pragma_once_outside_header()) {
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-Wno-pragma-once-outside-header", ct::ArgumentInsertPosition::BEGIN));
}
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("--cuda-host-only", ct::ArgumentInsertPosition::BEGIN));
if (!CudaGpuArch.empty()) {
std::string sCudaGpuArch = "--cuda-gpu-arch=" + CudaGpuArch;
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(sCudaGpuArch.c_str(), ct::ArgumentInsertPosition::BEGIN));
}
if (!CudaPath.empty()) {
std::string sCudaPath = "--cuda-path=" + CudaPath;
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster(sCudaPath.c_str(), ct::ArgumentInsertPosition::BEGIN));
}
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("cuda", ct::ArgumentInsertPosition::BEGIN));
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-x", ct::ArgumentInsertPosition::BEGIN));
if (Verbose) {
Tool.appendArgumentsAdjuster(ct::getInsertArgumentAdjuster("-v", ct::ArgumentInsertPosition::END));
}
Tool.appendArgumentsAdjuster(ct::getClangSyntaxOnlyAdjuster());
}
bool generatePython() {
bool bToRoc = TranslateToRoc;
TranslateToRoc = true;
bool bToPython = python::generate(GeneratePython);
TranslateToRoc = bToRoc;
return bToPython;
}
int main(int argc, const char **argv) {
std::vector<const char*> new_argv(argv, argv + argc);
if (std::find(new_argv.begin(), new_argv.end(), std::string("--")) == new_argv.end()) {
new_argv.push_back("--");
new_argv.push_back(nullptr);
argv = new_argv.data();
argc++;
}
llcompat::PrintStackTraceOnErrorSignal();
ct::CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, llvm::cl::ZeroOrMore);
if (!llcompat::CheckCompatibility()) {
return 1;
}
std::vector<std::string> fileSources = OptionsParser.getSourcePathList();
if (fileSources.empty() && !GeneratePerl && !GeneratePython) {
llvm::errs() << "\n" << sHipify << sError << "Must specify at least 1 positional argument for source file" << "\n";
return 1;
}
if (!perl::generate(GeneratePerl)) {
llvm::errs() << "\n" << sHipify << sError << "hipify-perl generating failed" << "\n";
return 1;
}
if (!generatePython()) {
llvm::errs() << "\n" << sHipify << sError << "hipify-python generating failed" << "\n";
return 1;
}
if (fileSources.empty()) {
return 0;
}
std::string dst = OutputFilename, dstDir = OutputDir;
std::error_code EC;
std::string sOutputDirAbsPath = getAbsoluteDirectoryPath(OutputDir, EC, "output");
if (EC) {
return 1;
}
if (!dst.empty()) {
if (fileSources.size() > 1) {
llvm::errs() << sHipify << sConflict << "-o and multiple source files are specified\n";
return 1;
}
if (Inplace) {
llvm::errs() << sHipify << sConflict << "both -o and -inplace options are specified\n";
return 1;
}
if (NoOutput) {
llvm::errs() << sHipify << sConflict << "both -no-output and -o options are specified\n";
return 1;
}
if (!dstDir.empty()) {
dst = sOutputDirAbsPath + "/" + dst;
}
}
if (NoOutput && Inplace) {
llvm::errs() << sHipify << sConflict << "both -no-output and -inplace options are specified\n";
return 1;
}
if (!dstDir.empty() && Inplace) {
llvm::errs() << sHipify << sConflict << "both -o-dir and -inplace options are specified\n";
return 1;
}
if (Examine) {
NoOutput = PrintStats = true;
}
int Result = 0;
SmallString<128> tmpFile;
StringRef sourceFileName, ext = "hip", csv_ext = "csv";
std::string sTmpFileName, sSourceAbsPath;
std::string sTmpDirAbsParh = getAbsoluteDirectoryPath(TemporaryDir, EC);
if (EC) {
return 1;
}
// Arguments for the Statistics print routines.
std::unique_ptr<std::ostream> csv = nullptr;
llvm::raw_ostream *statPrint = nullptr;
bool create_csv = false;
if (!OutputStatsFilename.empty()) {
PrintStatsCSV = true;
create_csv = true;
} else {
if (PrintStatsCSV && fileSources.size() > 1) {
OutputStatsFilename = "sum_stat.csv";
create_csv = true;
}
}
if (create_csv) {
if (!OutputDir.empty()) {
OutputStatsFilename = sOutputDirAbsPath + "/" + OutputStatsFilename;
}
csv = std::unique_ptr<std::ostream>(new std::ofstream(OutputStatsFilename, std::ios_base::trunc));
}
if (PrintStats) {
statPrint = &llvm::errs();
}
sortInputFiles(argc, argv, fileSources);
for (const auto &src : fileSources) {
// Create a copy of the file to work on. When we're done, we'll move this onto the
// output (which may mean overwriting the input, if we're in-place).
// Should we fail for some reason, we'll just leak this file and not corrupt the input.
sSourceAbsPath = getAbsoluteFilePath(src, EC);
if (EC) {
continue;
}
sourceFileName = sys::path::filename(sSourceAbsPath);
if (dst.empty()) {
if (Inplace) {
dst = src;
} else {
dst = src + "." + ext.str();
if (!dstDir.empty()) {
dst = sOutputDirAbsPath + "/" + sourceFileName.str() + "." + ext.str();
}
}
}
if (TemporaryDir.empty()) {
EC = sys::fs::createTemporaryFile(sourceFileName, ext, tmpFile);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": " << tmpFile << "\n";
Result = 1;
continue;
}
} else {
sTmpFileName = sTmpDirAbsParh + "/" + sourceFileName.str() + "." + ext.str();
tmpFile = sTmpFileName;
}
EC = sys::fs::copy_file(src, tmpFile);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": while copying " << src << " to " << tmpFile << "\n";
Result = 1;
continue;
}
if (PrintStatsCSV) {
if (OutputStatsFilename.empty()) {
OutputStatsFilename = sourceFileName.str() + "." + csv_ext.str();
if (!OutputDir.empty()) {
OutputStatsFilename = sOutputDirAbsPath + "/" + OutputStatsFilename;
}
}
if (!csv) {
csv = std::unique_ptr<std::ostream>(new std::ofstream(OutputStatsFilename, std::ios_base::trunc));
}
}
// Initialise the statistics counters for this file.
Statistics::setActive(src);
// RefactoringTool operates on the file in-place. Giving it the output path is no good,
// because that'll break relative includes, and we don't want to overwrite the input file.
// So what we do is operate on a copy, which we then move to the output.
ct::RefactoringTool Tool(OptionsParser.getCompilations(), std::string(tmpFile.c_str()));
ct::Replacements &replacementsToUse = llcompat::getReplacements(Tool, tmpFile.c_str());
ReplacementsFrontendActionFactory<HipifyAction> actionFactory(&replacementsToUse);
appendArgumentsAdjusters(Tool, sSourceAbsPath, argv[0]);
Statistics &currentStat = Statistics::current();
// Hipify _all_ the things!
if (Tool.runAndSave(&actionFactory)) {
currentStat.hasErrors = true;
Result = 1;
LLVM_DEBUG(llvm::dbgs() << "Skipped some replacements.\n");
}
// Copy the tmpfile to the output
if (!NoOutput && !currentStat.hasErrors) {
EC = sys::fs::copy_file(tmpFile, dst);
if (EC) {
llvm::errs() << "\n" << sHipify << sError << EC.message() << ": while copying " << tmpFile << " to " << dst << "\n";
Result = 1;
continue;
}
}
// Remove the tmp file without error check
if (!SaveTemps) {
sys::fs::remove(tmpFile);
}
Statistics::current().markCompletion();
Statistics::current().print(csv.get(), statPrint);
dst.clear();
}
if (fileSources.size() > 1) {
Statistics::printAggregate(csv.get(), statPrint);
}
return Result;
}
@@ -34,7 +34,7 @@ THE SOFTWARE.
#include <hip/hcc_detail/device_library_decls.h>
#include <hip/hcc_detail/llvm_intrinsics.h>
#if __HIP_CLANG_ONLY__ && __HIP_VDI__
#if __HIP_CLANG_ONLY__ && __HIP_VDI__ && !_WIN32
extern "C" __device__ int printf(const char *fmt, ...);
#else
#if HC_FEATURE_PRINTF
@@ -140,10 +140,10 @@ void hipLaunchKernelGGLImpl(
} // Namespace hip_impl.
template <typename F>
template <class T>
inline
hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* blockSize,
F kernel, size_t dynSharedMemPerBlk, uint32_t blockSizeLimit) {
hipError_t hipOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
T kernel, size_t dynSharedMemPerBlk = 0, int blockSizeLimit = 0) {
using namespace hip_impl;
@@ -151,22 +151,24 @@ hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* block
auto f = get_program_state().kernel_descriptor(reinterpret_cast<std::uintptr_t>(kernel),
target_agent(0));
return hipOccupancyMaxPotentialBlockSize(gridSize, blockSize, f,
return hipModuleOccupancyMaxPotentialBlockSize(gridSize, blockSize, f,
dynSharedMemPerBlk, blockSizeLimit);
}
template <typename F>
template <class T>
inline
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(uint32_t* numBlocks, F kernel,
uint32_t blockSize, size_t dynSharedMemPerBlk) {
hipError_t hipOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* blockSize,
T kernel, size_t dynSharedMemPerBlk = 0, int blockSizeLimit = 0, unsigned int flags = 0 ) {
using namespace hip_impl;
hip_impl::hip_init();
if(flags != hipOccupancyDefault) return hipErrorNotSupported;
auto f = get_program_state().kernel_descriptor(reinterpret_cast<std::uintptr_t>(kernel),
target_agent(0));
return hipOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, f, blockSize, dynSharedMemPerBlk);
return hipModuleOccupancyMaxPotentialBlockSize(gridSize, blockSize, f,
dynSharedMemPerBlk, blockSizeLimit);
}
template <typename... Args, typename F = void (*)(Args...)>
@@ -27,7 +27,7 @@ THE SOFTWARE.
// HIP heap is implemented as a global array with fixed size. Users may define
// __HIP_SIZE_OF_PAGE and __HIP_NUM_PAGES to have a larger heap.
#if (__HCC__ || __HIP__) && __HIP_ENABLE_MALLOC__
#if (__HCC__ || __HIP__) && __HIP_ENABLE_DEVICE_MALLOC__
// Size of page in bytes.
#ifndef __HIP_SIZE_OF_PAGE
@@ -45,8 +45,8 @@ THE SOFTWARE.
#endif //__cplusplus
// __hip_malloc is not working. Disable it by default.
#ifndef __HIP_ENABLE_MALLOC__
#define __HIP_ENABLE_MALLOC__ 0
#ifndef __HIP_ENABLE_DEVICE_MALLOC__
#define __HIP_ENABLE_DEVICE_MALLOC__ 0
#endif
#if __HCC_OR_HIP_CLANG__
@@ -313,7 +313,7 @@ static constexpr Coordinates<hip_impl::WorkitemId> threadIdx{};
#endif // defined __HCC__
#if __HCC_OR_HIP_CLANG__
#if __HIP_ENABLE_MALLOC__
#if __HIP_ENABLE_DEVICE_MALLOC__
extern "C" __device__ void* __hip_malloc(size_t);
extern "C" __device__ void* __hip_free(void* ptr);
static inline __device__ void* malloc(size_t size) { return __hip_malloc(size); }
@@ -97,8 +97,6 @@ typedef int hipDevice_t;
typedef struct ihipStream_t* hipStream_t;
// TODO: IPC implementation
#define hipIpcMemLazyEnablePeerAccess 0
#define HIP_IPC_HANDLE_SIZE 64
@@ -107,13 +105,15 @@ typedef struct hipIpcMemHandle_st {
char reserved[HIP_IPC_HANDLE_SIZE];
} hipIpcMemHandle_t;
#if __HIP_VDI__
// TODO: IPC event handle currently unsupported
struct ihipIpcEventHandle_t;
typedef struct ihipIpcEventHandle_t* hipIpcEventHandle_t;
// END TODO
#else
typedef struct hipIpcEventHandle_st {
char reserved[HIP_IPC_HANDLE_SIZE];
} hipIpcEventHandle_t;
#endif
typedef struct ihipModule_t* hipModule_t;
typedef struct ihipModuleSymbol_t* hipFunction_t;
@@ -266,7 +266,6 @@ typedef enum hipSharedMemConfig {
///< when adjacent threads access data 4 bytes apart.
} hipSharedMemConfig;
/**
* Struct for data in 3D
*
@@ -3007,9 +3006,51 @@ hipError_t hipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsLi
*
* @returns hipSuccess, hipInvalidDevice, hipErrorInvalidValue
*/
hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* blockSize,
//TODO - Match CUoccupancyB2DSize
hipError_t hipModuleOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
uint32_t blockSizeLimit);
int blockSizeLimit);
/**
* @brief determine the grid and block sizes to achieves maximum occupancy for a kernel
*
* @param [out] gridSize minimum grid size for maximum potential occupancy
* @param [out] blockSize block size for maximum potential occupancy
* @param [in] f kernel function for which occupancy is calulated
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
* @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit
* @param [in] flags Extra flags for occupancy calculation (only default supported)
*
* @returns hipSuccess, hipInvalidDevice, hipErrorInvalidValue
*/
//TODO - Match CUoccupancyB2DSize
hipError_t hipModuleOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
int blockSizeLimit, unsigned int flags);
/**
* @brief Returns occupancy for a device function.
*
* @param [out] numBlocks Returned occupancy
* @param [in] func Kernel function (hipFunction) for which occupancy is calulated
* @param [in] blockSize Block size the kernel is intended to be launched with
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
*/
hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessor(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk);
/**
* @brief Returns occupancy for a device function.
*
* @param [out] numBlocks Returned occupancy
* @param [in] f Kernel function(hipFunction_t) for which occupancy is calulated
* @param [in] blockSize Block size the kernel is intended to be launched with
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
* @param [in] flags Extra flags for occupancy calculation (only default supported)
*/
hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags);
/**
* @brief Returns occupancy for a device function.
@@ -3020,18 +3061,7 @@ hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* block
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
*/
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk);
/**
* @brief Returns occupancy for a device function.
*
* @param [out] numBlocks Returned occupancy
* @param [in] func Kernel function (hipFunction) for which occupancy is calulated
* @param [in] blockSize Block size the kernel is intended to be launched with
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
*/
hipError_t hipDrvOccupancyMaxActiveBlocksPerMultiprocessor(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk);
int* numBlocks, const void* f, int blockSize, size_t dynSharedMemPerBlk);
/**
* @brief Returns occupancy for a device function.
@@ -3043,19 +3073,22 @@ hipError_t hipDrvOccupancyMaxActiveBlocksPerMultiprocessor(
* @param [in] flags Extra flags for occupancy calculation (currently ignored)
*/
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk, unsigned int flags __dparm(hipOccupancyDefault));
int* numBlocks, const void* f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags __dparm(hipOccupancyDefault));
/**
* @brief Returns occupancy for a device function.
* @brief determine the grid and block sizes to achieves maximum occupancy for a kernel
*
* @param [out] numBlocks Returned occupancy
* @param [in] f Kernel function(hipFunction_t) for which occupancy is calulated
* @param [in] blockSize Block size the kernel is intended to be launched with
* @param [out] gridSize minimum grid size for maximum potential occupancy
* @param [out] blockSize block size for maximum potential occupancy
* @param [in] f kernel function for which occupancy is calulated
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
* @param [in] flags Extra flags for occupancy calculation (currently ignored)
* @param [in] blockSizeLimit the maximum block size for the kernel, use 0 for no limit
*
* @returns hipSuccess, hipInvalidDevice, hipErrorInvalidValue
*/
hipError_t hipDrvOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags);
hipError_t hipOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
const void* f, size_t dynSharedMemPerBlk,
int blockSizeLimit);
/**
* @brief Launches kernels on multiple devices and guarantees all specified kernels are dispatched
@@ -3201,10 +3234,8 @@ hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned
hipError_t hipIpcCloseMemHandle(void* devPtr);
// hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr);
// hipError_t hipIpcCloseMemHandle(void *devPtr);
// // hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle);
// hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned int flags);
hipError_t hipIpcGetEventHandle(hipIpcEventHandle_t* handle, hipEvent_t event);
hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle);
/**
@@ -3524,17 +3555,16 @@ hipError_t hipTexObjectGetTextureDesc(
#endif
#if defined(__cplusplus) && !defined(__HCC__) && defined(__clang__) && defined(__HIP__)
template <typename F>
static hipError_t __host__ inline hipOccupancyMaxActiveBlocksPerMultiprocessor(
uint32_t* numBlocks, F func, uint32_t blockSize, size_t dynSharedMemPerBlk) {
return ::hipOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, (hipFunction_t)func, blockSize,
dynSharedMemPerBlk);
template <typename T>
static hipError_t __host__ inline hipOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
T f, size_t dynSharedMemPerBlk = 0, int blockSizeLimit = 0) {
return hipOccupancyMaxPotentialBlockSize(gridSize, blockSize, reinterpret_cast<const void*>(f),dynSharedMemPerBlk,blockSizeLimit);
}
template <typename F>
static hipError_t __host__ inline hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
uint32_t* numBlocks, F func, uint32_t blockSize, size_t dynSharedMemPerBlk, unsigned int flags) {
return ::hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
numBlocks, (hipFunction_t)func, blockSize, dynSharedMemPerBlk, flags);
template <typename T>
static hipError_t __host__ inline hipOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* blockSize,
T f, size_t dynSharedMemPerBlk = 0, int blockSizeLimit = 0, unsigned int flags = 0 ) {
return hipOccupancyMaxPotentialBlockSize(gridSize, blockSize, reinterpret_cast<const void*>(f),dynSharedMemPerBlk,blockSizeLimit);
}
#endif // defined(__cplusplus) && !defined(__HCC__) && defined(__clang__) && defined(__HIP__)
@@ -3600,6 +3630,20 @@ const char* hipKernelNameRef(const hipFunction_t f);
#ifdef __cplusplus
template <class T>
inline hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
int* numBlocks, T f, int blockSize, size_t dynSharedMemPerBlk) {
return hipOccupancyMaxActiveBlocksPerMultiprocessor(
numBlocks, reinterpret_cast<const void*>(f), blockSize, dynSharedMemPerBlk);
}
template <class T>
inline hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
int* numBlocks, T f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags) {
return hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
numBlocks, reinterpret_cast<const void*>(f), blockSize, dynSharedMemPerBlk, flags);
}
class TlsData;
#if !__HIP_VDI__
@@ -3753,7 +3797,7 @@ hipError_t hipBindTextureToMipmappedArray(const texture<T, dim, readMode>& tex,
#if __HIP_VDI__ && !defined(__HCC__)
template <typename F>
inline hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* blockSize,
inline hipError_t hipOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
F kernel, size_t dynSharedMemPerBlk, uint32_t blockSizeLimit) {
return hipOccupancyMaxPotentialBlockSize(gridSize, blockSize,(hipFunction_t)kernel, dynSharedMemPerBlk, blockSizeLimit);
}
@@ -47,6 +47,19 @@ THE SOFTWARE.
#include "kalmar_math.h"
#endif
#if _LIBCPP_VERSION && __HIP__
namespace std {
template <>
struct __numeric_type<_Float16>
{
static _Float16 __test(_Float16);
typedef _Float16 type;
static const bool value = true;
};
}
#endif // _LIBCPP_VERSION
#pragma push_macro("__DEVICE__")
#pragma push_macro("__RETURN_TYPE")
@@ -73,6 +73,9 @@ public:
hsa_executable_t load_executable(const char*, const size_t,
hsa_executable_t,
hsa_agent_t);
hsa_executable_t load_executable_no_copy(const char*, const size_t,
hsa_executable_t,
hsa_agent_t);
void* global_addr_by_name(const char* name);
+280
View File
@@ -0,0 +1,280 @@
/**
* MIT License
*
* Copyright 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*!\file
* \brief hip_bfloat16.h provides struct for hip_bfloat16 typedef
*/
#ifndef _HIP_BFLOAT16_H_
#define _HIP_BFLOAT16_H_
#if __cplusplus < 201103L || (!defined(__HCC__) && !defined(__HIPCC__))
// If this is a C compiler, C++ compiler below C++11, or a host-only compiler, we only
// include a minimal definition of hip_bfloat16
#include <stdint.h>
/*! \brief Struct to represent a 16 bit brain floating point number. */
typedef struct
{
uint16_t data;
} hip_bfloat16;
#else // __cplusplus < 201103L || (!defined(__HCC__) && !defined(__HIPCC__))
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <hip/hip_runtime.h>
#include <ostream>
#include <type_traits>
struct hip_bfloat16
{
uint16_t data;
enum truncate_t
{
truncate
};
__host__ __device__ hip_bfloat16() = default;
// round upper 16 bits of IEEE float to convert to bfloat16
explicit __host__ __device__ hip_bfloat16(float f)
: data(float_to_bfloat16(f))
{
}
explicit __host__ __device__ hip_bfloat16(float f, truncate_t)
: data(truncate_float_to_bfloat16(f))
{
}
// zero extend lower 16 bits of bfloat16 to convert to IEEE float
__host__ __device__ operator float() const
{
union
{
uint32_t int32;
float fp32;
} u = {uint32_t(data) << 16};
return u.fp32;
}
static __host__ __device__ hip_bfloat16 round_to_bfloat16(float f)
{
hip_bfloat16 output;
output.data = float_to_bfloat16(f);
return output;
}
static __host__ __device__ hip_bfloat16 round_to_bfloat16(float f, truncate_t)
{
hip_bfloat16 output;
output.data = truncate_float_to_bfloat16(f);
return output;
}
private:
static __host__ __device__ uint16_t float_to_bfloat16(float f)
{
union
{
float fp32;
uint32_t int32;
} u = {f};
if(~u.int32 & 0x7f800000)
{
// When the exponent bits are not all 1s, then the value is zero, normal,
// or subnormal. We round the bfloat16 mantissa up by adding 0x7FFF, plus
// 1 if the least significant bit of the bfloat16 mantissa is 1 (odd).
// This causes the bfloat16's mantissa to be incremented by 1 if the 16
// least significant bits of the float mantissa are greater than 0x8000,
// or if they are equal to 0x8000 and the least significant bit of the
// bfloat16 mantissa is 1 (odd). This causes it to be rounded to even when
// the lower 16 bits are exactly 0x8000. If the bfloat16 mantissa already
// has the value 0x7f, then incrementing it causes it to become 0x00 and
// the exponent is incremented by one, which is the next higher FP value
// to the unrounded bfloat16 value. When the bfloat16 value is subnormal
// with an exponent of 0x00 and a mantissa of 0x7F, it may be rounded up
// to a normal value with an exponent of 0x01 and a mantissa of 0x00.
// When the bfloat16 value has an exponent of 0xFE and a mantissa of 0x7F,
// incrementing it causes it to become an exponent of 0xFF and a mantissa
// of 0x00, which is Inf, the next higher value to the unrounded value.
u.int32 += 0x7fff + ((u.int32 >> 16) & 1); // Round to nearest, round to even
}
else if(u.int32 & 0xffff)
{
// When all of the exponent bits are 1, the value is Inf or NaN.
// Inf is indicated by a zero mantissa. NaN is indicated by any nonzero
// mantissa bit. Quiet NaN is indicated by the most significant mantissa
// bit being 1. Signaling NaN is indicated by the most significant
// mantissa bit being 0 but some other bit(s) being 1. If any of the
// lower 16 bits of the mantissa are 1, we set the least significant bit
// of the bfloat16 mantissa, in order to preserve signaling NaN in case
// the bloat16's mantissa bits are all 0.
u.int32 |= 0x10000; // Preserve signaling NaN
}
return uint16_t(u.int32 >> 16);
}
// Truncate instead of rounding, preserving SNaN
static __host__ __device__ uint16_t truncate_float_to_bfloat16(float f)
{
union
{
float fp32;
uint32_t int32;
} u = {f};
return uint16_t(u.int32 >> 16) | (!(~u.int32 & 0x7f800000) && (u.int32 & 0xffff));
}
};
typedef struct
{
uint16_t data;
} hip_bfloat16_public;
static_assert(std::is_standard_layout<hip_bfloat16>{},
"hip_bfloat16 is not a standard layout type, and thus is "
"incompatible with C.");
static_assert(std::is_trivial<hip_bfloat16>{},
"hip_bfloat16 is not a trivial type, and thus is "
"incompatible with C.");
static_assert(sizeof(hip_bfloat16) == sizeof(hip_bfloat16_public)
&& offsetof(hip_bfloat16, data) == offsetof(hip_bfloat16_public, data),
"internal hip_bfloat16 does not match public hip_bfloat16");
inline std::ostream& operator<<(std::ostream& os, const hip_bfloat16& bf16)
{
return os << float(bf16);
}
inline __host__ __device__ hip_bfloat16 operator+(hip_bfloat16 a)
{
return a;
}
inline __host__ __device__ hip_bfloat16 operator-(hip_bfloat16 a)
{
a.data ^= 0x8000;
return a;
}
inline __host__ __device__ hip_bfloat16 operator+(hip_bfloat16 a, hip_bfloat16 b)
{
return hip_bfloat16(float(a) + float(b));
}
inline __host__ __device__ hip_bfloat16 operator-(hip_bfloat16 a, hip_bfloat16 b)
{
return hip_bfloat16(float(a) - float(b));
}
inline __host__ __device__ hip_bfloat16 operator*(hip_bfloat16 a, hip_bfloat16 b)
{
return hip_bfloat16(float(a) * float(b));
}
inline __host__ __device__ hip_bfloat16 operator/(hip_bfloat16 a, hip_bfloat16 b)
{
return hip_bfloat16(float(a) / float(b));
}
inline __host__ __device__ bool operator<(hip_bfloat16 a, hip_bfloat16 b)
{
return float(a) < float(b);
}
inline __host__ __device__ bool operator==(hip_bfloat16 a, hip_bfloat16 b)
{
return float(a) == float(b);
}
inline __host__ __device__ bool operator>(hip_bfloat16 a, hip_bfloat16 b)
{
return b < a;
}
inline __host__ __device__ bool operator<=(hip_bfloat16 a, hip_bfloat16 b)
{
return !(a > b);
}
inline __host__ __device__ bool operator!=(hip_bfloat16 a, hip_bfloat16 b)
{
return !(a == b);
}
inline __host__ __device__ bool operator>=(hip_bfloat16 a, hip_bfloat16 b)
{
return !(a < b);
}
inline __host__ __device__ hip_bfloat16& operator+=(hip_bfloat16& a, hip_bfloat16 b)
{
return a = a + b;
}
inline __host__ __device__ hip_bfloat16& operator-=(hip_bfloat16& a, hip_bfloat16 b)
{
return a = a - b;
}
inline __host__ __device__ hip_bfloat16& operator*=(hip_bfloat16& a, hip_bfloat16 b)
{
return a = a * b;
}
inline __host__ __device__ hip_bfloat16& operator/=(hip_bfloat16& a, hip_bfloat16 b)
{
return a = a / b;
}
inline __host__ __device__ hip_bfloat16& operator++(hip_bfloat16& a)
{
return a += hip_bfloat16(1.0f);
}
inline __host__ __device__ hip_bfloat16& operator--(hip_bfloat16& a)
{
return a -= hip_bfloat16(1.0f);
}
inline __host__ __device__ hip_bfloat16 operator++(hip_bfloat16& a, int)
{
hip_bfloat16 orig = a;
++a;
return orig;
}
inline __host__ __device__ hip_bfloat16 operator--(hip_bfloat16& a, int)
{
hip_bfloat16 orig = a;
--a;
return orig;
}
namespace std
{
constexpr __host__ __device__ bool isinf(hip_bfloat16 a)
{
return !(~a.data & 0x7f80) && !(a.data & 0x7f);
}
constexpr __host__ __device__ bool isnan(hip_bfloat16 a)
{
return !(~a.data & 0x7f80) && +(a.data & 0x7f);
}
constexpr __host__ __device__ bool iszero(hip_bfloat16 a)
{
return !(a.data & 0x7fff);
}
}
#endif // __cplusplus < 201103L || (!defined(__HCC__) && !defined(__HIPCC__))
#endif // _HIP_BFLOAT16_H_
@@ -1295,10 +1295,50 @@ inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(int* numBl
const void* func,
int blockSize,
size_t dynamicSMemSize) {
cudaError_t cerror;
cerror =
cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize);
return hipCUDAErrorTohipError(cerror);
return hipCUDAErrorTohipError(cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func,
blockSize, dynamicSMemSize));
}
inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks,
const void* func,
int blockSize,
size_t dynamicSMemSize,
unsigned int flags) {
return hipCUDAErrorTohipError(cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func,
blockSize, dynamicSMemSize, flags));
}
inline static hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks,
hipFunction_t f,
int blockSize,
size_t dynamicSMemSize ){
return hipCUResultTohipError(cuOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, f,
blockSize, dynamicSMemSize));
}
inline static hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks,
hipFunction_t f,
int blockSize,
size_t dynamicSMemSize,
unsigned int flags ) {
return hipCUResultTohipError(cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks,f,
blockSize, dynamicSMemSize, flags));
}
//TODO - Match CUoccupancyB2DSize
inline static hipError_t hipModuleOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
int blockSizeLimit){
return hipCUResultTohipError(cuOccupancyMaxPotentialBlockSize(gridSize, blockSize, f, NULL,
dynSharedMemPerBlk, blockSizeLimit));
}
//TODO - Match CUoccupancyB2DSize
inline static hipError_t hipModuleOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
int blockSizeLimit, unsigned int flags){
return hipCUResultTohipError(cuOccupancyMaxPotentialBlockSizeWithFlags(gridSize, blockSize, f, NULL,
dynSharedMemPerBlk, blockSizeLimit, flags));
}
inline static hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void* ptr) {
@@ -1713,19 +1753,31 @@ inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(int* numBl
T func,
int blockSize,
size_t dynamicSMemSize) {
cudaError_t cerror;
cerror =
cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize);
return hipCUDAErrorTohipError(cerror);
return hipCUDAErrorTohipError(cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func,
blockSize, dynamicSMemSize));
}
template <class T>
inline static hipError_t hipOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, T func,
size_t dynamicSMemSize = 0,
int blockSizeLimit = 0) {
cudaError_t cerror;
cerror = cudaOccupancyMaxPotentialBlockSize(minGridSize, blockSize, func, dynamicSMemSize, blockSizeLimit);
return hipCUDAErrorTohipError(cerror);
return hipCUDAErrorTohipError(cudaOccupancyMaxPotentialBlockSize(minGridSize, blockSize, func,
dynamicSMemSize, blockSizeLimit));
}
template <class T>
inline static hipError_t hipOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, T func,
size_t dynamicSMemSize = 0,
int blockSizeLimit = 0, unsigned int flags = 0) {
return hipCUDAErrorTohipError(cudaOccupancyMaxPotentialBlockSize(minGridSize, blockSize, func,
dynamicSMemSize, blockSizeLimit, flags));
}
template <class T>
inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( int* numBlocks, T func,
int blockSize, size_t dynamicSMemSize,unsigned int flags) {
return hipCUDAErrorTohipError(cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func,
blockSize, dynamicSMemSize, flags));
}
template <class T, int dim, enum cudaTextureReadMode readMode>
+2 -6
View File
@@ -21,24 +21,22 @@ trap cleanup EXIT
export GRIPURL=$hip_srcdir
export GRIPHOME=$workdir
echo "CACHE_DIRECTORY = '$html_destdir/asset'" > $workdir/settings.py
mkdir -p $html_destdir $html_destdir/hipify-clang $html_destdir/docs/markdown
mkdir -p $html_destdir $html_destdir/docs/markdown
# convert all md files to html
pushd $hip_srcdir
for f in *.md hipify-clang/*.md docs/markdown/*.md; do grip --export --no-inline $f $html_destdir/${f%.*}.html; done
for f in *.md docs/markdown/*.md; do grip --export --no-inline $f $html_destdir/${f%.*}.html; done
popd
# convert absolute links to relative links
pushd $html_destdir
for f in *.html; do sed -i "s?$GRIPURL/??g" $f; done
for f in hipify-clang/*.html; do sed -i "s?$GRIPURL/?../?g" $f; done
for f in docs/markdown/*.html; do sed -i "s?$GRIPURL/?../../?g" $f; done
popd
# update document titles
pushd $html_destdir
for f in *.html; do sed -i "s?.md - Grip??g" $f; done
for f in hipify-clang/*.html; do sed -i "s?.md - Grip??g" $f; done
for f in docs/markdown/*.html; do sed -i "s?.md - Grip??g" $f; done
popd
@@ -46,8 +44,6 @@ popd
pushd $html_destdir
for f in *.html; do sed -i "s?.md\"?.html\"?g" $f; done
for f in *.html; do sed -i "s?.md#?.html#?g" $f; done
for f in hipify-clang/*.html; do sed -i "s?.md\"?.html\"?g" $f; done
for f in hipify-clang/*.html; do sed -i "s?.md#?.html#?g" $f; done
for f in docs/markdown/*.html; do sed -i "s?.md\"?.html\"?g" $f; done
for f in docs/markdown/*.html; do sed -i "s?.md#?.html#?g" $f; done
popd
@@ -1,6 +1,6 @@
# Square.md
Simple test which shows how to use hipify to port CUDA code to HIP.
Simple test which shows how to use hipify-perl to port CUDA code to HIP.
See related [blog](http://gpuopen.com/hip-to-be-squared-an-introductory-hip-tutorial) that explains the example.
Now it is even simpler and requires no manual modification to the hipified source code - just hipify and compile:
@@ -96,6 +96,6 @@ Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -55,6 +55,6 @@ Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -48,6 +48,6 @@ make
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -58,9 +58,9 @@ void launchKernel(float* C, float* A, float* B, bool manual){
const unsigned threadsperblock = 32;
const unsigned blocks = (NUM/threadsperblock)+1;
uint32_t mingridSize = 0;
uint32_t gridSize = 0;
uint32_t blockSize = 0;
int mingridSize = 0;
int gridSize = 0;
int blockSize = 0;
if (manual){
blockSize = threadsperblock;
@@ -88,7 +88,7 @@ void launchKernel(float* C, float* A, float* B, bool manual){
printf("kernel Execution time = %6.3fms\n", eventMs);
//Calculate Occupancy
uint32_t numBlock = 0;
int numBlock = 0;
HIP_CHECK(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, multiply, blockSize, 0));
if(devProp.maxThreadsPerMultiProcessor){
@@ -75,6 +75,6 @@ Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -37,6 +37,6 @@ Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -48,6 +48,6 @@ please make sure you have a 3.0 or higher compute capable device in order to use
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -50,6 +50,6 @@ please make sure you have a 3.0 or higher compute capable device in order to use
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -44,6 +44,6 @@ Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -58,6 +58,6 @@ Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
@@ -43,6 +43,6 @@ please make sure you have a 3.0 or higher compute capable device in order to use
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_porting_guide.md)
- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/README.md)
- [HIPIFY](https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/README.md)
- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/blob/master/CONTRIBUTING.md)
- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/blob/master/RELEASE.md)
+3 -3
View File
@@ -90,9 +90,9 @@ __hipRegisterFatBinary(const void* data)
reinterpret_cast<uintptr_t>(header) + desc->offset), desc->size};
if (HIP_DUMP_CODE_OBJECT)
__hipDumpCodeObject(image);
module->executable = hip_impl::get_program_state().load_executable(image.data(), image.size(),
module->executable,
agent);
module->executable = hip_impl::get_program_state().load_executable_no_copy(
reinterpret_cast<const char*>(header) + desc->offset, desc->size,
module->executable, agent);
if (module->executable.handle) {
hip_impl::program_state_impl::read_kernarg_metadata(image, module->kernargs);
+3 -2
View File
@@ -96,12 +96,13 @@ hipError_t hipDeviceGetLimit(size_t* pValue, hipLimit_t limit) {
if (pValue == nullptr) {
return ihipLogStatus(hipErrorInvalidValue);
}
#if __HIP_ENABLE_DEVICE_MALLOC__
if (limit == hipLimitMallocHeapSize) {
*pValue = (size_t)__HIP_SIZE_OF_HEAP;
return ihipLogStatus(hipSuccess);
} else {
return ihipLogStatus(hipErrorUnsupportedLimit);
}
#endif
return ihipLogStatus(hipErrorUnsupportedLimit);
}
hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t cacheConfig) {
+282 -39
View File
@@ -24,13 +24,86 @@ THE SOFTWARE.
#include "hip_hcc_internal.h"
#include "trace_helper.h"
#include <errno.h> // errno, ENOENT
#include <fcntl.h> // O_RDWR, O_CREATE
#include <sys/mman.h> // shm_open, shm_unlink, mmap, munmap, PROT_READ, PROT_WRITE, MAP_SHARED, MAP_FAILED
#include <unistd.h> // ftruncate, close
namespace {
inline
const char* hsa_to_string(hsa_status_t err) noexcept
{
const char* r{};
if (hsa_status_string(err, &r) == HSA_STATUS_SUCCESS) return r;
return "Unknown.";
}
template<std::size_t m, std::size_t n>
inline
void throwing_result_check(hsa_status_t res, const char (&file)[m],
const char (&function)[n], int line) {
if (res == HSA_STATUS_SUCCESS) return;
throw std::runtime_error{"Failed in file " + (file +
(", in function \"" + (function +
("\", on line " + std::to_string(line))))) +
", with error: " + hsa_to_string(res)};
}
template<std::size_t m, std::size_t n>
inline
void throwing_retval_check(int good, int retval, const char (&file)[m],
const char (&function)[n], int line) {
if (retval == good) return;
throw std::runtime_error{"Failed in file " + (file +
(", in function \"" + (function +
("\", on line " + std::to_string(line))))) +
", with error: " + strerror(retval)};
}
template<std::size_t m, std::size_t n, std::size_t o>
inline
void throwing_msg_check(bool bad, const char (&msg)[o],
const char (&file)[m],
const char (&function)[n], int line) {
if (!bad) return;
throw std::runtime_error{"Failed in file " + (file +
(", in function \"" + (function +
("\", on line " + std::to_string(line))))) +
", with error: " + msg};
}
template<std::size_t m, std::size_t n>
inline
void throwing_errno_check(bool bad, const char (&file)[m],
const char (&function)[n], int line) {
if (!bad) return;
throw std::runtime_error{"Failed in file " + (file +
(", in function \"" + (function +
("\", on line " + std::to_string(line))))) +
", with error: " + strerror(errno)};
}
} // Unnamed namespace.
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// Events
//---
ihipEvent_t::ihipEvent_t(unsigned flags) : _criticalData(this) { _flags = flags; };
ihipEvent_t::ihipEvent_t(unsigned flags) : _criticalData(this) {
_flags = flags;
GET_TLS();
auto ctx = ihipGetTlsDefaultCtx();
_deviceId = ctx == nullptr ? -1 : ctx->getDevice()->_deviceId;
};
// Attach to an existing completion future:
@@ -44,6 +117,43 @@ void ihipEvent_t::attachToCompletionFuture(const hc::completion_future* cf, hipS
}
static void createIpcEventShmemIfNeeded(ihipEventData_t &ecd) {
if (!ecd._ipc_name.empty()) return;
// create random shmem name
char name_template[] = "/tmp/eventXXXXXX";
int temp_fd = mkstemp(name_template);
throwing_errno_check(-1 == temp_fd, __FILE__, __func__, __LINE__);
// copy shmem name into event data, reformat to use a single slash
ecd._ipc_name = name_template;
ecd._ipc_name.replace(0, 5, "/hip_");
// open shmem
ecd._ipc_fd = shm_open(ecd._ipc_name.c_str(), O_RDWR | O_CREAT, 0777);
throwing_errno_check(ecd._ipc_fd < 0, __FILE__, __func__, __LINE__);
// size it
throwing_retval_check(0, ftruncate(ecd._ipc_fd, sizeof(ihipIpcEventShmem_t)), __FILE__, __func__, __LINE__);
// mmap it
ecd._ipc_shmem = (ihipIpcEventShmem_t*)mmap(0, sizeof(ihipIpcEventShmem_t), PROT_READ | PROT_WRITE, MAP_SHARED, ecd._ipc_fd, 0);
throwing_errno_check(NULL == ecd._ipc_shmem, __FILE__, __func__, __LINE__);
// initialize shared state
ecd._ipc_shmem->owners = 1;
ecd._ipc_shmem->read_index = -1;
ecd._ipc_shmem->write_index = 0;
for (int i=0; i < IPC_SIGNALS_PER_EVENT; i++) {
ecd._ipc_shmem->signal[i] = 0;
}
// remove temp file
throwing_errno_check(-1 == close(temp_fd), __FILE__, __func__, __LINE__);
throwing_errno_check(-1 == unlink(name_template), __FILE__, __func__, __LINE__);
}
static std::pair<hipEventStatus_t, uint64_t> refreshEventStatus(ihipEventData_t &ecd) {
if (ecd._state == hipEventStatusRecording && ecd.marker().is_ready()) {
if ((ecd._type == hipEventTypeIndependent) ||
@@ -70,9 +180,9 @@ static std::pair<hipEventStatus_t, uint64_t> refreshEventStatus(ihipEventData_t
hipError_t ihipEventCreate(hipEvent_t* event, unsigned flags) {
hipError_t e = hipSuccess;
// TODO-IPC - support hipEventInterprocess.
unsigned supportedFlags = hipEventDefault | hipEventBlockingSync | hipEventDisableTiming |
hipEventReleaseToDevice | hipEventReleaseToSystem;
hipEventReleaseToDevice | hipEventReleaseToSystem |
hipEventInterprocess;
const unsigned releaseFlags = (hipEventReleaseToDevice | hipEventReleaseToSystem);
const bool illegalFlags =
@@ -100,29 +210,66 @@ hipError_t hipEventCreate(hipEvent_t* event) {
return ihipLogStatus(ihipEventCreate(event, 0));
}
hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) {
HIP_INIT_SPECIAL_API(hipEventRecord, TRACE_SYNC, event, stream);
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
stream = ihipSyncAndResolveStream(stream);
LockedAccessor_EventCrit_t eCrit(event->criticalData());
if (eCrit->_eventData._state == hipEventStatusUnitialized) return ihipLogStatus(hipErrorInvalidHandle);
auto &ecd{eCrit->_eventData};
if (ecd._state == hipEventStatusUnitialized) return ihipLogStatus(hipErrorInvalidHandle);
if (HIP_SYNC_NULL_STREAM && stream->isDefaultStream()) {
// TODO-HIP_SYNC_NULL_STREAM : can remove this code when HIP_SYNC_NULL_STREAM = 0
// If default stream , then wait on all queues.
ihipCtx_t* ctx = ihipGetTlsDefaultCtx();
ctx->locked_syncDefaultStream(true, true);
eCrit->_eventData.marker(hc::completion_future()); // reset event
eCrit->_eventData._stream = stream;
eCrit->_eventData._timestamp = hc::get_system_ticks();
eCrit->_eventData._state = hipEventStatusComplete;
ecd.marker(hc::completion_future()); // reset event
ecd._stream = stream;
ecd._timestamp = hc::get_system_ticks();
ecd._state = hipEventStatusComplete;
// TODO handle IPC case?
}
else {
// Record the event in the stream:
eCrit->_eventData.marker(stream->locked_recordEvent(event));
eCrit->_eventData._stream = stream;
eCrit->_eventData._timestamp = 0;
eCrit->_eventData._state = hipEventStatusRecording;
ecd.marker(stream->locked_recordEvent(event));
ecd._stream = stream;
ecd._timestamp = 0;
ecd._state = hipEventStatusRecording;
if (event->_flags & hipEventInterprocess) {
createIpcEventShmemIfNeeded(ecd);
int write_index = ecd._ipc_shmem->write_index++; // fetch add
int offset = write_index % IPC_SIGNALS_PER_EVENT;
// While event still valid and still locked, spin.
while (ecd._ipc_shmem->signal[offset] != 0) {
// TODO backoff
}
// Lock signal.
ecd._ipc_shmem->signal[offset] = 1;
// forward signal state from local signal to IPC signal via host callback
// create callback that can be passed to hsa_amd_signal_async_handler
// this function decrements the IPC signal by 1 to indicate completion
std::atomic<int> *signal = &ecd._ipc_shmem->signal[offset];
auto t{new std::function<void()>{[=]() {
signal->store(0);
}}};
// register above callback with HSA runtime to be called when local signal
// is decremented from 1 to 0 by CP
auto local_signal = *reinterpret_cast<hsa_signal_t*>(eCrit->_eventData.marker().get_native_handle());
hsa_amd_signal_async_handler(local_signal, HSA_SIGNAL_CONDITION_LT, 1,
[](hsa_signal_value_t x, void* p) {
(*static_cast<decltype(t)>(p))();
delete static_cast<decltype(t)>(p);
return false;
}, t);
// Update read index to indicate new signal.
int expected = write_index-1;
while (!ecd._ipc_shmem->read_index.compare_exchange_weak(expected, write_index)) {
throwing_msg_check(
expected >= write_index,
"IPC event record update read index failure",
__FILE__, __func__, __LINE__);
expected = write_index-1;
}
}
}
return ihipLogStatus(hipSuccess);
}
@@ -132,8 +279,18 @@ hipError_t hipEventDestroy(hipEvent_t event) {
HIP_INIT_API(hipEventDestroy, event);
if (event) {
{
LockedAccessor_EventCrit_t crit(event->criticalData());
auto &ecd{crit->_eventData};
if (ecd._ipc_shmem) {
int owners = --ecd._ipc_shmem->owners;
throwing_errno_check(-1 == munmap(ecd._ipc_shmem, sizeof(ihipIpcEventShmem_t)), __FILE__, __func__, __LINE__);
throwing_errno_check(-1 == close(ecd._ipc_fd), __FILE__, __func__, __LINE__);
if (0 == owners)
throwing_errno_check(-1 == shm_unlink(ecd._ipc_name.c_str()), __FILE__, __func__, __LINE__);
}
}
delete event;
return ihipLogStatus(hipSuccess);
} else {
return ihipLogStatus(hipErrorInvalidHandle);
@@ -143,31 +300,44 @@ hipError_t hipEventDestroy(hipEvent_t event) {
hipError_t hipEventSynchronize(hipEvent_t event) {
HIP_INIT_SPECIAL_API(hipEventSynchronize, TRACE_SYNC, event);
if (event){
if (!(event->_flags & hipEventReleaseToSystem)) {
tprintf(DB_WARN,
"hipEventSynchronize on event without system-scope fence ; consider creating with "
"hipEventReleaseToSystem\n");
}
auto ecd = event->locked_copyCrit();
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
if (ecd._state == hipEventStatusUnitialized) {
return ihipLogStatus(hipErrorInvalidHandle);
} else if (ecd._state == hipEventStatusCreated) {
// Created but not actually recorded on any device:
return ihipLogStatus(hipSuccess);
} else if (HIP_SYNC_NULL_STREAM && (ecd._stream->isDefaultStream())) {
auto* ctx = ihipGetTlsDefaultCtx();
// TODO-HIP_SYNC_NULL_STREAM - can remove this code
ctx->locked_syncDefaultStream(true, true);
return ihipLogStatus(hipSuccess);
} else {
ecd.marker().wait((event->_flags & hipEventBlockingSync) ? hc::hcWaitModeBlocked
: hc::hcWaitModeActive);
return ihipLogStatus(hipSuccess);
if (!(event->_flags & hipEventReleaseToSystem)) {
tprintf(DB_WARN,
"hipEventSynchronize on event without system-scope fence ; consider creating with "
"hipEventReleaseToSystem\n");
}
auto ecd = event->locked_copyCrit();
if (event->_flags & hipEventInterprocess) {
// this is an IPC event
int previous_read_index = ecd._ipc_shmem->read_index;
if (previous_read_index >= 0) {
// we have at least one recorded event, so proceed
int offset = previous_read_index % IPC_SIGNALS_PER_EVENT;
// While event still valid and still locked, spin.
while (ecd._ipc_shmem->read_index < previous_read_index+IPC_SIGNALS_PER_EVENT && ecd._ipc_shmem->signal[offset] != 0) {
// TODO backoff
}
}
} else {
return ihipLogStatus(hipSuccess);
}
if (ecd._state == hipEventStatusUnitialized) {
return ihipLogStatus(hipErrorInvalidHandle);
} else if (ecd._state == hipEventStatusCreated) {
// Created but not actually recorded on any device:
return ihipLogStatus(hipSuccess);
} else if (HIP_SYNC_NULL_STREAM && (ecd._stream->isDefaultStream())) {
auto* ctx = ihipGetTlsDefaultCtx();
// TODO-HIP_SYNC_NULL_STREAM - can remove this code
ctx->locked_syncDefaultStream(true, true);
return ihipLogStatus(hipSuccess);
} else {
ecd.marker().wait((event->_flags & hipEventBlockingSync) ? hc::hcWaitModeBlocked
: hc::hcWaitModeActive);
return ihipLogStatus(hipSuccess);
}
}
@@ -175,7 +345,9 @@ hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop) {
HIP_INIT_API(hipEventElapsedTime, ms, start, stop);
if (ms == nullptr) return ihipLogStatus(hipErrorInvalidValue);
if ((start == nullptr) || (stop == nullptr)) return ihipLogStatus(hipErrorInvalidHandle);
if ((start == nullptr) || (stop == nullptr) ||
(start->_deviceId != stop->_deviceId))
return ihipLogStatus(hipErrorInvalidHandle);
*ms = 0.0f;
auto startEcd = start->locked_copyCrit();
@@ -232,9 +404,80 @@ hipError_t hipEventQuery(hipEvent_t event) {
auto ecd = event->locked_copyCrit();
if (ecd._state == hipEventStatusRecording && !ecd.marker().is_ready()) {
return ihipLogStatus(hipErrorNotReady);
// this event is either from an ipc handle, or the owner of a local ipc event
if (event->_flags & hipEventInterprocess) {
if (ecd._ipc_shmem) {
int previous_read_index = ecd._ipc_shmem->read_index;
int offset = previous_read_index % IPC_SIGNALS_PER_EVENT;
if (ecd._ipc_shmem->read_index < previous_read_index+IPC_SIGNALS_PER_EVENT && ecd._ipc_shmem->signal[offset] != 0) {
return ihipLogStatus(hipErrorNotReady);
}
else {
return ihipLogStatus(hipSuccess);
}
}
}
// normal event
else {
if (ecd._state == hipEventStatusRecording && !ecd.marker().is_ready()) {
return ihipLogStatus(hipErrorNotReady);
}
}
return ihipLogStatus(hipSuccess);
}
hipError_t hipIpcGetEventHandle(hipIpcEventHandle_t* handle, hipEvent_t event)
{
HIP_INIT_API(hipIpcGetEventHandle, handle, event);
#if USE_IPC && ATOMIC_INT_LOCK_FREE == 2
if (!handle) return ihipLogStatus(hipErrorInvalidHandle);
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
if (!(event->_flags & hipEventInterprocess)) return ihipLogStatus(hipErrorInvalidHandle);
if (!(event->_flags & hipEventDisableTiming)) return ihipLogStatus(hipErrorInvalidHandle);
LockedAccessor_EventCrit_t crit(event->criticalData());
auto &ecd{crit->_eventData};
createIpcEventShmemIfNeeded(ecd);
// copy name into handle
ihipIpcEventHandle_t* iHandle = (ihipIpcEventHandle_t*)handle;
memset(iHandle->shmem_name, 0, HIP_IPC_HANDLE_SIZE);
ecd._ipc_name.copy(iHandle->shmem_name, std::string::npos);
return ihipLogStatus(hipSuccess);
#else
return ihipLogStatus(hipErrorNotSupported);
#endif
}
hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle)
{
HIP_INIT_API(hipIpcOpenEventHandle, event, &handle);
#if USE_IPC && ATOMIC_INT_LOCK_FREE == 2
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
// create a new event with timing disabled, per spec
auto hip_status = ihipEventCreate(event, hipEventDisableTiming | hipEventInterprocess);
if (hip_status != hipSuccess) return ihipLogStatus(hip_status);
LockedAccessor_EventCrit_t crit((*event)->criticalData());
auto &ecd{crit->_eventData};
ihipIpcEventHandle_t* iHandle = (ihipIpcEventHandle_t*)&handle;
ecd._ipc_name = iHandle->shmem_name;
// open shmem
ecd._ipc_fd = shm_open(ecd._ipc_name.c_str(), O_RDWR, 0777);
throwing_errno_check(ecd._ipc_fd < 0, __FILE__, __func__, __LINE__);
// mmap it
ecd._ipc_shmem = (ihipIpcEventShmem_t*)mmap(0, sizeof(ihipIpcEventShmem_t), PROT_READ | PROT_WRITE, MAP_SHARED, ecd._ipc_fd, 0);
throwing_errno_check(NULL == ecd._ipc_shmem, __FILE__, __func__, __LINE__);
// update shared state
ecd._ipc_shmem->owners += 1;
return ihipLogStatus(hipSuccess);
#else
return ihipLogStatus(hipErrorNotSupported);
#endif
}
+51 -2
View File
@@ -263,7 +263,13 @@ ihipStream_t::ihipStream_t(ihipCtx_t* ctx, hc::accelerator_view av, unsigned int
//---
ihipStream_t::~ihipStream_t() {}
ihipStream_t::~ihipStream_t() {
GET_TLS();
for (auto mem : coopMemsTracker) {
hip_internal::ihipHostFree(tls, mem->mgs);
hip_internal::ihipHostFree(tls, mem);
}
}
hc::hcWaitMode ihipStream_t::waitMode() const {
@@ -326,12 +332,55 @@ void ihipStream_t::locked_wait() {
locked_wait(waited);
};
typedef struct {
int previous_read_index;
ihipIpcEventShmem_t *shmem;
hsa_signal_t signal;
} callback_data_t;
static void WaitThenDecrementSignal(callback_data_t *data) {
int offset = data->previous_read_index % IPC_SIGNALS_PER_EVENT;
// While event valid and locked, spin.
while (data->shmem->read_index < data->previous_read_index+IPC_SIGNALS_PER_EVENT && data->shmem->signal[offset] != 0) {
}
hsa_signal_store_relaxed(data->signal, 0);
delete data;
}
// Causes current stream to wait for specified event to complete:
// Note this does not provide any kind of host serialization.
void ihipStream_t::locked_streamWaitEvent(ihipEventData_t& ecd) {
LockedAccessor_StreamCrit_t crit(_criticalData);
crit->_av.create_blocking_marker(ecd.marker(), hc::accelerator_scope);
// if event is an IPC event, it doesn't have a marker
// we use a host callback to block stream with a signal wait
if (ecd._ipc_shmem) {
// create first marker
auto cf = crit->_av.create_marker(hc::no_scope);
// get its signal
auto signal = *reinterpret_cast<hsa_signal_t*>(cf.get_native_handle());
// increment its signal value
hsa_signal_add_relaxed(signal, 1);
// create callback that can be passed to hsa_amd_signal_async_handler
// this function will host wait on IPC signal, then sets first packet's signal to 0 to indicate completion
auto t{new callback_data_t{ecd._ipc_shmem->read_index, ecd._ipc_shmem, signal}};
// register above callback with HSA runtime to be called when first packet's signal
// is decremented from 2 to 1 by CP (or it is already at 1)
// the HSA async handler is single threaded, so we can't block, therefore use a detached thread
hsa_amd_signal_async_handler(signal, HSA_SIGNAL_CONDITION_EQ, 1,
[](hsa_signal_value_t x, void* p) {
std::thread(WaitThenDecrementSignal, static_cast<decltype(t)>(p)).detach();
return false;
}, t);
// create additional marker that blocks on the first one
crit->_av.create_blocking_marker(cf, hc::accelerator_scope);
}
else {
crit->_av.create_blocking_marker(ecd.marker(), hc::accelerator_scope);
}
}
+49 -22
View File
@@ -389,18 +389,28 @@ const hipStream_t hipStreamNull = 0x0;
/**
* HIP IPC Handle Size
* HIP IPC Mem Handle Size
*/
#define HIP_IPC_RESERVED_SIZE 24
#define HIP_IPC_MEM_RESERVED_SIZE 24
class ihipIpcMemHandle_t {
public:
#if USE_IPC
hsa_amd_ipc_memory_t ipc_handle; ///< ipc memory handle on ROCr
#endif
size_t psize;
char reserved[HIP_IPC_RESERVED_SIZE];
char reserved[HIP_IPC_MEM_RESERVED_SIZE];
};
/**
* HIP IPC Event Handle Size
*/
#define HIP_IPC_EVENT_RESERVED_SIZE 32
class ihipIpcEventHandle_t {
public:
#if USE_IPC
char shmem_name[HIP_IPC_HANDLE_SIZE];
#endif
};
struct ihipModule_t {
std::string fileName;
@@ -551,6 +561,20 @@ public:
typedef ihipStreamCriticalBase_t<StreamMutex> ihipStreamCritical_t;
typedef LockedAccessor<ihipStreamCritical_t> LockedAccessor_StreamCrit_t;
// do not change these two structs without changing the device library
struct mg_sync {
uint w0;
uint w1;
};
struct mg_info {
struct mg_sync *mgs;
uint grid_id;
uint num_grids;
ulong prev_sum;
ulong all_sum;
};
//---
// Internal stream structure.
class ihipStream_t {
@@ -619,6 +643,8 @@ class ihipStream_t {
// Before calling this function, stream must be resolved from "0" to the actual stream:
bool isDefaultStream() const { return _id == 0; };
std::vector<mg_info*> coopMemsTracker;
public:
//---
// Public member vars - these are set at initialization and never change:
@@ -670,6 +696,14 @@ enum ihipEventType_t {
hipEventTypeStopCommand,
};
#define IPC_SIGNALS_PER_EVENT 32
typedef struct ihipIpcEventShmem_s {
std::atomic<int> owners;
std::atomic<int> read_index;
std::atomic<int> write_index;
std::atomic<int> signal[IPC_SIGNALS_PER_EVENT];
} ihipIpcEventShmem_t;
struct ihipEventData_t {
ihipEventData_t() {
@@ -677,18 +711,24 @@ struct ihipEventData_t {
_stream = NULL;
_timestamp = 0;
_type = hipEventTypeIndependent;
_ipc_name = "";
_ipc_fd = 0;
_ipc_shmem = NULL;
};
void marker(const hc::completion_future& marker) { _marker = marker; };
void marker(const hc::completion_future& marker) { _marker = marker; }
hc::completion_future& marker() { return _marker; }
uint64_t timestamp() const { return _timestamp; };
ihipEventType_t type() const { return _type; };
uint64_t timestamp() const { return _timestamp; }
ihipEventType_t type() const { return _type; }
ihipEventType_t _type;
hipEventStatus_t _state;
hipStream_t _stream; // Stream where the event is recorded. Null stream is resolved to actual
// stream when recorded
uint64_t _timestamp; // store timestamp, may be set on host or by marker.
std::string _ipc_name;
int _ipc_fd;
ihipIpcEventShmem_t *_ipc_shmem;
private:
hc::completion_future _marker;
};
@@ -700,7 +740,7 @@ template <typename MUTEX_TYPE>
class ihipEventCriticalBase_t : LockedBase<MUTEX_TYPE> {
public:
explicit ihipEventCriticalBase_t(const ihipEvent_t* parentEvent) : _parent(parentEvent) {}
~ihipEventCriticalBase_t(){};
~ihipEventCriticalBase_t() {}
// Keep data in structure so it can be easily copied into snapshots
// (used to reduce lock contention and preserve correct lock order)
@@ -732,6 +772,7 @@ class ihipEvent_t {
public:
unsigned _flags;
int _deviceId;
private:
ihipEventCritical_t _criticalData;
@@ -1029,7 +1070,7 @@ namespace hip_internal {
hipError_t memcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
hipStream_t stream);
hipError_t ihipHostMalloc(TlsData *tls, void** ptr, size_t sizeBytes, unsigned int flags);
hipError_t ihipHostMalloc(TlsData *tls, void** ptr, size_t sizeBytes, unsigned int flags, bool noSync = 0);
hipError_t ihipHostFree(TlsData *tls, void* ptr);
@@ -1037,20 +1078,6 @@ hipError_t ihipHostFree(TlsData *tls, void* ptr);
#define MAX_COOPERATIVE_GPUs 255
// do not change these two structs without changing the device library
struct mg_sync {
uint w0;
uint w1;
};
struct mg_info {
struct mg_sync *mgs;
uint grid_id;
uint num_grids;
ulong prev_sum;
ulong all_sum;
};
//---
// TODO - review the context creation strategy here. Really should be:
// - first "non-device" runtime call creates the context for this thread. Allowed to call
+37 -12
View File
@@ -19,6 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <hc_am.hpp>
#include "hsa/hsa.h"
#include "hsa/hsa_ext_amd.h"
@@ -30,8 +31,10 @@ THE SOFTWARE.
#include <functional>
#include <fstream>
#if __HIP_ENABLE_DEVICE_MALLOC__
__device__ char __hip_device_heap[__HIP_SIZE_OF_HEAP];
__device__ uint32_t __hip_device_page_flag[__HIP_NUM_PAGES];
#endif
// Internal HIP APIS:
namespace hip_internal {
@@ -496,14 +499,14 @@ void* allocAndSharePtr(const char* msg, size_t sizeBytes, ihipCtx_t* ctx, bool s
return ptr;
}
hipError_t ihipHostMalloc(TlsData *tls, void** ptr, size_t sizeBytes, unsigned int flags) {
hipError_t ihipHostMalloc(TlsData *tls, void** ptr, size_t sizeBytes, unsigned int flags, bool noSync) {
hipError_t hip_status = hipSuccess;
if (sizeBytes == 0) {
return hipSuccess;
}
if (HIP_SYNC_HOST_ALLOC) {
if (HIP_SYNC_HOST_ALLOC && !noSync) {
hipDeviceSynchronize();
}
@@ -558,7 +561,7 @@ hipError_t ihipHostMalloc(TlsData *tls, void** ptr, size_t sizeBytes, unsigned i
}
}
if (HIP_SYNC_HOST_ALLOC) {
if (HIP_SYNC_HOST_ALLOC && !noSync) {
hipDeviceSynchronize();
}
return hip_status;
@@ -2219,16 +2222,40 @@ hipError_t hipMemset(void* dst, int value, size_t sizeBytes) {
return ihipLogStatus(ihipMemsetSync(dst, value, sizeBytes, nullptr, ihipMemsetDataTypeChar));
}
hipError_t ihipMemsetND(void* dst, size_t pitch, int value, size_t width, size_t height, size_t setHeight,size_t depth,
hipStream_t stream, enum ihipMemsetDataType copyDataType, bool async) {
size_t sizeBytes =0;
hipError_t hipStatus = hipSuccess;
if ((pitch == width) && (height == setHeight)) {
sizeBytes = pitch * setHeight * depth;
if(async)
return ihipMemsetAsync(dst, value, sizeBytes, stream, copyDataType);
else
return ihipMemsetSync(dst, value, sizeBytes, nullptr, copyDataType);
} else {
for(size_t i = 0; i < depth; ++i) {
for(size_t j = 0; j < setHeight; ++j) {
void* dstPtr = ((unsigned char*) dst + i * height * pitch + j * pitch);
if(async)
hipStatus = ihipMemsetAsync(dstPtr, value, width, stream, copyDataType);
else
hipStatus = ihipMemsetSync(dstPtr, value, width, nullptr, copyDataType);
if (hipStatus != hipSuccess)
return hipStatus;
}
}
}
return hipStatus;
}
hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t height) {
HIP_INIT_SPECIAL_API(hipMemset2D, (TRACE_MCMD), dst, pitch, value, width, height);
size_t sizeBytes = pitch * height;
return ihipLogStatus(ihipMemsetSync(dst, value, sizeBytes, nullptr, ihipMemsetDataTypeChar));
return ihipLogStatus(ihipMemsetND(dst, pitch, value, width, height, height, 1, hipStreamNull, ihipMemsetDataTypeChar, false));
}
hipError_t hipMemset2DAsync(void* dst, size_t pitch, int value, size_t width, size_t height, hipStream_t stream ) {
HIP_INIT_SPECIAL_API(hipMemset2DAsync, (TRACE_MCMD), dst, pitch, value, width, height, stream);
size_t sizeBytes = pitch * height;
return ihipLogStatus(ihipMemsetAsync(dst, value, sizeBytes, stream, ihipMemsetDataTypeChar));
return ihipLogStatus(ihipMemsetND(dst, pitch, value, width, height, height, 1, stream, ihipMemsetDataTypeChar, true));
}
hipError_t hipMemsetD8(hipDeviceptr_t dst, unsigned char value, size_t count) {
@@ -2258,14 +2285,12 @@ hipError_t hipMemsetD32(hipDeviceptr_t dst, int value, size_t count) {
hipError_t hipMemset3D(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent) {
HIP_INIT_SPECIAL_API(hipMemset3D, (TRACE_MCMD), &pitchedDevPtr, value, &extent);
size_t sizeBytes = pitchedDevPtr.pitch * extent.height * extent.depth;
return ihipLogStatus(ihipMemsetSync(pitchedDevPtr.ptr, value, sizeBytes, nullptr, ihipMemsetDataTypeChar));
return ihipLogStatus(ihipMemsetND(pitchedDevPtr.ptr, pitchedDevPtr.pitch ,value, extent.width, pitchedDevPtr.ysize, extent.height, extent.depth, hipStreamNull, ihipMemsetDataTypeChar, false));
}
hipError_t hipMemset3DAsync(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent ,hipStream_t stream ) {
HIP_INIT_SPECIAL_API(hipMemset3DAsync, (TRACE_MCMD), &pitchedDevPtr, value, &extent);
size_t sizeBytes = pitchedDevPtr.pitch * extent.height * extent.depth;
return ihipLogStatus(ihipMemsetAsync(pitchedDevPtr.ptr, value, sizeBytes, stream, ihipMemsetDataTypeChar));
return ihipLogStatus(ihipMemsetND(pitchedDevPtr.ptr,pitchedDevPtr.pitch, value, extent.width, pitchedDevPtr.ysize, extent.height, extent.depth, stream, ihipMemsetDataTypeChar, true));
}
hipError_t hipMemGetInfo(size_t* free, size_t* total) {
@@ -2491,7 +2516,7 @@ hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned
crit->peerAgents(), devPtr) != HSA_STATUS_SUCCESS)
return ihipLogStatus(hipErrorRuntimeOther);
hc::AmPointerInfo ampi(NULL, *devPtr, *devPtr, sizeof(*devPtr), acc, true, true);
hc::AmPointerInfo ampi(NULL, *devPtr, *devPtr, iHandle->psize, acc, true, true);
am_status_t am_status = hc::am_memtracker_add(*devPtr,ampi);
if (am_status != AM_SUCCESS)
return ihipLogStatus(hipErrorMapFailed);
+88 -69
View File
@@ -431,7 +431,7 @@ void getGprsLdsUsage(hipFunction_t f, size_t* usedVGPRS, size_t* usedSGPRS, size
}
static hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(
TlsData *tls, uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk)
TlsData *tls, int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk)
{
using namespace hip_impl;
@@ -479,13 +479,13 @@ static hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(
: std::min(maxWavesPerSimd, availableSGPRs / usedSGPRS));
// Calculate blocks occupancy per CU based on SGPR usage
*numBlocks = std::min(*numBlocks, (uint32_t) (sgprs_alu_occupancy / numWavefronts));
*numBlocks = std::min(*numBlocks, (int) (sgprs_alu_occupancy / numWavefronts));
size_t total_used_lds = usedLDS + dynSharedMemPerBlk;
if (total_used_lds != 0) {
// Calculate LDS occupacy per CU. lds_per_cu / (static_lsd + dynamic_lds)
size_t lds_occupancy = prop.maxSharedMemoryPerMultiProcessor / total_used_lds;
*numBlocks = std::min(*numBlocks, (uint32_t) lds_occupancy);
*numBlocks = std::min(*numBlocks, (int) lds_occupancy);
}
return hipSuccess;
@@ -503,7 +503,7 @@ hipError_t ihipLaunchCooperativeKernel(const void* f, dim3 gridDim,
dim3 blockDim, void** kernelParams, unsigned int sharedMemBytes,
hipStream_t stream, hip_impl::program_state& ps) {
#if (__hcc_workweek__ >= 20093)
#if (__hcc_workweek__ >= 20115)
hipError_t result;
@@ -521,8 +521,7 @@ hipError_t ihipLaunchCooperativeKernel(const void* f, dim3 gridDim,
size_t globalWorkSizeX = (size_t)gridDim.x * (size_t)blockDim.x;
size_t globalWorkSizeY = (size_t)gridDim.y * (size_t)blockDim.y;
size_t globalWorkSizeZ = (size_t)gridDim.z * (size_t)blockDim.z;
if(globalWorkSizeX > UINT32_MAX || globalWorkSizeY > UINT32_MAX || globalWorkSizeZ > UINT32_MAX)
{
if(globalWorkSizeX > UINT32_MAX || globalWorkSizeY > UINT32_MAX || globalWorkSizeZ > UINT32_MAX) {
return hipErrorInvalidConfiguration;
}
@@ -555,7 +554,7 @@ hipError_t ihipLaunchCooperativeKernel(const void* f, dim3 gridDim,
std::pair<std::size_t, std::size_t>>*>(kargs.getHandle());
GET_TLS();
uint32_t numBlocksPerSm = 0;
int numBlocksPerSm = 0;
result = ihipOccupancyMaxActiveBlocksPerMultiprocessor(tls, &numBlocksPerSm, kd,
blockDim.x * blockDim.y * blockDim.z, sharedMemBytes);
if (result != hipSuccess) {
@@ -651,7 +650,7 @@ hipError_t hipLaunchCooperativeKernel(const void* func, dim3 gridDim,
hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsList,
int numDevices, unsigned int flags, hip_impl::program_state& ps) {
#if (__hcc_workweek__ >= 20093)
#if (__hcc_workweek__ >= 20115)
hipError_t result;
if (numDevices > g_deviceCnt || launchParamsList == nullptr || numDevices > MAX_COOPERATIVE_GPUs) {
@@ -722,7 +721,7 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
kds[i]->_kernarg_layout = *reinterpret_cast<const std::vector<std::pair<std::size_t, std::size_t>>*>(
kargs.getHandle());
uint32_t numBlocksPerSm = 0;
int numBlocksPerSm = 0;
result = ihipOccupancyMaxActiveBlocksPerMultiprocessor(tls, &numBlocksPerSm, kds[i],
lp.blockDim.x * lp.blockDim.y * lp.blockDim.z, lp.sharedMem);
if (result != hipSuccess) {
@@ -747,8 +746,7 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
mg_sync *mg_sync_ptr = 0;
vector<mg_info *> mg_info_ptr;
result = hip_internal::ihipHostMalloc(tls, (void **)&mg_sync_ptr, sizeof(mg_sync), hipHostMallocDefault);
result = hip_internal::ihipHostMalloc(tls, (void **)&mg_sync_ptr, sizeof(mg_sync), hipHostMallocDefault, true);
if (result != hipSuccess) {
return hipErrorInvalidValue;
}
@@ -758,7 +756,7 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
uint all_sum = 0;
for (int i = 0; i < numDevices; ++i) {
mg_info *mg_info_temp = nullptr;
result = hip_internal::ihipHostMalloc(tls, (void **)&mg_info_temp, sizeof(mg_info), hipHostMallocDefault);
result = hip_internal::ihipHostMalloc(tls, (void **)&mg_info_temp, sizeof(mg_info), hipHostMallocDefault, true);
if (result != hipSuccess) {
hip_internal::ihipHostFree(tls, mg_sync_ptr);
for (int j = 0; j < i; ++j) {
@@ -780,11 +778,22 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
hc::completion_future streamCF;
if (!streamCrit->_av.get_is_empty()) {
streamCF = streamCrit->_av.create_marker(hc::accelerator_scope);
coopAVs[i].create_blocking_marker(streamCF, hc::accelerator_scope);
if (flags & hipCooperativeLaunchMultiDeviceNoPreSync) {
coopAVs[i].create_blocking_marker(streamCF, hc::accelerator_scope);
streamCrit->_av.acquire_locked_hsa_queue();
coopAVs[i].acquire_locked_hsa_queue();
} else {
for (int j = 0; j < numDevices; ++j) {
coopAVs[j].create_blocking_marker(streamCF, hc::accelerator_scope);
}
}
}
}
if ((flags & hipCooperativeLaunchMultiDeviceNoPreSync) == 0) {
for (int i = 0; i < numDevices; ++i) {
launchParamsList[i].stream->criticalData()._av.acquire_locked_hsa_queue();
coopAVs[i].acquire_locked_hsa_queue();
}
streamCrit->_av.acquire_locked_hsa_queue();
coopAVs[i].acquire_locked_hsa_queue();
}
// launch the init_gws kernel to initialize the GWS for each device
@@ -830,14 +839,14 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
prev_sum += lp.blockDim.x * lp.blockDim.y * lp.blockDim.z *
lp.gridDim.x * lp.gridDim.y * lp.gridDim.z;
lp.stream->coopMemsTracker.push_back(mg_info_ptr[i]);
impCoopParams[0] = &mg_info_ptr[i];
globalWorkSizeX = (size_t)lp.gridDim.x * (size_t)lp.blockDim.x;
globalWorkSizeY = (size_t)lp.gridDim.y * (size_t)lp.blockDim.y;
globalWorkSizeZ = (size_t)lp.gridDim.z * (size_t)lp.blockDim.z;
if(globalWorkSizeX > UINT32_MAX || globalWorkSizeY > UINT32_MAX || globalWorkSizeZ > UINT32_MAX)
{
if(globalWorkSizeX > UINT32_MAX || globalWorkSizeY > UINT32_MAX || globalWorkSizeZ > UINT32_MAX) {
return hipErrorInvalidConfiguration;
}
@@ -859,6 +868,7 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
hip_internal::ihipHostFree(tls, mg_sync_ptr);
for (int j = 0; j < numDevices; ++j) {
hip_internal::ihipHostFree(tls, mg_info_ptr[j]);
launchParamsList[j].stream->coopMemsTracker.pop_back();
}
return hipErrorLaunchFailure;
@@ -866,24 +876,34 @@ hipError_t ihipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsL
}
// unlock all streams
// unlock streams and create blocking markers on them based on the workload
// on cooperative queues on each device
for (int i = 0; i < numDevices; ++i) {
coopAVs[i].release_locked_hsa_queue();
launchParamsList[i].stream->criticalData()._av.release_locked_hsa_queue();
}
for (int i = 0; i < numDevices; ++i) {
hc::completion_future cooperativeCF;
if (!coopAVs[i].get_is_empty()) {
cooperativeCF = coopAVs[i].create_marker(hc::accelerator_scope);
launchParamsList[i].stream->criticalData()._av.create_blocking_marker(
cooperativeCF, hc::accelerator_scope);
if (flags & hipCooperativeLaunchMultiDeviceNoPostSync) {
launchParamsList[i].stream->criticalData()._av.create_blocking_marker(
cooperativeCF, hc::accelerator_scope);
launchParamsList[i].stream->criticalData().unlock();
} else {
for (int j = 0; j < numDevices; ++j) {
launchParamsList[j].stream->criticalData()._av.create_blocking_marker(
cooperativeCF, hc::accelerator_scope);
}
}
}
launchParamsList[i].stream->criticalData().unlock();
}
hip_internal::ihipHostFree(tls, mg_sync_ptr);
for (int j = 0; j < numDevices; ++j) {
hip_internal::ihipHostFree(tls, mg_info_ptr[j]);
if ((flags & hipCooperativeLaunchMultiDeviceNoPostSync) == 0) {
for (int i = 0; i < numDevices; ++i) {
launchParamsList[i].stream->criticalData().unlock();
}
}
return result;
@@ -1158,26 +1178,11 @@ inline hsa_status_t remove_agent_global_variables(hsa_executable_t, hsa_agent_t
hsa_executable_symbol_t find_kernel_by_name(hsa_executable_t executable, const char* kname,
hsa_agent_t* agent = nullptr) {
using namespace hip_impl;
pair<const char*, hsa_executable_symbol_t> r{kname, {}};
hsa_executable_iterate_agent_symbols(
executable, agent ? *agent : this_agent(),
[](hsa_executable_t, hsa_agent_t, hsa_executable_symbol_t x, void* s) {
auto p = static_cast<pair<const char*, hsa_executable_symbol_t>*>(s);
if (type(x) != HSA_SYMBOL_KIND_KERNEL) {
return HSA_STATUS_SUCCESS;
}
if (name(x) != p->first) return HSA_STATUS_SUCCESS;
p->second = x;
return HSA_STATUS_INFO_BREAK;
},
&r);
return r.second;
hsa_executable_symbol_t symbol = { 0 };
hsa_agent_t thisagent = agent ? *agent : this_agent();
hsa_status_t err = hsa_executable_get_symbol_by_name(executable, kname, &thisagent ,&symbol);
//TODO check err ?
return symbol;
}
@@ -1194,8 +1199,7 @@ string read_elf_file_as_string(const void* file) {
auto h = static_cast<const ELFIO::Elf64_Ehdr*>(file);
auto s = static_cast<const char*>(file);
// This assumes the common case of SHT being the last part of the ELF.
auto sz =
sizeof(ELFIO::Elf64_Ehdr) + h->e_shoff + h->e_shentsize * h->e_shnum;
auto sz = h->e_shoff + h->e_shentsize * h->e_shnum;
return string{s, s + sz};
}
@@ -1527,9 +1531,9 @@ hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const
return ihipLogStatus(hipSuccess);
}
hipError_t ihipOccupancyMaxPotentialBlockSize(TlsData *tls, uint32_t* gridSize, uint32_t* blockSize,
hipError_t ihipOccupancyMaxPotentialBlockSize(TlsData *tls, int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
uint32_t blockSizeLimit)
int blockSizeLimit)
{
using namespace hip_impl;
@@ -1639,51 +1643,66 @@ hipError_t ihipOccupancyMaxPotentialBlockSize(TlsData *tls, uint32_t* gridSize,
return hipSuccess;
}
hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* blockSize,
hipError_t hipModuleOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
uint32_t blockSizeLimit)
int blockSizeLimit)
{
HIP_INIT_API(hipOccupancyMaxPotentialBlockSize, gridSize, blockSize, f, dynSharedMemPerBlk, blockSizeLimit);
HIP_INIT_API(hipModuleOccupancyMaxPotentialBlockSize, gridSize, blockSize, f, dynSharedMemPerBlk, blockSizeLimit);
return ihipLogStatus(ihipOccupancyMaxPotentialBlockSize(tls,
gridSize, blockSize, f, dynSharedMemPerBlk, blockSizeLimit));
}
hipError_t hipModuleOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* blockSize,
hipFunction_t f, size_t dynSharedMemPerBlk,
int blockSizeLimit, unsigned int flags)
{
HIP_INIT_API(hipModuleOccupancyMaxPotentialBlockSizeWithFlags, gridSize, blockSize, f, dynSharedMemPerBlk,
blockSizeLimit, flags);
if(flags != hipOccupancyDefault) return ihipLogStatus(hipErrorNotSupported);
return ihipLogStatus(ihipOccupancyMaxPotentialBlockSize(tls,
gridSize, blockSize, f, dynSharedMemPerBlk, blockSizeLimit));
}
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk)
int* numBlocks, const void* f, int blockSize, size_t dynSharedMemPerBlk)
{
HIP_INIT_API(hipOccupancyMaxActiveBlocksPerMultiprocessor, numBlocks, f, blockSize, dynSharedMemPerBlk);
auto F = hip_impl::get_program_state().kernel_descriptor((std::uintptr_t)(f),
hip_impl::target_agent(0));
return ihipLogStatus(ihipOccupancyMaxActiveBlocksPerMultiprocessor(
tls, numBlocks, F, blockSize, dynSharedMemPerBlk));
}
hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessor(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk)
{
HIP_INIT_API(hipModuleOccupancyMaxActiveBlocksPerMultiprocessor, numBlocks, f, blockSize, dynSharedMemPerBlk);
return ihipLogStatus(ihipOccupancyMaxActiveBlocksPerMultiprocessor(
tls, numBlocks, f, blockSize, dynSharedMemPerBlk));
}
hipError_t hipDrvOccupancyMaxActiveBlocksPerMultiprocessor(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk)
{
HIP_INIT_API(hipDrvOccupancyMaxActiveBlocksPerMultiprocessor, numBlocks, f, blockSize, dynSharedMemPerBlk);
return ihipLogStatus(ihipOccupancyMaxActiveBlocksPerMultiprocessor(
tls, (uint32_t*) numBlocks, f, blockSize, dynSharedMemPerBlk));
}
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk,
int* numBlocks, const void* f, int blockSize, size_t dynSharedMemPerBlk,
unsigned int flags)
{
HIP_INIT_API(hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, numBlocks, f, blockSize, dynSharedMemPerBlk, flags);
if(flags != hipOccupancyDefault) return ihipLogStatus(hipErrorNotSupported);
auto F = hip_impl::get_program_state().kernel_descriptor((std::uintptr_t)(f),
hip_impl::target_agent(0));
return ihipLogStatus(ihipOccupancyMaxActiveBlocksPerMultiprocessor(
tls, numBlocks, f, blockSize, dynSharedMemPerBlk));
tls, numBlocks, F, blockSize, dynSharedMemPerBlk));
}
hipError_t hipDrvOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
int* numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk,
unsigned int flags)
{
HIP_INIT_API(hipDrvOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, numBlocks, f, blockSize, dynSharedMemPerBlk, flags);
HIP_INIT_API(hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags, numBlocks, f, blockSize, dynSharedMemPerBlk, flags);
if(flags != hipOccupancyDefault) return ihipLogStatus(hipErrorNotSupported);
return ihipLogStatus(ihipOccupancyMaxActiveBlocksPerMultiprocessor(
tls, (uint32_t*) numBlocks, f, blockSize, dynSharedMemPerBlk));
tls, numBlocks, f, blockSize, dynSharedMemPerBlk));
}
hipError_t hipLaunchKernel(
+16 -15
View File
@@ -63,11 +63,11 @@ hipError_t ihipStreamCreate(TlsData *tls, hipStream_t* stream, unsigned int flag
// TODO - se try-catch loop to detect memory exception?
//
// Note this is an execute_any_order queue,
// Note this is an execute_any_order queue,
// CUDA stream behavior is that all kernels submitted will automatically
// wait for prev to complete, this behaviour will be mainatined by
// hipModuleLaunchKernel. execute_any_order will help
// hipExtModuleLaunchKernel , which uses a special flag
// wait for prev to complete, this behaviour will be mainatined by
// hipModuleLaunchKernel. execute_any_order will help
// hipExtModuleLaunchKernel , which uses a special flag
{
// Obtain mutex access to the device critical data, release by destructor
@@ -130,18 +130,19 @@ hipError_t hipDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPrio
hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags) {
HIP_INIT_SPECIAL_API(hipStreamWaitEvent, TRACE_SYNC, stream, event, flags);
hipError_t e = hipSuccess;
if (!event) return ihipLogStatus(hipErrorInvalidHandle);
if (event == nullptr) {
e = hipErrorInvalidHandle;
} else {
auto ecd = event->locked_copyCrit();
auto ecd = event->locked_copyCrit();
if (event->_flags & hipEventInterprocess) {
// this is an IPC event
if (ecd._ipc_shmem->read_index >= 0) {
// we have at least one recorded event, so proceed
stream->locked_streamWaitEvent(ecd);
}
}
else {
if ((ecd._state != hipEventStatusUnitialized) && (ecd._state != hipEventStatusCreated)) {
if (HIP_SYNC_STREAM_WAIT || (HIP_SYNC_NULL_STREAM && (stream == 0))) {
// conservative wait on host for the specified event to complete:
// return _stream->locked_eventWaitComplete(this, waitMode);
//
ecd.marker().wait((event->_flags & hipEventBlockingSync) ? hc::hcWaitModeBlocked
: hc::hcWaitModeActive);
} else {
@@ -150,9 +151,9 @@ hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int
stream->locked_streamWaitEvent(ecd);
}
}
} // else event not recorded, return immediately and don't create marker.
}
return ihipLogStatus(e);
return ihipLogStatus(hipSuccess);
};
+8 -1
View File
@@ -68,7 +68,14 @@ namespace hip_impl {
const size_t data_size,
hsa_executable_t executable,
hsa_agent_t agent) {
return impl->load_executable(data, data_size, executable, agent);
return impl->load_executable(data, data_size, true, executable, agent);
}
hsa_executable_t program_state::load_executable_no_copy(const char* data,
const size_t data_size,
hsa_executable_t executable,
hsa_agent_t agent) {
return impl->load_executable(data, data_size, false, executable, agent);
}
hipFunction_t program_state::kernel_descriptor(std::uintptr_t function_address,
+16 -5
View File
@@ -408,11 +408,13 @@ public:
}
void load_code_object_and_freeze_executable(
const std::string& file, hsa_agent_t agent, hsa_executable_t executable) {
const char* data,
const size_t data_size, bool make_copy,
hsa_agent_t agent, hsa_executable_t executable) {
// TODO: the following sequence is inefficient, should be refactored
// into a single load of the file and subsequent ELFIO
// processing.
if (file.empty()) return;
if (!data_size) return;
static const auto cor_deleter = [] (hsa_code_object_reader_t* p) {
if (!p) return;
@@ -425,8 +427,16 @@ public:
decltype(code_readers.second)::iterator it;
{
std::lock_guard<std::mutex> lck{code_readers.first};
std::string file;
if (make_copy)
file = std::string(data, data_size);
code_readers.second.emplace_back(move(file), move(tmp));
it = std::prev(code_readers.second.end());
if (make_copy)
data = it->first.data();
}
auto check_hsa_error = [](hsa_status_t s) {
@@ -440,7 +450,7 @@ public:
};
check_hsa_error(hsa_code_object_reader_create_from_memory(
it->first.data(), it->first.size(), it->second.get()));
data, data_size, it->second.get()));
check_hsa_error(hsa_executable_load_agent_code_object(
executable, agent, *it->second, nullptr, nullptr));
@@ -487,7 +497,7 @@ public:
// TODO: this is massively inefficient and only meant for
// illustration.
tmp = impl.load_executable(blob.data(), blob.size(), tmp, a);
tmp = impl.load_executable(blob.data(), blob.size(), true, tmp, a);
if (tmp.handle) current_exes.push_back(tmp);
}
@@ -505,6 +515,7 @@ public:
hsa_executable_t load_executable(const char* data,
const size_t data_size,
bool make_copy,
hsa_executable_t executable,
hsa_agent_t agent) {
ELFIO::elfio reader;
@@ -521,7 +532,7 @@ public:
code_object_dynsym,
agent, executable);
load_code_object_and_freeze_executable(move(ts), agent, executable);
load_code_object_and_freeze_executable(data, data_size, make_copy, agent, executable);
return executable;
}
+5
View File
@@ -71,6 +71,11 @@ inline std::string ToString(hipEvent_t v) {
ss << v;
return ss.str();
};
// hipIpcEventHandle_t specialization. TODO
template <>
inline std::string ToString(hipIpcEventHandle_t v) {
return std::string{};
};
// hipStream_t
template <>
inline std::string ToString(hipStream_t v) {
-151
View File
@@ -1,151 +0,0 @@
# -*- Python -*-
import os
import platform
import re
import subprocess
import struct
import lit.formats
import lit.util
# Configuration file for the 'lit' test runner.
site_cfg = lit_config.params.get('site_config', None)
lit_config.load_config(config, site_cfg)
config.excludes = ['cmdparser.hpp']
config.excludes.append('spatial_batch_norm_op.h')
config.excludes.append('common_cudnn.h')
delimiter = "===============================================================";
print(delimiter)
print("CUDA " + config.cuda_version + " - will be used for testing")
print("LLVM " + config.llvm_version + " - will be used for testing")
print(platform.machine() + " - Platform architecture")
print(platform.system() + " " + platform.release() + " - Platform OS")
print(str(config.pointer_size * 8) + " - hipify-clang binary bitness")
print(str(struct.calcsize("P") * 8) + " - python " + str(platform.python_version()) + " binary bitness")
print(delimiter)
warns = None
if not config.cuda_dnn_root:
config.excludes.append('cudnn_convolution_forward.cu')
config.excludes.append('cudnn_softmax.cu')
print("WARN: cuDNN tests are excluded due to unset CUDA_DNN_ROOT_DIR")
warns = True
if not config.cuda_cub_root:
config.excludes.append('cub_01.cu')
config.excludes.append('cub_02.cu')
config.excludes.append('cub_03.cu')
print("WARN: CUB tests are excluded due to unset CUDA_CUB_ROOT_DIR")
warns = True
if warns:
print(delimiter)
if config.cuda_version_major == 7 and config.cuda_version_minor == 0:
config.excludes.append('headers_test_09.cu')
config.excludes.append('cudnn_convolution_forward.cu')
if config.cuda_version_major < 8:
config.excludes.append('cuSPARSE_02.cu')
if config.cuda_version_major < 9:
config.excludes.append('cuSPARSE_04.cu')
config.excludes.append('cuSPARSE_05.cu')
config.excludes.append('cuSPARSE_06.cu')
config.excludes.append('cuSPARSE_07.cu')
config.excludes.append('benchmark_curand_kernel.cpp')
if config.cuda_version_major < 10:
config.excludes.append('cuSPARSE_08.cu')
config.excludes.append('cuSPARSE_09.cu')
config.excludes.append('cuSPARSE_10.cu')
config.excludes.append('cuSPARSE_11.cu')
if config.llvm_version_major < 10:
config.excludes.append('pp_if_else_conditionals_LLVM_10.cu')
config.excludes.append('pp_if_else_conditionals_01_LLVM_10.cu')
# name: The name of this test suite.
config.name = 'hipify'
# suffixes: CUDA source is only supported
config.suffixes = ['.cu','.cuh','.cpp','.c','.hpp','.h']
# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.ShTest()
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
# test_exec_root: The path where tests are located (default is the test suite root).
#config.test_exec_root = config.test_source_root
# target_triple: Used by ShTest and TclTest formats for XFAIL checks.
config.target_triple = '(unused)'
# available_features: Used by ShTest and TclTest formats for REQUIRES checks.
config.available_features = []
obj_root = getattr(config, 'obj_root', None)
if obj_root is not None:
config.test_exec_root = obj_root
if obj_root is not None:
llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
if not llvm_tools_dir:
lit_config.fatal('No LLVM tools dir set!')
path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
hipify_path = obj_root
clang_arguments = "-v"
if sys.platform in ['win32']:
run_test_ext = ".bat"
hipify_path += "/" + config.build_type
# CUDA SDK ROOT
clang_arguments += " -isystem'%s'/common/inc"
else:
run_test_ext = ".sh"
# CUDA SDK ROOT
clang_arguments += " -isystem'%s'/samples/common/inc"
if config.pointer_size == 8:
clang_arguments += " -D__LP64__"
# Set max clang's CudaArch for corresponding CUDA version
# to support maximum CUDA features in offline tests
if config.cuda_version_major == 7:
if config.cuda_version_minor == 5:
clang_arguments += " --cuda-gpu-arch=sm_53"
else:
clang_arguments += " --cuda-gpu-arch=sm_52"
elif config.cuda_version_major == 8:
clang_arguments += " --cuda-gpu-arch=sm_62"
elif config.cuda_version_major == 9:
if config.cuda_version_minor == 2:
clang_arguments += " --cuda-gpu-arch=sm_72"
else:
clang_arguments += " --cuda-gpu-arch=sm_70"
elif config.cuda_version_major == 10:
clang_arguments += " --cuda-gpu-arch=sm_75"
# cuDNN ROOT
if config.cuda_dnn_root:
clang_arguments += " -I'%s'/include"
# CUB ROOT
if config.cuda_cub_root:
clang_arguments += " -I'%s'"
if config.cuda_dnn_root and config.cuda_cub_root:
config.substitutions.append(("%clang_args", clang_arguments % (config.cuda_sdk_root, config.cuda_dnn_root, config.cuda_cub_root)))
elif config.cuda_dnn_root:
config.substitutions.append(("%clang_args", clang_arguments % (config.cuda_sdk_root, config.cuda_dnn_root)))
elif config.cuda_cub_root:
config.substitutions.append(("%clang_args", clang_arguments % (config.cuda_sdk_root, config.cuda_cub_root)))
else:
config.substitutions.append(("%clang_args", clang_arguments % config.cuda_sdk_root))
if config.llvm_version_major < 4:
hipify_arguments = "-I'%s'/include"
else:
hipify_arguments = "--cuda-path='%s'"
config.substitutions.append(("%hipify_args", hipify_arguments % config.cuda_root))
config.substitutions.append(("hipify", '"' + hipify_path + "/hipify-clang" + '"'))
config.substitutions.append(("%run_test", '"' + config.test_source_root + "/run_test" + run_test_ext + '"'))
@@ -1,38 +0,0 @@
import sys
import os
config.pointer_size = @CMAKE_SIZEOF_VOID_P@
config.llvm_version = "@LLVM_PACKAGE_VERSION@"
config.llvm_version_major = int("@LLVM_VERSION_MAJOR@")
config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@"
config.obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
config.cuda_root = "@CUDA_TOOLKIT_ROOT_DIR@"
config.cuda_dnn_root = "@CUDA_DNN_ROOT_DIR@"
config.cuda_cub_root = "@CUDA_CUB_ROOT_DIR@"
config.cuda_version_major = int("@CUDA_VERSION_MAJOR@")
config.cuda_version_minor = int("@CUDA_VERSION_MINOR@")
config.cuda_version = "@CUDA_VERSION@"
if sys.platform in ['win32']:
config.cuda_sdk_root = "@CUDA_SDK_ROOT_DIR@"
if not config.cuda_sdk_root or config.cuda_sdk_root == "CUDA_SDK_ROOT_DIR-NOTFOUND":
cuda_version = config.cuda_version
cuda_version = cuda_version.replace('.','_')
config.cuda_samples_root = os.environ.get('NVCUDASAMPLES' + cuda_version + '_ROOT')
if not config.cuda_samples_root:
lit_config.fatal('No CUDA Samples dir set! Please set CUDA_SDK_ROOT_DIR.')
config.cuda_sdk_root = config.cuda_samples_root
config.build_type = "@CMAKE_BUILD_TYPE@"
if not config.build_type:
config.build_type = "Debug"
else:
config.cuda_sdk_root = config.cuda_root
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
try:
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
config.obj_root = config.obj_root % lit_config.params
except KeyError:
e = sys.exc_info()[1]
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
@@ -1,21 +0,0 @@
@echo off
setlocal
for %%i in (FileCheck.exe) do set FILE_CHECK=%%~$PATH:i
if not defined FILE_CHECK (echo Error: FileCheck.exe not found in PATH. && exit /b 1)
set HIPIFY=%1
set IN_FILE=%2
set TMP_FILE=%3
set CUDA_ROOT=%4
set ROC=%5
set all_args=%*
call set clang_args=%%all_args:*%6=%%
set clang_args=%6%clang_args%
%HIPIFY% -o=%TMP_FILE% %IN_FILE% %CUDA_ROOT% %ROC% -- %clang_args%
if errorlevel 1 (echo Error: hipify-clang.exe failed with exit code: %errorlevel% && exit /b %errorlevel%)
findstr /v /r /c:"[ ]*//[ ]*[CHECK*|RUN]" %TMP_FILE% | %FILE_CHECK% %IN_FILE%
if errorlevel 1 (echo Error: FileCheck.exe failed with exit code: %errorlevel% && exit /b %errorlevel%)
@@ -1,18 +0,0 @@
#!/usr/bin/env bash
set -o errexit
# Run a single LIT test file in a magical way that preserves colour output, to work around
# a known flaw in lit.
# Capture lit substitutions
HIPIFY=$1
IN_FILE=$2
TMP_FILE=$3
CUDA_ROOT=$4
ROC=$5
shift 5
# Remaining args are the ones to forward to clang proper.
$HIPIFY -o=$TMP_FILE $IN_FILE $CUDA_ROOT $ROC -- $@ && cat $TMP_FILE | sed -Ee 's|//.+|// |g' | FileCheck $IN_FILE
@@ -1,52 +0,0 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args
/*
Copyright (c) 2015-present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// CHECK: #include <hip/hip_runtime.h>
#include <cuda_runtime.h>
__global__
void fn(float* px, float* py) {
bool a[42];
__shared__ double b[69];
for (auto&& x : b) x = *py++;
for (auto&& x : a) x = *px++ > 0.0;
for (auto&& x : a) if (x) *--py = *--px;
}
int main() {
// CHECK: hipFuncCache_t cacheConfig;
cudaFuncCache cacheConfig;
void* func;
// CHECK: hipFuncSetCacheConfig(reinterpret_cast<const void*>(func), cacheConfig);
cudaFuncSetCacheConfig(func, cacheConfig);
// CHECK: hipFuncAttributes attr{};
cudaFuncAttributes attr{};
// CHECK: auto r = hipFuncGetAttributes(&attr, reinterpret_cast<const void*>(&fn));
auto r = cudaFuncGetAttributes(&attr, &fn);
// CHECK: if (r != hipSuccess || attr.maxThreadsPerBlock == 0) {
if (r != cudaSuccess || attr.maxThreadsPerBlock == 0) {
return 1;
}
return 0;
}
@@ -1,286 +0,0 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args "-Xclang" "-fcuda-allow-variadic-functions"
/*
Copyright (c) 2015-present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// CHECK: #include "hip/hip_runtime.h"
#include "cuda_runtime.h"
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <type_traits>
#define EXIT_WAIVED 2
const char* sampleName = "hipSimpleAtomicsTest";
using namespace std;
// Auto-Verification Code
bool testResult = true;
bool computeGoldBitwise(...) {
return true;
}
template<typename T, typename enable_if<is_integral<T>{}>::type* = nullptr>
bool computeGoldBitwise(T* gpuData, int len) {
T val = 0xff;
for (int i = 0; i < len; ++i) {
// 9th element should be 1
val &= (2 * i + 7);
}
if (val != gpuData[8]) {
printf("atomicAnd failed\n");
return false;
}
val = 0;
for (int i = 0; i < len; ++i) {
// 10th element should be 0xff
val |= (1 << i);
}
if (val != gpuData[9]) {
printf("atomicOr failed\n");
return false;
}
val = 0xff;
for (int i = 0; i < len; ++i) {
// 11th element should be 0xff
val ^= i;
}
if (val != gpuData[10]) {
printf("atomicXor failed\n");
return false;
}
return true;
}
template<typename T>
bool computeGold(T* gpuData, int len) {
T val = 0;
for (int i = 0; i < len; ++i) {
val += 10;
}
if (val != gpuData[0]) {
printf("atomicAdd failed\n");
return false;
}
val = 0;
for (int i = 0; i < len; ++i) {
val -= 10;
}
if (val != gpuData[1]) {
printf("atomicSub failed\n");
return false;
}
bool found = false;
for (T i = 0; i < len; ++i) {
// third element should be a member of [0, len)
if (i == gpuData[2]) {
found = true;
break;
}
}
if (!found) {
printf("atomicExch failed\n");
return false;
}
val = -(1 << 8);
for (T i = 0; i < len; ++i) {
// fourth element should be len-1
val = max(val, i);
}
if (val != gpuData[3]) {
printf("atomicMax failed\n");
return false;
}
val = 1 << 8;
for (T i = 0; i < len; ++i) {
val = min(val, i);
}
if (val != gpuData[4]) {
printf("atomicMin failed\n");
return false;
}
int limit = 17;
val = 0;
for (int i = 0; i < len; ++i) {
val = (val >= limit) ? 0 : val + 1;
}
if (val != gpuData[5]) {
printf("atomicInc failed\n");
return false;
}
limit = 137;
val = 0;
for (int i = 0; i < len; ++i) {
val = ((val == 0) || (val > limit)) ? limit : val - 1;
}
if (val != gpuData[6]) {
printf("atomicDec failed\n");
return false;
}
found = false;
for (T i = 0; i < len; ++i) {
// eighth element should be a member of [0, len)
if (i == gpuData[7]) {
found = true;
break;
}
}
if (!found) {
printf("atomicCAS failed\n");
return false;
}
return computeGoldBitwise(gpuData, len);
}
__device__
void testKernelExch(...) {}
template<typename T, typename enable_if<!is_same<T, double>{}>::type* = nullptr>
__device__
void testKernelExch(T* g_odata) {
// access thread id
const T tid = blockDim.x * blockIdx.x + threadIdx.x;
// Atomic exchange
atomicExch(&g_odata[2], tid);
}
__device__
void testKernelSub(...) {}
template<
typename T,
typename enable_if<
is_same<T, int>{} || is_same<T, unsigned int>{}>::type* = nullptr>
__device__
void testKernelSub(T* g_odata) {
// Atomic subtraction (final should be 0)
atomicSub(&g_odata[1], 10);
}
__device__
void testKernelIntegral(...) {}
template<typename T, typename enable_if<is_integral<T>{}>::type* = nullptr>
__device__
void testKernelIntegral(T* g_odata) {
// access thread id
const T tid = blockDim.x * blockIdx.x + threadIdx.x;
// Atomic maximum
atomicMax(&g_odata[3], tid);
// Atomic minimum
atomicMin(&g_odata[4], tid);
// Atomic increment (modulo 17+1)
atomicInc((unsigned int*)&g_odata[5], 17);
// Atomic decrement
atomicDec((unsigned int*)&g_odata[6], 137);
// Atomic compare-and-swap
atomicCAS(&g_odata[7], tid - 1, tid);
// Atomic AND
atomicAnd(&g_odata[8], 2 * tid + 7);
// Atomic OR
atomicOr(&g_odata[9], 1 << tid);
// Atomic XOR
atomicXor(&g_odata[10], tid);
testKernelSub(g_odata);
}
template<typename T>
__global__ void testKernel(T* g_odata) {
// Atomic addition
atomicAdd(&g_odata[0], 10);
testKernelIntegral(g_odata);
testKernelExch(g_odata);
}
template<typename T>
void runTest() {
// CHECK: hipDeviceProp_t deviceProp;
cudaDeviceProp deviceProp;
deviceProp.major = 0;
deviceProp.minor = 0;
int dev = 0;
// CHECK: hipGetDeviceProperties(&deviceProp, dev);
cudaGetDeviceProperties(&deviceProp, dev);
// Statistics about the GPU device
printf(
"> GPU device has %d Multi-Processors, "
"SM %d.%d compute capabilities\n\n",
deviceProp.multiProcessorCount, deviceProp.major, deviceProp.minor);
unsigned int numThreads = 256;
unsigned int numBlocks = 64;
unsigned int numData = 11;
unsigned int memSize = sizeof(T) * numData;
// Allocate mem for the result on host side
T* hOData = (T*)malloc(memSize);
// Initialize the memory
for (unsigned int i = 0; i < numData; i++) hOData[i] = 0;
// To make the AND and XOR tests generate something other than 0...
hOData[8] = hOData[10] = 0xff;
// Allocate device memory for result
T* dOData;
// CHECK: hipMalloc((void**)&dOData, memSize);
cudaMalloc((void**)&dOData, memSize);
// Copy host memory to device to initialize to zero
// CHECK: hipMemcpy(dOData, hOData, memSize, hipMemcpyHostToDevice);
cudaMemcpy(dOData, hOData, memSize, cudaMemcpyHostToDevice);
// Execute the kernel
// CHECK: hipLaunchKernelGGL(HIP_KERNEL_NAME(testKernel), dim3(numBlocks), dim3(numThreads), 0, 0, dOData);
testKernel<<<numBlocks, numThreads>>>(dOData);
// Copy result from device to host
// CHECK: hipMemcpy(hOData, dOData, memSize, hipMemcpyDeviceToHost);
cudaMemcpy(hOData, dOData, memSize, cudaMemcpyDeviceToHost);
// Compute reference solution
testResult = computeGold(hOData, numThreads * numBlocks);
// Cleanup memory
free(hOData);
// CHECK: hipFree(dOData);
cudaFree(dOData);
}
int main(int argc, char** argv) {
printf("%s starting...\n", sampleName);
runTest<int>();
runTest<unsigned int>();
runTest<unsigned long long>();
runTest<float>();
#if CUDA_VERSION >= 8000 && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 600
runTest<double>();
#endif
// CHECK: hipDeviceReset();
cudaDeviceReset();
printf("%s completed, returned %s\n", sampleName, testResult ? "OK" : "ERROR!");
exit(testResult ? EXIT_SUCCESS : EXIT_FAILURE);
}
@@ -1,152 +0,0 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args
/*
Copyright (c) 2015-present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// CHECK: #include <hip/hip_runtime.h>
#include <cuda_runtime.h>
#include <iostream>
#include <assert.h>
#define NUM 1024
#define SIZE 1024 * 4
__device__ int globalIn[NUM];
__device__ int globalOut[NUM];
__global__ void Assign(int* Out) {
int tid = threadIdx.x + blockIdx.x * blockDim.x;
Out[tid] = globalIn[tid];
globalOut[tid] = globalIn[tid];
}
__device__ __constant__ int globalConst[NUM];
__global__ void checkAddress(int* addr, bool* out) {
*out = (globalConst == addr);
}
int main() {
int *A, *Am, *B, *Ad, *C, *Cm;
A = new int[NUM];
B = new int[NUM];
C = new int[NUM];
for (int i = 0; i < NUM; ++i) {
A[i] = -1 * i;
B[i] = 0;
C[i] = 0;
}
// CHECK: hipMalloc((void**)&Ad, SIZE);
cudaMalloc((void**)&Ad, SIZE);
// CHECK: hipHostMalloc((void**)&Am, SIZE);
cudaMallocHost((void**)&Am, SIZE);
// CHECK: hipHostMalloc((void**)&Cm, SIZE);
cudaMallocHost((void**)&Cm, SIZE);
for (int i = 0; i < NUM; ++i) {
Am[i] = -1 * i;
Cm[i] = 0;
}
// CHECK: hipStream_t stream = NULL;
cudaStream_t stream = NULL;
// CHECK: hipStreamCreate(&stream);
cudaStreamCreate(&stream);
// CHECK: hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), Am, SIZE, 0, hipMemcpyHostToDevice, stream);
cudaMemcpyToSymbolAsync(globalIn, Am, SIZE, 0, cudaMemcpyHostToDevice, stream);
// CHECK: hipStreamSynchronize(stream);
cudaStreamSynchronize(stream);
// CHECK: hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
Assign<<<dim3(1, 1, 1), dim3(NUM, 1, 1)>>>(Ad);
// CHECK: hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost);
cudaMemcpy(B, Ad, SIZE, cudaMemcpyDeviceToHost);
// CHECK: hipMemcpyFromSymbolAsync(Cm, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream);
cudaMemcpyFromSymbolAsync(Cm, globalOut, SIZE, 0, cudaMemcpyDeviceToHost, stream);
// CHECK: hipStreamSynchronize(stream);
cudaStreamSynchronize(stream);
for (int i = 0; i < NUM; ++i) {
assert(Am[i] == B[i]);
assert(Am[i] == Cm[i]);
}
for (int i = 0; i < NUM; ++i) {
A[i] = -2 * i;
B[i] = 0;
}
// CHECK: hipMemcpyToSymbol(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice);
cudaMemcpyToSymbol(globalIn, A, SIZE, 0, cudaMemcpyHostToDevice);
// CHECK: hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
Assign<<<dim3(1, 1, 1), dim3(NUM, 1, 1)>>>(Ad);
// CHECK: hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost);
cudaMemcpy(B, Ad, SIZE, cudaMemcpyDeviceToHost);
// CHECK: hipMemcpyFromSymbol(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost);
cudaMemcpyFromSymbol(C, globalOut, SIZE, 0, cudaMemcpyDeviceToHost);
for (int i = 0; i < NUM; ++i) {
assert(A[i] == B[i]);
assert(A[i] == C[i]);
}
for (int i = 0; i < NUM; ++i) {
A[i] = -3 * i;
B[i] = 0;
}
// CHECK: hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice, stream);
cudaMemcpyToSymbolAsync(globalIn, A, SIZE, 0, cudaMemcpyHostToDevice, stream);
// CHECK: hipStreamSynchronize(stream);
cudaStreamSynchronize(stream);
// CHECK: hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
Assign<<<dim3(1, 1, 1), dim3(NUM, 1, 1)>>>(Ad);
// CHECK: hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost);
cudaMemcpy(B, Ad, SIZE, cudaMemcpyDeviceToHost);
// CHECK: hipMemcpyFromSymbolAsync(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream);
cudaMemcpyFromSymbolAsync(C, globalOut, SIZE, 0, cudaMemcpyDeviceToHost, stream);
// CHECK: hipStreamSynchronize(stream);
cudaStreamSynchronize(stream);
for (int i = 0; i < NUM; ++i) {
assert(A[i] == B[i]);
assert(A[i] == C[i]);
}
bool *checkOkD;
bool checkOk = false;
size_t symbolSize = 0;
int *symbolAddress;
// CHECK: hipGetSymbolSize(&symbolSize, HIP_SYMBOL(globalConst));
cudaGetSymbolSize(&symbolSize, globalConst);
// CHECK: hipGetSymbolAddress((void**) &symbolAddress, HIP_SYMBOL(globalConst));
cudaGetSymbolAddress((void**) &symbolAddress, globalConst);
// CHECK: hipMalloc((void**)&checkOkD, sizeof(bool));
cudaMalloc((void**)&checkOkD, sizeof(bool));
// CHECK: hipLaunchKernelGGL(checkAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, symbolAddress, checkOkD);
checkAddress<<<dim3(1, 1, 1), dim3(1, 1, 1)>>>(symbolAddress, checkOkD);
// CHECK: hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost);
cudaMemcpy(&checkOk, checkOkD, sizeof(bool), cudaMemcpyDeviceToHost);
// CHECK: hipFree(checkOkD);
cudaFree(checkOkD);
assert(checkOk);
assert(symbolSize == SIZE);
// CHECK: hipHostFree(Am);
cudaFreeHost(Am);
// CHECK: hipHostFree(Cm);
cudaFreeHost(Cm);
// CHECK: hipFree(Ad);
cudaFree(Ad);
delete[] A;
delete[] B;
delete[] C;
return 0;
}

Some files were not shown because too many files have changed in this diff Show More