SWDEV-299127 - Merge 'develop' into 'amd-staging'
Change-Id: Ifcd3a019dbd72336ba22953b0c238630411bda37
This commit is contained in:
فروخته شده
+4
-4
@@ -59,9 +59,9 @@ def hipBuildTest(String backendLabel) {
|
||||
# Check if backend label contains string "amd" or backend host is a server with amd gpu
|
||||
if [[ $backendLabel =~ amd ]]; then
|
||||
sleep 120
|
||||
LLVM_PATH=/opt/rocm/llvm ctest -E 'cooperative_streams_least_capacity.tst|cooperative_streams_half_capacity.tst|cooperative_streams_full_capacity.tst|grid_group_data_sharing.tst|hipIpcMemAccessTest.tst|p2p_copy_coherency.tst'
|
||||
LLVM_PATH=/opt/rocm/llvm ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml -E 'cooperative_streams_least_capacity.tst|cooperative_streams_half_capacity.tst|cooperative_streams_full_capacity.tst|grid_group_data_sharing.tst|hipIpcMemAccessTest.tst|p2p_copy_coherency.tst'
|
||||
else
|
||||
make test
|
||||
ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml
|
||||
fi
|
||||
"""
|
||||
}
|
||||
@@ -102,9 +102,9 @@ def hipBuildTest(String backendLabel) {
|
||||
if [[ $backendLabel =~ amd ]]; then
|
||||
sleep 120
|
||||
export HT_CONFIG_FILE="$HIP_DIR/tests/catch/hipTestMain/config/config_amd_linux.json"
|
||||
LLVM_PATH=/opt/rocm/llvm ctest -E 'Unit_hipGraphChildGraphNodeGetGraph_Functional|Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative|Unit_hipPtrGetAttribute_Simple|Unit_hipStreamPerThread_DeviceReset_2'
|
||||
LLVM_PATH=/opt/rocm/llvm ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml -E 'Unit_hipGraphChildGraphNodeGetGraph_Functional|Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative|Unit_hipPtrGetAttribute_Simple|Unit_hipStreamPerThread_DeviceReset_2'
|
||||
else
|
||||
make test
|
||||
ctest --overwrite BuildDirectory=. --output-junit hiptest_output.xml
|
||||
fi
|
||||
"""
|
||||
}
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020 - 2021 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.
|
||||
|
||||
printUsage() {
|
||||
echo
|
||||
echo "Usage: $(basename "$0") HIP_BUILD_INC_DIR HIP_INC_DIR HIP_AMD_INC_DIR LLVM_DIR [option] [RTC_LIB_OUTPUT]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -p, --generate_pch Generate pre-compiled header (default)"
|
||||
echo " -r, --generate_rtc Generate preprocessor expansion (hiprtc_header.o)"
|
||||
echo " -h, --help Prints this help"
|
||||
echo
|
||||
echo
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
printUsage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HIP_BUILD_INC_DIR="$1"
|
||||
HIP_INC_DIR="$2"
|
||||
HIP_AMD_INC_DIR="$3"
|
||||
LLVM_DIR="$4"
|
||||
# By default, generate pch
|
||||
TARGET="generatepch"
|
||||
|
||||
while [ "$5" != "" ];
|
||||
do
|
||||
case "$5" in
|
||||
-h | --help )
|
||||
printUsage ; exit 0 ;;
|
||||
-p | --generate_pch )
|
||||
TARGET="generatepch" ; break ;;
|
||||
-r | --generate_rtc )
|
||||
TARGET="generatertc" ; break ;;
|
||||
*)
|
||||
echo " UNEXPECTED ERROR Parm : [$4] ">&2 ; exit 20 ;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
# Allow hiprtc lib name to be set by argument 7
|
||||
if [[ "$6" != "" ]]; then
|
||||
rtc_shared_lib_out="$6"
|
||||
else
|
||||
if [[ "$OSTYPE" == cygwin ]]; then
|
||||
rtc_shared_lib_out=hiprtc-builtins64.dll
|
||||
else
|
||||
rtc_shared_lib_out=libhiprtc-builtins.so
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" == cygwin || "$OSTYPE" == msys ]]; then
|
||||
isWindows=1
|
||||
tmpdir=.
|
||||
else
|
||||
isWindows=0
|
||||
tmpdir=/tmp
|
||||
fi
|
||||
|
||||
# Expected first argument $1 to be output file name.
|
||||
create_hip_macro_file() {
|
||||
cat >$1 <<EOF
|
||||
#define __device__ __attribute__((device))
|
||||
#define __host__ __attribute__((host))
|
||||
#define __global__ __attribute__((global))
|
||||
#define __constant__ __attribute__((constant))
|
||||
#define __shared__ __attribute__((shared))
|
||||
|
||||
#define launch_bounds_impl0(requiredMaxThreadsPerBlock) \
|
||||
__attribute__((amdgpu_flat_work_group_size(1, requiredMaxThreadsPerBlock)))
|
||||
#define launch_bounds_impl1(requiredMaxThreadsPerBlock, minBlocksPerMultiprocessor) \
|
||||
__attribute__((amdgpu_flat_work_group_size(1, requiredMaxThreadsPerBlock), \
|
||||
amdgpu_waves_per_eu(minBlocksPerMultiprocessor)))
|
||||
#define select_impl_(_1, _2, impl_, ...) impl_
|
||||
#define __launch_bounds__(...) \
|
||||
select_impl_(__VA_ARGS__, launch_bounds_impl1, launch_bounds_impl0)(__VA_ARGS__)
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
generate_pch() {
|
||||
tmp=$tmpdir/hip_pch.$$
|
||||
mkdir -p $tmp
|
||||
|
||||
create_hip_macro_file $tmp/hip_macros.h
|
||||
|
||||
cat >$tmp/hip_pch.h <<EOF
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_fp16.h"
|
||||
EOF
|
||||
|
||||
cat >$tmp/hip_pch.mcin <<EOF
|
||||
.type __hip_pch,@object
|
||||
.section .hip_pch,"aMS",@progbits,1
|
||||
.data
|
||||
.globl __hip_pch
|
||||
.globl __hip_pch_size
|
||||
.p2align 3
|
||||
__hip_pch:
|
||||
.incbin "$tmp/hip.pch"
|
||||
__hip_pch_size:
|
||||
.long __hip_pch_size - __hip_pch
|
||||
EOF
|
||||
|
||||
set -x
|
||||
|
||||
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++17 -nogpulib -isystem $HIP_INC_DIR -isystem $HIP_BUILD_INC_DIR -isystem $HIP_AMD_INC_DIR --cuda-device-only -x hip $tmp/hip_pch.h -E >$tmp/pch.cui &&
|
||||
|
||||
cat $tmp/hip_macros.h >> $tmp/pch.cui &&
|
||||
|
||||
$LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip.pch -x hip-cpp-output - <$tmp/pch.cui &&
|
||||
|
||||
$LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
|
||||
|
||||
rm -rf $tmp
|
||||
}
|
||||
|
||||
generate_rtc_header() {
|
||||
tmp=$tmpdir/hip_rtc.$$
|
||||
mkdir -p $tmp
|
||||
local macroFile="$tmp/hip_macros.h"
|
||||
local headerFile="$tmp/hipRTC_header.h"
|
||||
local mcinFile="$tmp/hipRTC_header.mcin"
|
||||
|
||||
create_hip_macro_file $macroFile
|
||||
|
||||
cat >$headerFile <<EOF
|
||||
#pragma push_macro("CHAR_BIT")
|
||||
#pragma push_macro("INT_MAX")
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
#define INT_MAX __INTMAX_MAX__
|
||||
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_fp16.h"
|
||||
|
||||
#pragma pop_macro("CHAR_BIT")
|
||||
#pragma pop_macro("INT_MAX")
|
||||
EOF
|
||||
|
||||
echo "// Automatically generated script for HIP RTC." > $mcinFile
|
||||
if [[ $isWindows -eq 0 ]]; then
|
||||
echo " .type __hipRTC_header,@object" >> $mcinFile
|
||||
echo " .type __hipRTC_header_size,@object" >> $mcinFile
|
||||
fi
|
||||
cat >>$mcinFile <<EOF
|
||||
.section .hipRTC_header,"a"
|
||||
.globl __hipRTC_header
|
||||
.globl __hipRTC_header_size
|
||||
.p2align 3
|
||||
__hipRTC_header:
|
||||
.incbin "$tmp/hiprtc"
|
||||
__hipRTC_header_size:
|
||||
.long __hipRTC_header_size - __hipRTC_header
|
||||
EOF
|
||||
|
||||
set -x
|
||||
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib --hip-version=4.4 -isystem $HIP_INC_DIR -isystem $HIP_BUILD_INC_DIR -isystem $HIP_AMD_INC_DIR --cuda-device-only -D__HIPCC_RTC__ -x hip $tmp/hipRTC_header.h -E -o $tmp/hiprtc &&
|
||||
cat $macroFile >> $tmp/hiprtc &&
|
||||
$LLVM_DIR/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj &&
|
||||
$LLVM_DIR/bin/clang $tmp/hiprtc_header.o -o $rtc_shared_lib_out -shared &&
|
||||
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib -nogpuinc -emit-llvm -c -o $tmp/tmp.bc --cuda-device-only -D__HIPCC_RTC__ --offload-arch=gfx906 -x hip-cpp-output $tmp/hiprtc &&
|
||||
rm -rf $tmp
|
||||
}
|
||||
|
||||
case $TARGET in
|
||||
(generatertc) generate_rtc_header ;;
|
||||
(generatepch) generate_pch ;;
|
||||
(*) die "Invalid target $TARGET" ;;
|
||||
esac
|
||||
|
||||
+8
-9
@@ -163,7 +163,7 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
|
||||
# Figure out the target with which llvm is configured
|
||||
$HIP_CLANG_TARGET = `$HIPCC -print-target-triple`;
|
||||
$HIP_CLANG_TARGET = chomp($HIP_CLANG_TARGET);
|
||||
chomp($HIP_CLANG_TARGET);
|
||||
|
||||
if (! defined $HIP_CLANG_INCLUDE_PATH) {
|
||||
$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");
|
||||
@@ -321,6 +321,9 @@ foreach $arg (@ARGV)
|
||||
# Check target selection option: --offload-arch= and --amdgpu-target=...
|
||||
foreach my $targetOpt (@targetOpts) {
|
||||
if (substr($arg, 0, length($targetOpt)) eq $targetOpt) {
|
||||
if ($targetOpt eq '--amdgpu-target=') {
|
||||
print "Warning: The --amdgpu-target option has been deprecated and will be removed in the future. Use --offload-arch instead.\n";
|
||||
}
|
||||
# If targets string is not empty, add a comma before adding new target option value.
|
||||
$targetsStr .= ($targetsStr ? ',' : '');
|
||||
$targetsStr .= substr($arg, length($targetOpt));
|
||||
@@ -355,10 +358,6 @@ foreach $arg (@ARGV)
|
||||
$compileOnly = 1;
|
||||
$buildDeps = 1;
|
||||
}
|
||||
if($trimarg eq '-use_fast_math') {
|
||||
$HIPCXXFLAGS .= " -DHIP_FAST_MATH ";
|
||||
$HIPCFLAGS .= " -DHIP_FAST_MATH ";
|
||||
}
|
||||
if(($trimarg eq '-use-staticlib') and ($setLinkType eq 0))
|
||||
{
|
||||
$linkType = 0;
|
||||
@@ -376,6 +375,7 @@ foreach $arg (@ARGV)
|
||||
}
|
||||
if($arg =~ '--amdhsa-code-object-version=')
|
||||
{
|
||||
print "Warning: The --amdhsa-code-object-version option has been deprecated and will be removed in the future. Use -mllvm -mcode-object-version instead.\n";
|
||||
$arg =~ s/--amdhsa-code-object-version=//;
|
||||
$hsacoVersion = $arg;
|
||||
$swallowArg = 1;
|
||||
@@ -534,12 +534,11 @@ foreach $arg (@ARGV)
|
||||
# Process HIPCC options here:
|
||||
if ($arg =~ m/^--hipcc/) {
|
||||
$swallowArg = 1;
|
||||
#if $arg eq "--hipcc_profile") { # Example argument here, hipcc
|
||||
#
|
||||
#}
|
||||
if ($arg eq "--hipcc-func-supp") {
|
||||
print "Warning: The --hipcc-func-supp option has been deprecated and will be removed in the future.\n";
|
||||
$funcSupp = 1;
|
||||
} elsif ($arg eq "--hipcc-no-func-supp") {
|
||||
print "Warning: The --hipcc-no-func-supp option has been deprecated and will be removed in the future.\n";
|
||||
$funcSupp = 0;
|
||||
}
|
||||
} else {
|
||||
@@ -708,7 +707,7 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
if ($linkType eq 0) {
|
||||
$toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L$ROCM_PATH/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
|
||||
} else {
|
||||
$toolArgs = ${toolArgs} . " -Wl,--enable-new-dtags -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 ";
|
||||
$toolArgs = ${toolArgs} . " -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 ";
|
||||
}
|
||||
# To support __fp16 and _Float16, explicitly link with compiler-rt
|
||||
$HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
|
||||
|
||||
@@ -1,538 +0,0 @@
|
||||
# CUBLAS API supported by HIP
|
||||
|
||||
## **1. CUBLAS Data types**
|
||||
|
||||
| **type** | **CUDA** |**CUDA version\***| **HIP** |**HIP value** (if differs) |
|
||||
|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|---------------------------|
|
||||
| define |`CUBLAS_VER_MAJOR` | 10.1 Update 2 | |
|
||||
| define |`CUBLAS_VER_MINOR` | 10.1 Update 2 | |
|
||||
| define |`CUBLAS_VER_PATCH` | 10.1 Update 2 | |
|
||||
| define |`CUBLAS_VER_BUILD` | 10.1 Update 2 | |
|
||||
| define |`CUBLAS_VERSION` | 10.1 Update 2 | |
|
||||
| enum |***`cublasStatus`*** | |***`hipblasStatus_t`*** |
|
||||
| enum |***`cublasStatus_t`*** | |***`hipblasStatus_t`*** |
|
||||
| 0 |*`CUBLAS_STATUS_SUCCESS`* | |*`HIPBLAS_STATUS_SUCCESS`* |
|
||||
| 1 |*`CUBLAS_STATUS_NOT_INITIALIZED`* | |*`HIPBLAS_STATUS_NOT_INITIALIZED`* |
|
||||
| 3 |*`CUBLAS_STATUS_ALLOC_FAILED`* | |*`HIPBLAS_STATUS_ALLOC_FAILED`* | 2 |
|
||||
| 7 |*`CUBLAS_STATUS_INVALID_VALUE`* | |*`HIPBLAS_STATUS_INVALID_VALUE`* | 3 |
|
||||
| 8 |*`CUBLAS_STATUS_ARCH_MISMATCH`* | |*`HIPBLAS_STATUS_ARCH_MISMATCH`* | |
|
||||
| 11 |*`CUBLAS_STATUS_MAPPING_ERROR`* | |*`HIPBLAS_STATUS_MAPPING_ERROR`* | 4 |
|
||||
| 13 |*`CUBLAS_STATUS_EXECUTION_FAILED`* | |*`HIPBLAS_STATUS_EXECUTION_FAILED`* | 5 |
|
||||
| 14 |*`CUBLAS_STATUS_INTERNAL_ERROR`* | |*`HIPBLAS_STATUS_INTERNAL_ERROR`* | 6 |
|
||||
| 15 |*`CUBLAS_STATUS_NOT_SUPPORTED`* | |*`HIPBLAS_STATUS_NOT_SUPPORTED`* | 7 |
|
||||
| 16 |*`CUBLAS_STATUS_LICENSE_ERROR`* | | |
|
||||
| enum |***`cublasOperation_t`*** | |***`hipblasOperation_t`*** |
|
||||
| 0 |*`CUBLAS_OP_N`* | |*`HIPBLAS_OP_N`* | 111 |
|
||||
| 1 |*`CUBLAS_OP_T`* | |*`HIPBLAS_OP_T`* | 112 |
|
||||
| 2 |*`CUBLAS_OP_C`* | |*`HIPBLAS_OP_C`* | 113 |
|
||||
| 2 |*`CUBLAS_OP_HERMITAN`* | 10.1 |*`HIPBLAS_OP_C`* | 113 |
|
||||
| 3 |*`CUBLAS_OP_CONJG`* | 10.1 | |
|
||||
| enum |***`cublasFillMode_t`*** | |***`hipblasFillMode_t`*** |
|
||||
| 0 |*`CUBLAS_FILL_MODE_LOWER`* | |*`HIPBLAS_FILL_MODE_LOWER`* | 121 |
|
||||
| 1 |*`CUBLAS_FILL_MODE_UPPER`* | |*`HIPBLAS_FILL_MODE_UPPER`* | 122 |
|
||||
| 2 |*`CUBLAS_FILL_MODE_FULL`* | 10.1 |*`HIPBLAS_FILL_MODE_FULL`* | 123 |
|
||||
| enum |***`cublasDiagType_t`*** | |***`hipblasDiagType_t`*** |
|
||||
| 0 |*`CUBLAS_DIAG_NON_UNIT`* | |*`HIPBLAS_DIAG_NON_UNIT`* | 131 |
|
||||
| 1 |*`CUBLAS_DIAG_UNIT`* | |*`HIPBLAS_DIAG_UNIT`* | 132 |
|
||||
| enum |***`cublasSideMode_t`*** | |***`hipblasSideMode_t`*** |
|
||||
| 0 |*`CUBLAS_SIDE_LEFT`* | |*`HIPBLAS_SIDE_LEFT`* | 141 |
|
||||
| 1 |*`CUBLAS_SIDE_RIGHT`* | |*`HIPBLAS_SIDE_RIGHT`* | 142 |
|
||||
| enum |***`cublasPointerMode_t`*** | |***`hipblasPointerMode_t`*** |
|
||||
| 0 |*`CUBLAS_POINTER_MODE_HOST`* | |*`HIPBLAS_POINTER_MODE_HOST`* |
|
||||
| 1 |*`CUBLAS_POINTER_MODE_DEVICE`* | |*`HIPBLAS_POINTER_MODE_DEVICE`* |
|
||||
| enum |***`cublasAtomicsMode_t`*** | | |
|
||||
| 0 |*`CUBLAS_ATOMICS_NOT_ALLOWED`* | | |
|
||||
| 1 |*`CUBLAS_ATOMICS_ALLOWED`* | | |
|
||||
| enum |***`cublasGemmAlgo_t`*** | 8.0 |***`hipblasGemmAlgo_t`*** |
|
||||
| -1 |*`CUBLAS_GEMM_DFALT`* | 8.0 |*`HIPBLAS_GEMM_DEFAULT`* | 160 |
|
||||
| -1 |*`CUBLAS_GEMM_DEFAULT`* | 8.0 |*`HIPBLAS_GEMM_DEFAULT`* | 160 |
|
||||
| 0 |*`CUBLAS_GEMM_ALGO0`* | 8.0 | |
|
||||
| 1 |*`CUBLAS_GEMM_ALGO1`* | 8.0 | |
|
||||
| 2 |*`CUBLAS_GEMM_ALGO2`* | 8.0 | |
|
||||
| 3 |*`CUBLAS_GEMM_ALGO3`* | 8.0 | |
|
||||
| 4 |*`CUBLAS_GEMM_ALGO4`* | 8.0 | |
|
||||
| 5 |*`CUBLAS_GEMM_ALGO5`* | 8.0 | |
|
||||
| 6 |*`CUBLAS_GEMM_ALGO6`* | 8.0 | |
|
||||
| 7 |*`CUBLAS_GEMM_ALGO7`* | 8.0 | |
|
||||
| 8 |*`CUBLAS_GEMM_ALGO8`* | 9.0 | |
|
||||
| 9 |*`CUBLAS_GEMM_ALGO9`* | 9.0 | |
|
||||
| 10 |*`CUBLAS_GEMM_ALGO10`* | 9.0 | |
|
||||
| 11 |*`CUBLAS_GEMM_ALGO11`* | 9.0 | |
|
||||
| 12 |*`CUBLAS_GEMM_ALGO12`* | 9.0 | |
|
||||
| 13 |*`CUBLAS_GEMM_ALGO13`* | 9.0 | |
|
||||
| 14 |*`CUBLAS_GEMM_ALGO14`* | 9.0 | |
|
||||
| 15 |*`CUBLAS_GEMM_ALGO15`* | 9.0 | |
|
||||
| 16 |*`CUBLAS_GEMM_ALGO16`* | 9.0 | |
|
||||
| 17 |*`CUBLAS_GEMM_ALGO17`* | 9.0 | |
|
||||
| 18 |*`CUBLAS_GEMM_ALGO18`* | 9.2 | |
|
||||
| 19 |*`CUBLAS_GEMM_ALGO19`* | 9.2 | |
|
||||
| 20 |*`CUBLAS_GEMM_ALGO20`* | 9.2 | |
|
||||
| 21 |*`CUBLAS_GEMM_ALGO21`* | 9.2 | |
|
||||
| 22 |*`CUBLAS_GEMM_ALGO22`* | 9.2 | |
|
||||
| 23 |*`CUBLAS_GEMM_ALGO23`* | 9.2 | |
|
||||
| 99 |*`CUBLAS_GEMM_DEFAULT_TENSOR_OP`* | 9.0 | |
|
||||
| 99 |*`CUBLAS_GEMM_DFALT_TENSOR_OP`* | 9.0 | |
|
||||
| 100 |*`CUBLAS_GEMM_ALGO0_TENSOR_OP`* | 9.0 | |
|
||||
| 101 |*`CUBLAS_GEMM_ALGO1_TENSOR_OP`* | 9.0 | |
|
||||
| 102 |*`CUBLAS_GEMM_ALGO2_TENSOR_OP`* | 9.0 | |
|
||||
| 103 |*`CUBLAS_GEMM_ALGO3_TENSOR_OP`* | 9.0 | |
|
||||
| 104 |*`CUBLAS_GEMM_ALGO4_TENSOR_OP`* | 9.0 | |
|
||||
| 105 |*`CUBLAS_GEMM_ALGO5_TENSOR_OP`* | 9.2 | |
|
||||
| 106 |*`CUBLAS_GEMM_ALGO6_TENSOR_OP`* | 9.2 | |
|
||||
| 107 |*`CUBLAS_GEMM_ALGO7_TENSOR_OP`* | 9.2 | |
|
||||
| 108 |*`CUBLAS_GEMM_ALGO8_TENSOR_OP`* | 9.2 | |
|
||||
| 109 |*`CUBLAS_GEMM_ALGO9_TENSOR_OP`* | 9.2 | |
|
||||
| 110 |*`CUBLAS_GEMM_ALGO10_TENSOR_OP`* | 9.2 | |
|
||||
| 111 |*`CUBLAS_GEMM_ALGO11_TENSOR_OP`* | 9.2 | |
|
||||
| 112 |*`CUBLAS_GEMM_ALGO12_TENSOR_OP`* | 9.2 | |
|
||||
| 113 |*`CUBLAS_GEMM_ALGO13_TENSOR_OP`* | 9.2 | |
|
||||
| 114 |*`CUBLAS_GEMM_ALGO14_TENSOR_OP`* | 9.2 | |
|
||||
| 115 |*`CUBLAS_GEMM_ALGO15_TENSOR_OP`* | 9.2 | |
|
||||
| enum |***`cublasMath_t`*** | 9.0 | |
|
||||
| 0 |*`CUBLAS_DEFAULT_MATH`* | 9.0 | |
|
||||
| 1 |*`CUBLAS_TENSOR_OP_MATH`* | 9.0 | |
|
||||
| enum* |`cublasDataType_t` | 7.5 | |
|
||||
| struct |`cublasContext` | | |
|
||||
| struct* |`cublasHandle_t` | |`hipblasHandle_t` |
|
||||
|
||||
## **2. CUBLAS API functions**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cublasCreate` |`hipblasCreate` |
|
||||
|`cublasCreate_v2` |`hipblasCreate` |
|
||||
|`cublasDestroy` |`hipblasDestroy` |
|
||||
|`cublasDestroy_v2` |`hipblasDestroy` |
|
||||
|`cublasGetVersion` | |
|
||||
|`cublasGetVersion_v2` | |
|
||||
|`cublasGetProperty` | | 8.0 |
|
||||
|`cublasGetCudartVersion` | | 10.1 |
|
||||
|`cublasGetStream` |`hipblasGetStream` |
|
||||
|`cublasGetStream_v2` |`hipblasGetStream` |
|
||||
|`cublasSetStream` |`hipblasSetStream` |
|
||||
|`cublasSetStream_v2` |`hipblasSetStream` |
|
||||
|`cublasGetPointerMode` |`hipblasGetPointerMode` |
|
||||
|`cublasGetPointerMode_v2` |`hipblasGetPointerMode` |
|
||||
|`cublasSetPointerMode` |`hipblasSetPointerMode` |
|
||||
|`cublasSetPointerMode_v2` |`hipblasSetPointerMode` |
|
||||
|`cublasGetAtomicsMode` | |
|
||||
|`cublasSetAtomicsMode` | |
|
||||
|`cublasGetMathMode` | | 9.0 |
|
||||
|`cublasSetMathMode` | | 9.0 |
|
||||
|`cublasLogCallback` | | 9.2 |
|
||||
|`cublasLoggerConfigure` | | 9.2 |
|
||||
|`cublasSetLoggerCallback` | | 9.2 |
|
||||
|`cublasGetLoggerCallback` | | 9.2 |
|
||||
|`cublasSetVector` |`hipblasSetVector` |
|
||||
|`cublasGetVector` |`hipblasGetVector` |
|
||||
|`cublasSetMatrix` |`hipblasSetMatrix` |
|
||||
|`cublasGetMatrix` |`hipblasGetMatrix` |
|
||||
|`cublasSetVectorAsync` | |
|
||||
|`cublasGetVectorAsync` | |
|
||||
|`cublasSetMatrixAsync` | |
|
||||
|`cublasGetMatrixAsync` | |
|
||||
|`cublasXerbla` | |
|
||||
|`cublasNrm2Ex` | | 8.0 |
|
||||
|`cublasSnrm2` |`hipblasSnrm2` |
|
||||
|`cublasSnrm2_v2` |`hipblasSnrm2` |
|
||||
|`cublasDnrm2` |`hipblasDnrm2` |
|
||||
|`cublasDnrm2_v2` |`hipblasDnrm2` |
|
||||
|`cublasScnrm2` |`hipblasScnrm2` |
|
||||
|`cublasScnrm2_v2` |`hipblasScnrm2` |
|
||||
|`cublasDznrm2` |`hipblasDznrm2` |
|
||||
|`cublasDznrm2_v2` |`hipblasDznrm2` |
|
||||
|`cublasDotEx` | | 8.0 |
|
||||
|`cublasDotcEx` | | 8.0 |
|
||||
|`cublasSdot` |`hipblasSdot` |
|
||||
|`cublasSdot_v2` |`hipblasSdot` |
|
||||
|`cublasDdot` |`hipblasDdot` |
|
||||
|`cublasDdot_v2` |`hipblasDdot` |
|
||||
|`cublasCdotu` |`hipblasCdotu` |
|
||||
|`cublasCdotu_v2` |`hipblasCdotu` |
|
||||
|`cublasCdotc` |`hipblasCdotc` |
|
||||
|`cublasCdotc_v2` |`hipblasCdotc` |
|
||||
|`cublasZdotu` |`hipblasZdotu` |
|
||||
|`cublasZdotu_v2` |`hipblasZdotu` |
|
||||
|`cublasZdotc` |`hipblasZdotc` |
|
||||
|`cublasZdotc_v2` |`hipblasZdotc` |
|
||||
|`cublasScalEx` | | 8.0 |
|
||||
|`cublasSscal` |`hipblasSscal` |
|
||||
|`cublasSscal_v2` |`hipblasSscal` |
|
||||
|`cublasDscal` |`hipblasDscal` |
|
||||
|`cublasDscal_v2` |`hipblasDscal` |
|
||||
|`cublasCscal` |`hipblasCscal` |
|
||||
|`cublasCscal_v2` |`hipblasCscal` |
|
||||
|`cublasCsscal` |`hipblasCsscal` |
|
||||
|`cublasCsscal_v2` |`hipblasCsscal` |
|
||||
|`cublasZscal` |`hipblasZscal` |
|
||||
|`cublasZscal_v2` |`hipblasZscal` |
|
||||
|`cublasZdscal` |`hipblasZdscal` |
|
||||
|`cublasZdscal_v2` |`hipblasZdscal` |
|
||||
|`cublasAxpyEx` | | 8.0 |
|
||||
|`cublasSaxpy` |`hipblasSaxpy` |
|
||||
|`cublasSaxpy_v2` |`hipblasSaxpy` |
|
||||
|`cublasDaxpy` |`hipblasDaxpy` |
|
||||
|`cublasDaxpy_v2` |`hipblasDaxpy` |
|
||||
|`cublasCaxpy` |`hipblasCaxpy` |
|
||||
|`cublasCaxpy_v2` |`hipblasCaxpy` |
|
||||
|`cublasZaxpy` |`hipblasZaxpy` |
|
||||
|`cublasZaxpy_v2` |`hipblasZaxpy` |
|
||||
|`cublasScopy` |`hipblasScopy` |
|
||||
|`cublasScopy_v2` |`hipblasScopy` |
|
||||
|`cublasDcopy` |`hipblasDcopy` |
|
||||
|`cublasDcopy_v2` |`hipblasDcopy` |
|
||||
|`cublasCcopy` |`hipblasCcopy` |
|
||||
|`cublasCopyEx` | | 10.1 |
|
||||
|`cublasCcopy_v2` |`hipblasCcopy` |
|
||||
|`cublasZcopy` |`hipblasZcopy` |
|
||||
|`cublasZcopy_v2` |`hipblasZcopy` |
|
||||
|`cublasSswap` |`hipblasSswap` |
|
||||
|`cublasSswap_v2` |`hipblasSswap` |
|
||||
|`cublasDswap` |`hipblasDswap` |
|
||||
|`cublasDswap_v2` |`hipblasDswap` |
|
||||
|`cublasCswap` |`hipblasCswap` |
|
||||
|`cublasCswap_v2` |`hipblasCswap` |
|
||||
|`cublasZswap` |`hipblasZswap` |
|
||||
|`cublasZswap_v2` |`hipblasZswap` |
|
||||
|`cublasIamaxEx` | | 10.1 |
|
||||
|`cublasIsamax` |`hipblasIsamax` |
|
||||
|`cublasIsamax_v2` |`hipblasIsamax` |
|
||||
|`cublasIdamax` |`hipblasIdamax` |
|
||||
|`cublasIdamax_v2` |`hipblasIdamax` |
|
||||
|`cublasIcamax` |`hipblasIcamax` |
|
||||
|`cublasIcamax_v2` |`hipblasIcamax` |
|
||||
|`cublasIzamax` |`hipblasIzamax` |
|
||||
|`cublasIzamax_v2` |`hipblasIzamax` |
|
||||
|`cublasIaminEx` | | 10.1 |
|
||||
|`cublasIsamin` |`hipblasIsamin` |
|
||||
|`cublasIsamin_v2` |`hipblasIsamin` |
|
||||
|`cublasIdamin` |`hipblasIdamin` |
|
||||
|`cublasIdamin_v2` |`hipblasIdamin` |
|
||||
|`cublasIcamin` |`hipblasIcamin` |
|
||||
|`cublasIcamin_v2` |`hipblasIcamin` |
|
||||
|`cublasIzamin` |`hipblasIzamin` |
|
||||
|`cublasIzamin_v2` |`hipblasIzamin` |
|
||||
|`cublasAsumEx` | | 10.1 |
|
||||
|`cublasSasum` |`hipblasSasum` |
|
||||
|`cublasSasum_v2` |`hipblasSasum` |
|
||||
|`cublasDasum` |`hipblasDasum` |
|
||||
|`cublasDasum_v2` |`hipblasDasum` |
|
||||
|`cublasScasum` |`hipblasScasum` |
|
||||
|`cublasScasum_v2` |`hipblasScasum` |
|
||||
|`cublasDzasum` |`hipblasDzasum` |
|
||||
|`cublasDzasum_v2` |`hipblasDzasum` |
|
||||
|`cublasRotEx` | | 10.1 |
|
||||
|`cublasSrot` |`hipblasSrot` |
|
||||
|`cublasSrot_v2` |`hipblasSrot` |
|
||||
|`cublasDrot` |`hipblasDrot` |
|
||||
|`cublasDrot_v2` |`hipblasDrot` |
|
||||
|`cublasCrot` |`hipblasCrot` |
|
||||
|`cublasCrot_v2` |`hipblasCrot` |
|
||||
|`cublasCsrot` |`hipblasCsrot` |
|
||||
|`cublasCsrot_v2` |`hipblasCsrot` |
|
||||
|`cublasZrot` |`hipblasZrot` |
|
||||
|`cublasZrot_v2` |`hipblasZrot` |
|
||||
|`cublasRotgEx` | | 10.1 |
|
||||
|`cublasZdrot` |`hipblasZdrot` |
|
||||
|`cublasZdrot_v2` |`hipblasZdrot` |
|
||||
|`cublasSrotg` |`hipblasSrotg` |
|
||||
|`cublasSrotg_v2` |`hipblasSrotg` |
|
||||
|`cublasDrotg` |`hipblasDrotg` |
|
||||
|`cublasDrotg_v2` |`hipblasDrotg` |
|
||||
|`cublasCrotg` |`hipblasCrotg` |
|
||||
|`cublasCrotg_v2` |`hipblasCrotg` |
|
||||
|`cublasZrotg` |`hipblasZrotg` |
|
||||
|`cublasZrotg_v2` |`hipblasZrotg` |
|
||||
|`cublasRotmEx` | | 10.1 |
|
||||
|`cublasSrotm` |`hipblasSrotm` |
|
||||
|`cublasSrotm_v2` |`hipblasSrotm` |
|
||||
|`cublasDrotm` |`hipblasDrotm` |
|
||||
|`cublasDrotm_v2` |`hipblasDrotm` |
|
||||
|`cublasRotmgEx` | | 10.1 |
|
||||
|`cublasSrotmg` |`hipblasSrotmg` |
|
||||
|`cublasSrotmg_v2` |`hipblasSrotmg` |
|
||||
|`cublasDrotmg` |`hipblasDrotmg` |
|
||||
|`cublasDrotmg_v2` |`hipblasDrotmg` |
|
||||
|`cublasSgemv` |`hipblasSgemv` |
|
||||
|`cublasSgemv_v2` |`hipblasSgemv` |
|
||||
|`cublasSgemvBatched` |`hipblasSgemvBatched` |
|
||||
|`cublasDgemv` |`hipblasDgemv` |
|
||||
|`cublasDgemv_v2` |`hipblasDgemv` |
|
||||
|`cublasCgemv` |`hipblasCgemv` |
|
||||
|`cublasCgemv_v2` |`hipblasCgemv` |
|
||||
|`cublasZgemv` |`hipblasZgemv` |
|
||||
|`cublasZgemv_v2` |`hipblasZgemv` |
|
||||
|`cublasSgbmv` | |
|
||||
|`cublasSgbmv_v2` | |
|
||||
|`cublasDgbmv` | |
|
||||
|`cublasDgbmv_v2` | |
|
||||
|`cublasCgbmv` | |
|
||||
|`cublasCgbmv_v2` | |
|
||||
|`cublasZgbmv` | |
|
||||
|`cublasZgbmv_v2` | |
|
||||
|`cublasStrmv` | |
|
||||
|`cublasStrmv_v2` | |
|
||||
|`cublasDtrmv` | |
|
||||
|`cublasDtrmv_v2` | |
|
||||
|`cublasCtrmv` | |
|
||||
|`cublasCtrmv_v2` | |
|
||||
|`cublasZtrmv` | |
|
||||
|`cublasZtrmv_v2` | |
|
||||
|`cublasStbmv` | |
|
||||
|`cublasStbmv_v2` | |
|
||||
|`cublasDtbmv` | |
|
||||
|`cublasDtbmv_v2` | |
|
||||
|`cublasCtbmv` | |
|
||||
|`cublasCtbmv_v2` | |
|
||||
|`cublasZtbmv` | |
|
||||
|`cublasZtbmv_v2` | |
|
||||
|`cublasStpmv` | |
|
||||
|`cublasStpmv_v2` | |
|
||||
|`cublasDtpmv` | |
|
||||
|`cublasDtpmv_v2` | |
|
||||
|`cublasCtpmv` | |
|
||||
|`cublasCtpmv_v2` | |
|
||||
|`cublasZtpmv` | |
|
||||
|`cublasZtpmv_v2` | |
|
||||
|`cublasStrsv` |`hipblasStrsv` |
|
||||
|`cublasStrsv_v2` |`hipblasStrsv` |
|
||||
|`cublasDtrsv` |`hipblasDtrsv` |
|
||||
|`cublasDtrsv_v2` |`hipblasDtrsv` |
|
||||
|`cublasCtrsv` | |
|
||||
|`cublasCtrsv_v2` | |
|
||||
|`cublasZtrsv` | |
|
||||
|`cublasZtrsv_v2` | |
|
||||
|`cublasStpsv` | |
|
||||
|`cublasStpsv_v2` | |
|
||||
|`cublasDtpsv` | |
|
||||
|`cublasDtpsv_v2` | |
|
||||
|`cublasCtpsv` | |
|
||||
|`cublasCtpsv_v2` | |
|
||||
|`cublasZtpsv` | |
|
||||
|`cublasZtpsv_v2` | |
|
||||
|`cublasStbsv` | |
|
||||
|`cublasStbsv_v2` | |
|
||||
|`cublasDtbsv` | |
|
||||
|`cublasDtbsv_v2` | |
|
||||
|`cublasCtbsv` | |
|
||||
|`cublasCtbsv_v2` | |
|
||||
|`cublasZtbsv` | |
|
||||
|`cublasZtbsv_v2` | |
|
||||
|`cublasSsymv` | |
|
||||
|`cublasSsymv_v2` | |
|
||||
|`cublasDsymv` | |
|
||||
|`cublasDsymv_v2` | |
|
||||
|`cublasCsymv` | |
|
||||
|`cublasCsymv_v2` | |
|
||||
|`cublasZsymv` | |
|
||||
|`cublasZsymv_v2` | |
|
||||
|`cublasChemv` | |
|
||||
|`cublasChemv_v2` | |
|
||||
|`cublasZhemv` | |
|
||||
|`cublasZhemv_v2` | |
|
||||
|`cublasSsbmv` | |
|
||||
|`cublasSsbmv_v2` | |
|
||||
|`cublasDsbmv` | |
|
||||
|`cublasDsbmv_v2` | |
|
||||
|`cublasChbmv` | |
|
||||
|`cublasChbmv_v2` | |
|
||||
|`cublasZhbmv` | |
|
||||
|`cublasZhbmv_v2` | |
|
||||
|`cublasSspmv` | |
|
||||
|`cublasSspmv_v2` | |
|
||||
|`cublasDspmv` | |
|
||||
|`cublasDspmv_v2` | |
|
||||
|`cublasChpmv` | |
|
||||
|`cublasChpmv_v2` | |
|
||||
|`cublasZhpmv` | |
|
||||
|`cublasZhpmv_v2` | |
|
||||
|`cublasSger` |`hipblasSger` |
|
||||
|`cublasSger_v2` |`hipblasSger` |
|
||||
|`cublasDger` |`hipblasDger` |
|
||||
|`cublasDger_v2` |`hipblasDger` |
|
||||
|`cublasCgeru` | |
|
||||
|`cublasCgeru_v2` | |
|
||||
|`cublasCgerc` | |
|
||||
|`cublasCgerc_v2` | |
|
||||
|`cublasZgeru` | |
|
||||
|`cublasZgeru_v2` | |
|
||||
|`cublasZgerc` | |
|
||||
|`cublasZgerc_v2` | |
|
||||
|`cublasSsyr` |`hipblasSsyr` |
|
||||
|`cublasSsyr_v2` |`hipblasSsyr` |
|
||||
|`cublasDsyr` |`hipblasDsyr` |
|
||||
|`cublasDsyr_v2` |`hipblasDsyr` |
|
||||
|`cublasCsyr` | |
|
||||
|`cublasCsyr_v2` | |
|
||||
|`cublasZsyr` | |
|
||||
|`cublasZsyr_v2` | |
|
||||
|`cublasCher` | |
|
||||
|`cublasCher_v2` | |
|
||||
|`cublasZher` | |
|
||||
|`cublasZher_v2` | |
|
||||
|`cublasSspr` | |
|
||||
|`cublasSspr_v2` | |
|
||||
|`cublasDspr` | |
|
||||
|`cublasDspr_v2` | |
|
||||
|`cublasChpr` | |
|
||||
|`cublasChpr_v2` | |
|
||||
|`cublasZhpr` | |
|
||||
|`cublasZhpr_v2` | |
|
||||
|`cublasSsyr2` | |
|
||||
|`cublasSsyr2_v2` | |
|
||||
|`cublasDsyr2` | |
|
||||
|`cublasDsyr2_v2` | |
|
||||
|`cublasCsyr2` | |
|
||||
|`cublasCsyr2_v2` | |
|
||||
|`cublasZsyr2` | |
|
||||
|`cublasZsyr2_v2` | |
|
||||
|`cublasCher2` | |
|
||||
|`cublasCher2_v2` | |
|
||||
|`cublasZher2` | |
|
||||
|`cublasZher2_v2` | |
|
||||
|`cublasSspr2` | |
|
||||
|`cublasSspr2_v2` | |
|
||||
|`cublasDspr2` | |
|
||||
|`cublasDspr2_v2` | |
|
||||
|`cublasChpr2` | |
|
||||
|`cublasChpr2_v2` | |
|
||||
|`cublasZhpr2` | |
|
||||
|`cublasZhpr2_v2` | |
|
||||
|`cublasSgemm` |`hipblasSgemm` |
|
||||
|`cublasSgemm_v2` |`hipblasSgemm` |
|
||||
|`cublasDgemm` |`hipblasDgemm` |
|
||||
|`cublasDgemm_v2` |`hipblasDgemm` |
|
||||
|`cublasCgemm` | |
|
||||
|`cublasCgemm_v2` | |
|
||||
|`cublasCgemm3m` | | 8.0 |
|
||||
|`cublasCgemm3mEx` | | 8.0 |
|
||||
|`cublasZgemm` |`hipblasZgemm` |
|
||||
|`cublasZgemm_v2` |`hipblasZgemm` |
|
||||
|`cublasZgemm3m` | | 8.0 |
|
||||
|`cublasHgemm` |`hipblasHgemm` | 7.5 |
|
||||
|`cublasSgemmEx` | | 7.5 |
|
||||
|`cublasGemmEx` |`hipblasGemmEx` | 8.0 |
|
||||
|`cublasCgemmEx` | | 8.0 |
|
||||
|`cublasUint8gemmBias` | | 8.0 |
|
||||
|`cublasSsyrk` | |
|
||||
|`cublasSsyrk_v2` | |
|
||||
|`cublasDsyrk` | |
|
||||
|`cublasDsyrk_v2` | |
|
||||
|`cublasCsyrk` | |
|
||||
|`cublasCsyrk_v2` | |
|
||||
|`cublasZsyrk` | |
|
||||
|`cublasZsyrk_v2` | |
|
||||
|`cublasCsyrkEx` | | 8.0 |
|
||||
|`cublasCsyrk3mEx` | | 8.0 |
|
||||
|`cublasCherk` | |
|
||||
|`cublasCherk_v2` | |
|
||||
|`cublasZherk` | |
|
||||
|`cublasZherk_v2` | |
|
||||
|`cublasCherkEx` | | 8.0 |
|
||||
|`cublasCherk3mEx` | | 8.0 |
|
||||
|`cublasSsyr2k` | |
|
||||
|`cublasSsyr2k_v2` | |
|
||||
|`cublasDsyr2k` | |
|
||||
|`cublasDsyr2k_v2` | |
|
||||
|`cublasCsyr2k` | |
|
||||
|`cublasCsyr2k_v2` | |
|
||||
|`cublasZsyr2k` | |
|
||||
|`cublasZsyr2k_v2` | |
|
||||
|`cublasCher2k` | |
|
||||
|`cublasCher2k_v2` | |
|
||||
|`cublasZher2k` | |
|
||||
|`cublasZher2k_v2` | |
|
||||
|`cublasSsyrkx` | |
|
||||
|`cublasDsyrkx` | |
|
||||
|`cublasCsyrkx` | |
|
||||
|`cublasZsyrkx` | |
|
||||
|`cublasCherkx` | |
|
||||
|`cublasZherkx` | |
|
||||
|`cublasSsymm` | |
|
||||
|`cublasSsymm_v2` | |
|
||||
|`cublasDsymm` | |
|
||||
|`cublasDsymm_v2` | |
|
||||
|`cublasCsymm` | |
|
||||
|`cublasCsymm_v2` | |
|
||||
|`cublasZsymm` | |
|
||||
|`cublasZsymm_v2` | |
|
||||
|`cublasChemm` | |
|
||||
|`cublasChemm_v2` | |
|
||||
|`cublasZhemm` | |
|
||||
|`cublasZhemm_v2` | |
|
||||
|`cublasStrsm` |`hipblasStrsm` |
|
||||
|`cublasStrsm_v2` |`hipblasStrsm` |
|
||||
|`cublasDtrsm` |`hipblasDtrsm` |
|
||||
|`cublasDtrsm_v2` |`hipblasDtrsm` |
|
||||
|`cublasCtrsm` | |
|
||||
|`cublasCtrsm_v2` | |
|
||||
|`cublasZtrsm` | |
|
||||
|`cublasZtrsm_v2` | |
|
||||
|`cublasStrmm` | |
|
||||
|`cublasStrmm_v2` | |
|
||||
|`cublasDtrmm` | |
|
||||
|`cublasDtrmm_v2` | |
|
||||
|`cublasCtrmm` | |
|
||||
|`cublasCtrmm_v2` | |
|
||||
|`cublasZtrmm` | |
|
||||
|`cublasZtrmm_v2` | |
|
||||
|`cublasHgemmBatched` |`hipblasHgemmBatched` | 9.0 |
|
||||
|`cublasSgemmBatched` |`hipblasSgemmBatched` |
|
||||
|`cublasDgemmBatched` |`hipblasDgemmBatched` |
|
||||
|`cublasCgemmBatched` |`hipblasCgemmBatched` |
|
||||
|`cublasCgemm3mBatched` | | 8.0 |
|
||||
|`cublasZgemmBatched` |`hipblasZgemmBatched` |
|
||||
|`cublasGemmBatchedEx` | | 9.1 |
|
||||
|`cublasGemmStridedBatchedEx` | | 9.1 |
|
||||
|`cublasSgemmStridedBatched` |`hipblasSgemmStridedBatched` | 8.0 |
|
||||
|`cublasDgemmStridedBatched` |`hipblasDgemmStridedBatched` | 8.0 |
|
||||
|`cublasCgemmStridedBatched` |`hipblasCgemmStridedBatched` | 8.0 |
|
||||
|`cublasCgemm3mStridedBatched` | | 8.0 |
|
||||
|`cublasZgemmStridedBatched` |`hipblasZgemmStridedBatched` | 8.0 |
|
||||
|`cublasHgemmStridedBatched` |`hipblasHgemmStridedBatched` | 8.0 |
|
||||
|`cublasSgeam` |`hipblasSgeam` |
|
||||
|`cublasDgeam` |`hipblasDgeam` |
|
||||
|`cublasCgeam` | |
|
||||
|`cublasZgeam` | |
|
||||
|`cublasSgetrfBatched` | |
|
||||
|`cublasDgetrfBatched` | |
|
||||
|`cublasCgetrfBatched` | |
|
||||
|`cublasZgetrfBatched` | |
|
||||
|`cublasSgetriBatched` | |
|
||||
|`cublasDgetriBatched` | |
|
||||
|`cublasCgetriBatched` | |
|
||||
|`cublasZgetriBatched` | |
|
||||
|`cublasSgetrsBatched` | |
|
||||
|`cublasDgetrsBatched` | |
|
||||
|`cublasCgetrsBatched` | |
|
||||
|`cublasZgetrsBatched` | |
|
||||
|`cublasStrsmBatched` | |
|
||||
|`cublasDtrsmBatched` | |
|
||||
|`cublasCtrsmBatched` | |
|
||||
|`cublasZtrsmBatched` | |
|
||||
|`cublasSmatinvBatched` | |
|
||||
|`cublasDmatinvBatched` | |
|
||||
|`cublasCmatinvBatched` | |
|
||||
|`cublasZmatinvBatched` | |
|
||||
|`cublasSgeqrfBatched` | |
|
||||
|`cublasDgeqrfBatched` | |
|
||||
|`cublasCgeqrfBatched` | |
|
||||
|`cublasZgeqrfBatched` | |
|
||||
|`cublasSgelsBatched` | |
|
||||
|`cublasDgelsBatched` | |
|
||||
|`cublasCgelsBatched` | |
|
||||
|`cublasZgelsBatched` | |
|
||||
|`cublasSdgmm` | |
|
||||
|`cublasDdgmm` | |
|
||||
|`cublasCdgmm` | |
|
||||
|`cublasZdgmm` | |
|
||||
|`cublasStpttr` | |
|
||||
|`cublasDtpttr` | |
|
||||
|`cublasCtpttr` | |
|
||||
|`cublasZtpttr` | |
|
||||
|`cublasStrttp` | |
|
||||
|`cublasDtrttp` | |
|
||||
|`cublasCtrttp` | |
|
||||
|`cublasZtrttp` | |
|
||||
|
||||
\* CUDA version, in which API has appeared and (optional) last version before abandoning it; no value in case of earlier versions < 7.5.
|
||||
@@ -1,586 +0,0 @@
|
||||
# CUDNN API supported by HIP
|
||||
|
||||
## **1. CUDNN Data types**
|
||||
|
||||
| **type** | **CUDA** |**CUDA version\***| **HIP** |**HIP value** (if differs) |
|
||||
|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|---------------------------|
|
||||
| define |`CUDNN_VERSION` | |`HIPDNN_VERSION` |
|
||||
| struct |`cudnnContext` | | |
|
||||
| struct* |`cudnnHandle_t` | |`hipdnnHandle_t` |
|
||||
| enum |***`cudnnStatus_t`*** | |***`hipdnnStatus_t`*** |
|
||||
| 0 |*`CUDNN_STATUS_SUCCESS`* | |*`HIPDNN_STATUS_SUCCESS`* |
|
||||
| 1 |*`CUDNN_STATUS_NOT_INITIALIZED`* | |*`HIPDNN_STATUS_NOT_INITIALIZED`* |
|
||||
| 2 |*`CUDNN_STATUS_ALLOC_FAILED`* | |*`HIPDNN_STATUS_ALLOC_FAILED`* |
|
||||
| 3 |*`CUDNN_STATUS_BAD_PARAM`* | |*`HIPDNN_STATUS_BAD_PARAM`* |
|
||||
| 4 |*`CUDNN_STATUS_INTERNAL_ERROR`* | |*`HIPDNN_STATUS_INTERNAL_ERROR`* |
|
||||
| 5 |*`CUDNN_STATUS_INVALID_VALUE`* | |*`HIPDNN_STATUS_INVALID_VALUE`* |
|
||||
| 6 |*`CUDNN_STATUS_ARCH_MISMATCH`* | |*`HIPDNN_STATUS_ARCH_MISMATCH`* |
|
||||
| 7 |*`CUDNN_STATUS_MAPPING_ERROR`* | |*`HIPDNN_STATUS_MAPPING_ERROR`* |
|
||||
| 8 |*`CUDNN_STATUS_EXECUTION_FAILED`* | |*`HIPDNN_STATUS_EXECUTION_FAILED`* |
|
||||
| 9 |*`CUDNN_STATUS_NOT_SUPPORTED`* | |*`HIPDNN_STATUS_NOT_SUPPORTED`* |
|
||||
| 10 |*`CUDNN_STATUS_LICENSE_ERROR`* | |*`HIPDNN_STATUS_LICENSE_ERROR`* |
|
||||
| 11 |*`CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING`* | 7.5 |*`HIPDNN_STATUS_RUNTIME_PREREQUISITE_MISSING`* |
|
||||
| 12 |*`CUDNN_STATUS_RUNTIME_IN_PROGRESS`* | 8.0 | |
|
||||
| 13 |*`CUDNN_STATUS_RUNTIME_FP_OVERFLOW`* | 8.0 | |
|
||||
| struct |`cudnnRuntimeTag_t` | 8.0 | |
|
||||
| enum |***`cudnnErrQueryMode_t`*** | 8.0 | |
|
||||
| 0 |*`CUDNN_ERRQUERY_RAWCODE`* | 8.0 | |
|
||||
| 1 |*`CUDNN_ERRQUERY_NONBLOCKING`* | 8.0 | |
|
||||
| 2 |*`CUDNN_ERRQUERY_BLOCKING`* | 8.0 | |
|
||||
| struct |`cudnnTensorStruct` | | |
|
||||
| struct* |`cudnnTensorDescriptor_t` | |`hipdnnTensorDescriptor_t` |
|
||||
| struct |`cudnnConvolutionStruct` | | |
|
||||
| struct* |`cudnnConvolutionDescriptor_t` | |`hipdnnConvolutionDescriptor_t` |
|
||||
| struct |`cudnnPoolingStruct` | | |
|
||||
| struct* |`cudnnPoolingDescriptor_t` | |`hipdnnPoolingDescriptor_t` |
|
||||
| struct |`cudnnFilterStruct` | | |
|
||||
| struct* |`cudnnFilterDescriptor_t` | |`hipdnnFilterDescriptor_t` |
|
||||
| struct |`cudnnLRNStruct` | | |
|
||||
| struct* |`cudnnLRNDescriptor_t` | |`hipdnnLRNDescriptor_t` |
|
||||
| struct |`cudnnActivationStruct` | | |
|
||||
| struct* |`cudnnActivationDescriptor_t` | |`hipdnnActivationDescriptor_t` |
|
||||
| struct |`cudnnSpatialTransformerStruct` | 7.5 | |
|
||||
| struct* |`cudnnSpatialTransformerDescriptor_t` | 7.5 | |
|
||||
| struct |`cudnnOpTensorStruct` | 7.5 | |
|
||||
| struct* |`cudnnOpTensorDescriptor_t` | 7.5 |`hipdnnOpTensorDescriptor_t` |
|
||||
| struct |`cudnnReduceTensorStruct` | 7.5 | |
|
||||
| struct* |`cudnnReduceTensorDescriptor_t` | 7.5 |`hipdnnReduceTensorDescriptor_t` |
|
||||
| struct |`cudnnCTCLossStruct` | 8.0 | |
|
||||
| struct* |`cudnnCTCLossDescriptor_t` | 8.0 | |
|
||||
| struct |`cudnnTensorTransformStruct` | 9.0 | |
|
||||
| struct* |`cudnnTensorTransformDescriptor_t` | 9.0 | |
|
||||
| enum |***`cudnnDataType_t`*** | |***`hipdnnDataType_t`*** |
|
||||
| 0 |*`CUDNN_DATA_FLOAT`* | |*`HIPDNN_DATA_FLOAT`* |
|
||||
| 1 |*`CUDNN_DATA_DOUBLE`* | |*`HIPDNN_DATA_DOUBLE`* |
|
||||
| 2 |*`CUDNN_DATA_HALF`* | |*`HIPDNN_DATA_HALF`* |
|
||||
| 3 |*`CUDNN_DATA_INT8`* | 7.5 |*`HIPDNN_DATA_INT8`* |
|
||||
| 4 |*`CUDNN_DATA_INT32`* | 7.5 |*`HIPDNN_DATA_INT32`* |
|
||||
| 5 |*`CUDNN_DATA_INT8x4`* | 7.5 |*`HIPDNN_DATA_INT8x4`* |
|
||||
| 6 |*`CUDNN_DATA_UINT8`* | 8.0 | |
|
||||
| 7 |*`CUDNN_DATA_UINT8x4`* | 8.0 | |
|
||||
| 8 |*`CUDNN_DATA_INT8x32`* | 9.0 | |
|
||||
| enum |***`cudnnMathType_t`*** | 8.0 |***`hipdnnMathType_t`*** |
|
||||
| 0 |*`CUDNN_DEFAULT_MATH`* | 8.0 |*`HIPDNN_DEFAULT_MATH`* |
|
||||
| 1 |*`CUDNN_TENSOR_OP_MATH`* | 8.0 |*`HIPDNN_TENSOR_OP_MATH`* |
|
||||
| enum |***`cudnnNanPropagation_t`*** | |***`hipdnnNanPropagation_t`*** |
|
||||
| 0 |*`CUDNN_NOT_PROPAGATE_NAN`* | |*`HIPDNN_NOT_PROPAGATE_NAN`* |
|
||||
| 1 |*`CUDNN_PROPAGATE_NAN`* | |*`HIPDNN_PROPAGATE_NAN`* |
|
||||
| enum |***`cudnnDeterminism_t`*** | 7.5 | |
|
||||
| 0 |*`CUDNN_NON_DETERMINISTIC`* | 7.5 | |
|
||||
| 1 |*`CUDNN_DETERMINISTIC`* | 7.5 | |
|
||||
| define |`CUDNN_DIM_MAX` | | |
|
||||
| enum |***`cudnnTensorFormat_t`*** | |***`hipdnnTensorFormat_t`*** |
|
||||
| 0 |*`CUDNN_TENSOR_NCHW`* | |*`HIPDNN_TENSOR_NCHW`* |
|
||||
| 1 |*`CUDNN_TENSOR_NHWC`* | |*`HIPDNN_TENSOR_NHWC`* |
|
||||
| 2 |*`CUDNN_TENSOR_NCHW_VECT_C`* | 7.5 |*`HIPDNN_TENSOR_NCHW_VECT_C`* |
|
||||
| enum |***`cudnnFoldingDirection_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_TRANSFORM_FOLD`* | 9.0 | |
|
||||
| 1 |*`CUDNN_TRANSFORM_UNFOLD`* | 9.0 | |
|
||||
| enum |***`cudnnOpTensorOp_t`*** | 7.5 |***`hipdnnOpTensorOp_t`*** |
|
||||
| 0 |*`CUDNN_OP_TENSOR_ADD`* | 7.5 |*`HIPDNN_OP_TENSOR_ADD`* |
|
||||
| 1 |*`CUDNN_OP_TENSOR_MUL`* | 7.5 |*`HIPDNN_OP_TENSOR_MUL`* |
|
||||
| 2 |*`CUDNN_OP_TENSOR_MIN`* | 7.5 |*`HIPDNN_OP_TENSOR_MIN`* |
|
||||
| 3 |*`CUDNN_OP_TENSOR_MAX`* | 7.5 |*`HIPDNN_OP_TENSOR_MAX`* |
|
||||
| 4 |*`CUDNN_OP_TENSOR_SQRT`* | 7.5 |*`HIPDNN_OP_TENSOR_SQRT`* |
|
||||
| 5 |*`CUDNN_OP_TENSOR_NOT`* | 8.0 |*`HIPDNN_OP_TENSOR_NOT`* |
|
||||
| enum |***`cudnnReduceTensorOp_t`*** | 7.5 |***`hipdnnReduceTensorOp_t`*** |
|
||||
| 0 |*`CUDNN_REDUCE_TENSOR_ADD`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_ADD`* |
|
||||
| 1 |*`CUDNN_REDUCE_TENSOR_MUL`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_MUL`* |
|
||||
| 2 |*`CUDNN_REDUCE_TENSOR_MIN`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_MIN`* |
|
||||
| 3 |*`CUDNN_REDUCE_TENSOR_MAX`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_MAX`* |
|
||||
| 4 |*`CUDNN_REDUCE_TENSOR_AMAX`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_AMAX`* |
|
||||
| 5 |*`CUDNN_REDUCE_TENSOR_AVG`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_AVG`* |
|
||||
| 6 |*`CUDNN_REDUCE_TENSOR_NORM1`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_NORM1`* |
|
||||
| 7 |*`CUDNN_REDUCE_TENSOR_NORM2`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_NORM2`* |
|
||||
| 8 |*`CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS`* | 8.0 |*`HIPDNN_REDUCE_TENSOR_MUL_NO_ZEROS`* |
|
||||
| enum |***`cudnnReduceTensorIndices_t`*** | 7.5 |***`hipdnnReduceTensorIndices_t`*** |
|
||||
| 0 |*`CUDNN_REDUCE_TENSOR_NO_INDICES`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_NO_INDICES`* |
|
||||
| 1 |*`CUDNN_REDUCE_TENSOR_FLATTENED_INDICES`* | 7.5 |*`HIPDNN_REDUCE_TENSOR_FLATTENED_INDICES`* |
|
||||
| enum |***`cudnnIndicesType_t`*** | 7.5 |***`hipdnnIndicesType_t`*** |
|
||||
| 0 |*`CUDNN_32BIT_INDICES`* | 7.5 |*`HIPDNN_32BIT_INDICES`* |
|
||||
| 1 |*`CUDNN_64BIT_INDICES`* | 7.5 |*`HIPDNN_64BIT_INDICES`* |
|
||||
| 2 |*`CUDNN_16BIT_INDICES`* | 7.5 |*`HIPDNN_16BIT_INDICES`* |
|
||||
| 3 |*`CUDNN_8BIT_INDICES`* | 7.5 |*`HIPDNN_8BIT_INDICES`* |
|
||||
| enum |***`cudnnConvolutionMode_t`*** | |***`hipdnnConvolutionMode_t`*** |
|
||||
| 0 |*`CUDNN_CONVOLUTION`* | |*`HIPDNN_CONVOLUTION`* |
|
||||
| 1 |*`CUDNN_CROSS_CORRELATION`* | |*`HIPDNN_CROSS_CORRELATION`* |
|
||||
| enum |***`cudnnConvolutionFwdPreference_t`*** | |***`hipdnnConvolutionFwdPreference_t`*** |
|
||||
| 0 |*`CUDNN_CONVOLUTION_FWD_NO_WORKSPACE`* | |*`HIPDNN_CONVOLUTION_FWD_NO_WORKSPACE`* |
|
||||
| 1 |*`CUDNN_CONVOLUTION_FWD_PREFER_FASTEST`* | |*`HIPDNN_CONVOLUTION_FWD_PREFER_FASTEST`* |
|
||||
| 2 |*`CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT`* | |*`HIPDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT`* |
|
||||
| enum |***`cudnnConvolutionFwdAlgo_t`*** | |***`hipdnnConvolutionFwdAlgo_t`*** |
|
||||
| 0 |*`CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM`* |
|
||||
| 1 |*`CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM`* |
|
||||
| 2 |*`CUDNN_CONVOLUTION_FWD_ALGO_GEMM`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_GEMM`* |
|
||||
| 3 |*`CUDNN_CONVOLUTION_FWD_ALGO_DIRECT`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_DIRECT`* |
|
||||
| 4 |*`CUDNN_CONVOLUTION_FWD_ALGO_FFT`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_FFT`* |
|
||||
| 5 |*`CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING`* | |*`HIPDNN_CONVOLUTION_FWD_ALGO_FFT_TILING`* |
|
||||
| 6 |*`CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD`* | 7.5 |*`HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD`* |
|
||||
| 7 |*`CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED`* | 7.5 |*`HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED`* |
|
||||
| 8 |*`CUDNN_CONVOLUTION_FWD_ALGO_COUNT`* | 7.5 |*`HIPDNN_CONVOLUTION_FWD_ALGO_COUNT`* |
|
||||
| struct |`cudnnConvolutionFwdAlgoPerf_t` | |`hipdnnConvolutionFwdAlgoPerf_t` |
|
||||
| enum |***`cudnnConvolutionBwdFilterPreference_t`*** | |***`hipdnnConvolutionBwdFilterPreference_t`*** |
|
||||
| 0 |*`CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE`* |
|
||||
| 1 |*`CUDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_PREFER_FASTEST`* |
|
||||
| 2 |*`CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT`* |
|
||||
| enum |***`cudnnConvolutionBwdFilterAlgo_t`*** | |***`hipdnnConvolutionBwdFilterAlgo_t`*** |
|
||||
| 0 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_0`* |
|
||||
| 1 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_1`* |
|
||||
| 2 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT`* |
|
||||
| 3 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3`* | |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_3`* |
|
||||
| 4 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD`* |
|
||||
| 5 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED`* |
|
||||
| 6 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING`* |
|
||||
| 7 |*`CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT`* | 7.5 |*`HIPDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT`* |
|
||||
| struct |`cudnnConvolutionBwdDataAlgoPerf_t` | |`hipdnnConvolutionBwdDataAlgoPerf_t` |
|
||||
| enum |***`cudnnSoftmaxAlgorithm_t`*** | |***`hipdnnSoftmaxAlgorithm_t`*** |
|
||||
| 0 |*`CUDNN_SOFTMAX_FAST`* | |*`HIPDNN_SOFTMAX_FAST`* |
|
||||
| 1 |*`CUDNN_SOFTMAX_ACCURATE`* | |*`HIPDNN_SOFTMAX_ACCURATE`* |
|
||||
| 2 |*`CUDNN_SOFTMAX_LOG`* | |*`HIPDNN_SOFTMAX_LOG`* |
|
||||
| enum |***`cudnnSoftmaxMode_t`*** | |***`hipdnnSoftmaxMode_t`*** |
|
||||
| 0 |*`CUDNN_SOFTMAX_MODE_INSTANCE`* | |*`HIPDNN_SOFTMAX_MODE_INSTANCE`* |
|
||||
| 1 |*`CUDNN_SOFTMAX_MODE_CHANNEL`* | |*`HIPDNN_SOFTMAX_MODE_CHANNEL`* |
|
||||
| enum |***`cudnnPoolingMode_t`*** | |***`hipdnnPoolingMode_t`*** |
|
||||
| 0 |*`CUDNN_POOLING_MAX`* | |*`HIPDNN_POOLING_MAX`* |
|
||||
| 1 |*`CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING`* | |*`HIPDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING`* |
|
||||
| 2 |*`CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING`* | |*`HIPDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING`* |
|
||||
| 3 |*`CUDNN_POOLING_MAX_DETERMINISTIC`* | 7.5 |*`HIPDNN_POOLING_MAX_DETERMINISTIC`* |
|
||||
| enum |***`cudnnActivationMode_t`*** | |***`hipdnnActivationMode_t`*** |
|
||||
| 0 |*`CUDNN_ACTIVATION_SIGMOID`* | |*`HIPDNN_ACTIVATION_SIGMOID`* |
|
||||
| 1 |*`CUDNN_ACTIVATION_RELU`* | |*`HIPDNN_ACTIVATION_RELU`* |
|
||||
| 2 |*`CUDNN_ACTIVATION_TANH`* | |*`HIPDNN_ACTIVATION_TANH`* |
|
||||
| 3 |*`CUDNN_ACTIVATION_CLIPPED_RELU`* | |*`HIPDNN_ACTIVATION_CLIPPED_RELU`* |
|
||||
| 4 |*`CUDNN_ACTIVATION_ELU`* | 7.5 |*`HIPDNN_ACTIVATION_ELU`* |
|
||||
| 5 |*`CUDNN_ACTIVATION_IDENTITY`* | 8.0 |*`HIPDNN_ACTIVATION_PATHTRU`* |
|
||||
| define |`CUDNN_LRN_MIN_N` | | |
|
||||
| define |`CUDNN_LRN_MAX_N` | | |
|
||||
| define |`CUDNN_LRN_MIN_K` | | |
|
||||
| define |`CUDNN_LRN_MIN_BETA` | | |
|
||||
| enum |***`cudnnLRNMode_t`*** | |***`hipdnnLRNMode_t`*** |
|
||||
| 0 |*`CUDNN_LRN_CROSS_CHANNEL_DIM1`* | |*`HIPDNN_LRN_CROSS_CHANNEL`* |
|
||||
| enum |***`cudnnDivNormMode_t`*** | | |
|
||||
| 0 |*`CUDNN_DIVNORM_PRECOMPUTED_MEANS`* | | |
|
||||
| enum |***`cudnnBatchNormMode_t`*** | |***`hipdnnBatchNormMode_t`*** |
|
||||
| 0 |*`CUDNN_BATCHNORM_PER_ACTIVATION`* | |*`HIPDNN_BATCHNORM_PER_ACTIVATION`* |
|
||||
| 1 |*`CUDNN_BATCHNORM_SPATIAL`* | |*`HIPDNN_BATCHNORM_SPATIAL`* |
|
||||
| 2 |*`CUDNN_BATCHNORM_SPATIAL_PERSISTENT`* | 8.0 |*`HIPDNN_BATCHNORM_SPATIAL_PERSISTENT`* |
|
||||
| define |`CUDNN_BN_MIN_EPSILON` | |`HIPDNN_BN_MIN_EPSILON` |
|
||||
| enum |***`cudnnSamplerType_t`*** | 7.5 | |
|
||||
| 0 |*`CUDNN_SAMPLER_BILINEAR`* | 7.5 | |
|
||||
| struct |`cudnnDropoutStruct` | 7.5 | |
|
||||
| struct* |`cudnnDropoutDescriptor_t` | 7.5 |`hipdnnDropoutDescriptor_t` |
|
||||
| enum |***`cudnnRNNMode_t`*** | 7.5 |***`hipdnnRNNMode_t`*** |
|
||||
| 0 |*`CUDNN_RNN_RELU`* | 7.5 |*`HIPDNN_RNN_RELU`* |
|
||||
| 1 |*`CUDNN_RNN_TANH`* | 7.5 |*`HIPDNN_RNN_TANH`* |
|
||||
| 2 |*`CUDNN_LSTM`* | 7.5 |*`HIPDNN_LSTM`* |
|
||||
| 3 |*`CUDNN_GRU`* | 7.5 |*`HIPDNN_GRU`* |
|
||||
| enum |***`cudnnRNNBiasMode_t`*** | 9.0 |***`hipdnnRNNBiasMode_t`*** |
|
||||
| 0 |*`CUDNN_RNN_NO_BIAS`* | 9.0 |*`HIPDNN_RNN_NO_BIAS`* |
|
||||
| 1 |*`CUDNN_RNN_SINGLE_INP_BIAS`* | 9.0 |*`HIPDNN_RNN_WITH_BIAS`* |
|
||||
| 2 |*`CUDNN_RNN_DOUBLE_BIAS`* | 9.0 |*`HIPDNN_RNN_WITH_BIAS`* | 1 |
|
||||
| 3 |*`CUDNN_RNN_SINGLE_REC_BIAS`* | 9.0 |*`HIPDNN_RNN_WITH_BIAS`* | 1 |
|
||||
| enum |***`cudnnDirectionMode_t`*** | 7.5 |***`hipdnnDirectionMode_t`*** |
|
||||
| 0 |*`CUDNN_UNIDIRECTIONAL`* | 7.5 |*`HIPDNN_UNIDIRECTIONAL`* |
|
||||
| 1 |*`CUDNN_BIDIRECTIONAL`* | 7.5 |*`HIPDNN_BIDIRECTIONAL`* |
|
||||
| enum |***`cudnnRNNAlgo_t`*** | 7.5 |***`hipdnnRNNAlgo_t`*** |
|
||||
| 0 |*`CUDNN_RNN_ALGO_STANDARD`* | 7.5 |*`HIPDNN_RNN_ALGO_STANDARD`* |
|
||||
| 1 |*`CUDNN_RNN_ALGO_PERSIST_STATIC`* | 7.5 |*`HIPDNN_RNN_ALGO_PERSIST_STATIC`* |
|
||||
| 2 |*`CUDNN_RNN_ALGO_PERSIST_DYNAMIC`* | 7.5 |*`HIPDNN_RNN_ALGO_PERSIST_DYNAMIC`* |
|
||||
| 3 |*`CUDNN_RNN_ALGO_COUNT`* | 8.0 | |
|
||||
| struct |`cudnnAlgorithmStruct` | 8.0 | |
|
||||
| struct* |`cudnnAlgorithmDescriptor_t` | 8.0 | |
|
||||
| struct |`cudnnAlgorithmPerformanceStruct` | 8.0 | |
|
||||
| struct* |`cudnnAlgorithmPerformance_t` | 8.0 | |
|
||||
| struct |`cudnnRNNStruct` | 7.5 | |
|
||||
| struct* |`cudnnRNNDescriptor_t` | 7.5 |`hipdnnRNNDescriptor_t` |
|
||||
| struct |`cudnnPersistentRNNPlan` | 7.5 | |
|
||||
| struct* |`cudnnPersistentRNNPlan_t` | 7.5 |`hipdnnPersistentRNNPlan_t` |
|
||||
| enum |***`cudnnCTCLossAlgo_t`*** | 8.0 | |
|
||||
| 0 |*`CUDNN_CTC_LOSS_ALGO_DETERMINISTIC`* | 8.0 | |
|
||||
| 1 |*`CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC`* | 8.0 | |
|
||||
| struct |`cudnnAlgorithm_t` | 8.0 | |
|
||||
| enum |***`cudnnSeverity_t`*** | 8.0 | |
|
||||
| 0 |*`CUDNN_SEV_FATAL`* | 8.0 | |
|
||||
| 1 |*`CUDNN_SEV_ERROR`* | 8.0 | |
|
||||
| 2 |*`CUDNN_SEV_WARNING`* | 8.0 | |
|
||||
| 3 |*`CUDNN_SEV_INFO`* | 8.0 | |
|
||||
| define |`CUDNN_SEV_ERROR_EN` | 8.0 | |
|
||||
| define |`CUDNN_SEV_WARNING_EN` | 8.0 | |
|
||||
| define |`CUDNN_SEV_INFO_EN` | 8.0 | |
|
||||
| struct |`cudnnDebug_t` | 8.0 | |
|
||||
| struct |`cudnnCallback_t` | 8.0 | |
|
||||
| enum |***`cudnnBatchNormOps_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_BATCHNORM_OPS_BN`* | 9.0 | |
|
||||
| 1 |*`CUDNN_BATCHNORM_OPS_BN_ACTIVATION`* | 9.0 | |
|
||||
| 2 |*`CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION`* | 9.0 | |
|
||||
| enum |***`cudnnRNNClipMode_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_RNN_CLIP_NONE`* | 9.0 | |
|
||||
| 1 |*`CUDNN_RNN_CLIP_MINMAX`* | 9.0 | |
|
||||
| struct |`cudnnRNNDataStruct` | 9.0 | |
|
||||
| struct* |`cudnnRNNDataDescriptor_t` | 9.0 | |
|
||||
| enum |***`cudnnRNNDataLayout_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED`* | 9.0 | |
|
||||
| 1 |*`CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED`* | 9.0 | |
|
||||
| 2 |*`CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED`* | 9.0 | |
|
||||
| enum |***`cudnnRNNPaddingMode_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_RNN_PADDED_IO_DISABLED`* | 9.0 | |
|
||||
| 1 |*`CUDNN_RNN_PADDED_IO_ENABLED`* | 9.0 | |
|
||||
| enum |***`cudnnSeqDataAxis_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_SEQDATA_TIME_DIM`* | 9.0 | |
|
||||
| 1 |*`CUDNN_SEQDATA_BATCH_DIM`* | 9.0 | |
|
||||
| 2 |*`CUDNN_SEQDATA_BEAM_DIM`* | 9.0 | |
|
||||
| 3 |*`CUDNN_SEQDATA_VECT_DIM`* | 9.0 | |
|
||||
| define |`CUDNN_SEQDATA_DIM_COUNT` | 9.0 | |
|
||||
| struct |`cudnnSeqDataStruct` | 9.0 | |
|
||||
| struct* |`cudnnSeqDataDescriptor_t` | 9.0 | |
|
||||
| unsigned |***`cudnnAttnQueryMap_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_ATTN_QUERYMAP_ALL_TO_ONE`* | 9.0 | |
|
||||
| 1U << 0 |*`CUDNN_ATTN_QUERYMAP_ONE_TO_ONE`* | 9.0 | |
|
||||
| 1 |*`CUDNN_ATTN_DISABLE_PROJ_BIASES`* | 10.1 Update 2 | |
|
||||
| 1U << 1 |*`CUDNN_ATTN_ENABLE_PROJ_BIASES`* | 10.1 Update 2 | |
|
||||
| struct |`cudnnAttnStruct` | 9.0 | |
|
||||
| struct* |`cudnnAttnDescriptor_t` | 9.0 | |
|
||||
| enum |***`cudnnMultiHeadAttnWeightKind_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_MH_ATTN_Q_WEIGHTS`* | 9.0 | |
|
||||
| 1 |*`CUDNN_MH_ATTN_K_WEIGHTS`* | 9.0 | |
|
||||
| 2 |*`CUDNN_MH_ATTN_V_WEIGHTS`* | 9.0 | |
|
||||
| 3 |*`CUDNN_MH_ATTN_O_WEIGHTS`* | 9.0 | |
|
||||
| 4 |*`CUDNN_MH_ATTN_Q_BIASES`* | 10.1 Update 2 | |
|
||||
| 5 |*`CUDNN_MH_ATTN_K_BIASES`* | 10.1 Update 2 | |
|
||||
| 6 |*`CUDNN_MH_ATTN_V_BIASES`* | 10.1 Update 2 | |
|
||||
| 7 |*`CUDNN_MH_ATTN_O_BIASES`* | 10.1 Update 2 | |
|
||||
| define 8 |`CUDNN_ATTN_WKIND_COUNT` | 10.1 Update 2 | |
|
||||
| enum |***`cudnnWgradMode_t`*** | 9.0 | |
|
||||
| 0 |*`CUDNN_WGRAD_MODE_ADD`* | 9.0 | |
|
||||
| 1 |*`CUDNN_WGRAD_MODE_SET`* | 9.0 | |
|
||||
| enum |***`cudnnReorderType_t`*** | 10.1 | |
|
||||
| 0 |*`CUDNN_DEFAULT_REORDER`* | 10.1 | |
|
||||
| 1 |*`CUDNN_NO_REORDER`* | 10.1 | |
|
||||
| enum |***`cudnnLossNormalizationMode_t`*** | 10.1 | |
|
||||
| 0 |*`CUDNN_LOSS_NORMALIZATION_NONE`* | 10.1 | |
|
||||
| 1 |*`CUDNN_LOSS_NORMALIZATION_SOFTMAX`* | 10.1 | |
|
||||
| struct |`cudnnFusedOpsConstParamStruct` | 10.1 | |
|
||||
| struct* |`cudnnFusedOpsConstParamPack_t` | 10.1 | |
|
||||
| struct |`cudnnFusedOpsVariantParamStruct` | 10.1 | |
|
||||
| struct* |`cudnnFusedOpsVariantParamPack_t` | 10.1 | |
|
||||
| struct |`cudnnFusedOpsPlanStruct` | 10.1 | |
|
||||
| struct* |`cudnnFusedOpsPlan_t` | 10.1 | |
|
||||
| enum |***`cudnnFusedOps_t`*** | 10.1 | |
|
||||
| 0 |*`CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS`* | 10.1 | |
|
||||
| 1 |*`CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD`* | 10.1 | |
|
||||
| 2 |*`CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING`* | 10.1 | |
|
||||
| 3 |*`CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE`* | 10.1 | |
|
||||
| 4 |*`CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION`* | 10.1 | |
|
||||
| 5 |*`CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK`* | 10.1 | |
|
||||
| 6 |*`CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM`* | 10.1 | |
|
||||
| enum |***`cudnnFusedOpsConstParamLabel_t`*** | 10.1 | |
|
||||
| 0 |*`CUDNN_PARAM_XDESC`* | 10.1 | |
|
||||
| 1 |*`CUDNN_PARAM_XDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 2 |*`CUDNN_PARAM_BN_MODE`* | 10.1 | |
|
||||
| 3 |*`CUDNN_PARAM_BN_EQSCALEBIAS_DESC`* | 10.1 | |
|
||||
| 4 |*`CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER`* | 10.1 | |
|
||||
| 5 |*`CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER`* | 10.1 | |
|
||||
| 6 |*`CUDNN_PARAM_ACTIVATION_DESC`* | 10.1 | |
|
||||
| 7 |*`CUDNN_PARAM_CONV_DESC`* | 10.1 | |
|
||||
| 8 |*`CUDNN_PARAM_WDESC`* | 10.1 | |
|
||||
| 9 |*`CUDNN_PARAM_WDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 10 |*`CUDNN_PARAM_DWDESC`* | 10.1 | |
|
||||
| 11 |*`CUDNN_PARAM_DWDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 12 |*`CUDNN_PARAM_YDESC`* | 10.1 | |
|
||||
| 13 |*`CUDNN_PARAM_YDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 14 |*`CUDNN_PARAM_DYDESC`* | 10.1 | |
|
||||
| 15 |*`CUDNN_PARAM_DYDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 16 |*`CUDNN_PARAM_YSTATS_DESC`* | 10.1 | |
|
||||
| 17 |*`CUDNN_PARAM_YSUM_PLACEHOLDER`* | 10.1 | |
|
||||
| 18 |*`CUDNN_PARAM_YSQSUM_PLACEHOLDER`* | 10.1 | |
|
||||
| 19 |*`CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC`* | 10.1 | |
|
||||
| 20 |*`CUDNN_PARAM_BN_SCALE_PLACEHOLDER`* | 10.1 | |
|
||||
| 21 |*`CUDNN_PARAM_BN_BIAS_PLACEHOLDER`* | 10.1 | |
|
||||
| 22 |*`CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER`* | 10.1 | |
|
||||
| 23 |*`CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER`* | 10.1 | |
|
||||
| 24 |*`CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER`* | 10.1 | |
|
||||
| 25 |*`CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER`* | 10.1 | |
|
||||
| 26 |*`CUDNN_PARAM_ZDESC`* | 10.1 | |
|
||||
| 27 |*`CUDNN_PARAM_ZDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 28 |*`CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC`* | 10.1 | |
|
||||
| 29 |*`CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER`* | 10.1 | |
|
||||
| 30 |*`CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER`* | 10.1 | |
|
||||
| 31 |*`CUDNN_PARAM_ACTIVATION_BITMASK_DESC`* | 10.1 | |
|
||||
| 32 |*`CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER`* | 10.1 | |
|
||||
| 33 |*`CUDNN_PARAM_DXDESC`* | 10.1 | |
|
||||
| 34 |*`CUDNN_PARAM_DXDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 35 |*`CUDNN_PARAM_DZDESC`* | 10.1 | |
|
||||
| 36 |*`CUDNN_PARAM_DZDATA_PLACEHOLDER`* | 10.1 | |
|
||||
| 37 |*`CUDNN_PARAM_BN_DSCALE_PLACEHOLDER`* | 10.1 | |
|
||||
| 38 |*`CUDNN_PARAM_BN_DBIAS_PLACEHOLDER`* | 10.1 | |
|
||||
| enum |***`cudnnFusedOpsPointerPlaceHolder_t`*** | 10.1 | |
|
||||
| 0 |*`CUDNN_PTR_NULL`* | 10.1 | |
|
||||
| 1 |*`CUDNN_PTR_ELEM_ALIGNED`* | 10.1 | |
|
||||
| 2 |*`CUDNN_PTR_16B_ALIGNED`* | 10.1 | |
|
||||
| enum |***`cudnnFusedOpsVariantParamLabel_t`*** | 10.1 | |
|
||||
| 0 |*`CUDNN_PTR_XDATA`* | 10.1 | |
|
||||
| 1 |*`CUDNN_PTR_BN_EQSCALE`* | 10.1 | |
|
||||
| 2 |*`CUDNN_PTR_BN_EQBIAS`* | 10.1 | |
|
||||
| 3 |*`CUDNN_PTR_WDATA`* | 10.1 | |
|
||||
| 4 |*`CUDNN_PTR_DWDATA`* | 10.1 | |
|
||||
| 5 |*`CUDNN_PTR_YDATA`* | 10.1 | |
|
||||
| 6 |*`CUDNN_PTR_DYDATA`* | 10.1 | |
|
||||
| 7 |*`CUDNN_PTR_YSUM`* | 10.1 | |
|
||||
| 8 |*`CUDNN_PTR_YSQSUM`* | 10.1 | |
|
||||
| 9 |*`CUDNN_PTR_WORKSPACE`* | 10.1 | |
|
||||
| 10 |*`CUDNN_PTR_BN_SCALE`* | 10.1 | |
|
||||
| 11 |*`CUDNN_PTR_BN_BIAS`* | 10.1 | |
|
||||
| 12 |*`CUDNN_PTR_BN_SAVED_MEAN`* | 10.1 | |
|
||||
| 13 |*`CUDNN_PTR_BN_SAVED_INVSTD`* | 10.1 | |
|
||||
| 14 |*`CUDNN_PTR_BN_RUNNING_MEAN`* | 10.1 | |
|
||||
| 15 |*`CUDNN_PTR_BN_RUNNING_VAR`* | 10.1 | |
|
||||
| 16 |*`CUDNN_PTR_ZDATA`* | 10.1 | |
|
||||
| 17 |*`CUDNN_PTR_BN_Z_EQSCALE`* | 10.1 | |
|
||||
| 18 |*`CUDNN_PTR_BN_Z_EQBIAS`* | 10.1 | |
|
||||
| 19 |*`CUDNN_PTR_ACTIVATION_BITMASK`* | 10.1 | |
|
||||
| 20 |*`CUDNN_PTR_DXDATA`* | 10.1 | |
|
||||
| 21 |*`CUDNN_PTR_DZDATA`* | 10.1 | |
|
||||
| 22 |*`CUDNN_PTR_BN_DSCALE`* | 10.1 | |
|
||||
| 23 |*`CUDNN_PTR_BN_DBIAS`* | 10.1 | |
|
||||
| 100 |*`CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES`* | 10.1 | |
|
||||
| 101 |*`CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT`* | 10.1 | |
|
||||
| 102 |*`CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR`* | 10.1 | |
|
||||
| 103 |*`CUDNN_SCALAR_DOUBLE_BN_EPSILON`* | 10.1 | |
|
||||
|
||||
## **2. CUDNN API functions**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:-----------------|
|
||||
|`cudnnGetVersion` |`hipdnnGetVersion` |
|
||||
|`cudnnGetCudartVersion` | | 7.5 |
|
||||
|`cudnnGetErrorString` |`hipdnnGetErrorString` |
|
||||
|`cudnnQueryRuntimeError` | | 8.0 |
|
||||
|`cudnnGetProperty` | | 7.5 |
|
||||
|`cudnnCreate` |`hipdnnCreate` |
|
||||
|`cudnnDestroy` |`hipdnnDestroy` |
|
||||
|`cudnnSetStream` |`hipdnnSetStream` |
|
||||
|`cudnnGetStream` |`hipdnnGetStream` |
|
||||
|`cudnnCreateTensorDescriptor` |`hipdnnCreateTensorDescriptor` |
|
||||
|`cudnnSetTensor4dDescriptor` |`hipdnnSetTensor4dDescriptor` |
|
||||
|`cudnnSetTensor4dDescriptorEx` |`hipdnnSetTensor4dDescriptorEx` |
|
||||
|`cudnnGetTensor4dDescriptor` |`hipdnnGetTensor4dDescriptor` |
|
||||
|`cudnnSetTensorNdDescriptor` |`hipdnnSetTensorNdDescriptor` |
|
||||
|`cudnnSetTensorNdDescriptorEx` | | 7.5 |
|
||||
|`cudnnGetTensorNdDescriptor` |`hipdnnGetTensorNdDescriptor` |
|
||||
|`cudnnGetTensorSizeInBytes` | | 7.5 |
|
||||
|`cudnnDestroyTensorDescriptor` |`hipdnnDestroyTensorDescriptor` |
|
||||
|`cudnnTransformTensor` | |
|
||||
|`cudnnTransformTensorEx` | | 9.0 |
|
||||
|`cudnnInitTransformDest` | | 9.0 |
|
||||
|`cudnnCreateTensorTransformDescriptor` | | 9.0 |
|
||||
|`cudnnSetTensorTransformDescriptor` | | 9.0 |
|
||||
|`cudnnGetTensorTransformDescriptor` | | 9.0 |
|
||||
|`cudnnDestroyTensorTransformDescriptor` | | 9.0 |
|
||||
|`cudnnAddTensor` |`hipdnnAddTensor` |
|
||||
|`cudnnCreateOpTensorDescriptor` |`hipdnnCreateOpTensorDescriptor` | 7.5 |
|
||||
|`cudnnSetOpTensorDescriptor` |`hipdnnSetOpTensorDescriptor` | 7.5 |
|
||||
|`cudnnGetOpTensorDescriptor` |`hipdnnGetOpTensorDescriptor` | 7.5 |
|
||||
|`cudnnDestroyOpTensorDescriptor` |`hipdnnDestroyOpTensorDescriptor` | 7.5 |
|
||||
|`cudnnOpTensor` |`hipdnnOpTensor` | 7.5 |
|
||||
|`cudnnGetFoldedConvBackwardDataDescriptors` | | 10.1 |
|
||||
|`cudnnCreateReduceTensorDescriptor` |`hipdnnCreateReduceTensorDescriptor` | 7.5 |
|
||||
|`cudnnSetReduceTensorDescriptor` |`hipdnnSetReduceTensorDescriptor` | 7.5 |
|
||||
|`cudnnGetReduceTensorDescriptor` |`hipdnnGetReduceTensorDescriptor` | 7.5 |
|
||||
|`cudnnDestroyReduceTensorDescriptor` |`hipdnnDestroyReduceTensorDescriptor` | 7.5 |
|
||||
|`cudnnGetReductionIndicesSize` | | 7.5 |
|
||||
|`cudnnGetReductionWorkspaceSize` |`hipdnnGetReductionWorkspaceSize` | 7.5 |
|
||||
|`cudnnReduceTensor` |`hipdnnReduceTensor` | 7.5 |
|
||||
|`cudnnSetTensor` |`hipdnnSetTensor` |
|
||||
|`cudnnScaleTensor` |`hipdnnScaleTensor` |
|
||||
|`cudnnCreateFilterDescriptor` |`hipdnnCreateFilterDescriptor` |
|
||||
|`cudnnSetFilter4dDescriptor` |`hipdnnSetFilter4dDescriptor` |
|
||||
|`cudnnGetFilter4dDescriptor` |`hipdnnGetFilter4dDescriptor` |
|
||||
|`cudnnSetFilterNdDescriptor` |`hipdnnSetFilterNdDescriptor` |
|
||||
|`cudnnGetFilterNdDescriptor` |`hipdnnGetFilterNdDescriptor` |
|
||||
|`cudnnGetFilterSizeInBytes` | | 10.1 |
|
||||
|`cudnnTransformFilter` | | 10.1 |
|
||||
|`cudnnDestroyFilterDescriptor` |`hipdnnDestroyFilterDescriptor` |
|
||||
|`cudnnReorderFilterAndBias` | | 10.1 |
|
||||
|`cudnnCreateConvolutionDescriptor` |`hipdnnCreateConvolutionDescriptor` |
|
||||
|`cudnnSetConvolutionMathType` |`hipdnnSetConvolutionMathType` | 8.0 |
|
||||
|`cudnnGetConvolutionMathType` | | 8.0 |
|
||||
|`cudnnSetConvolutionGroupCount` |`hipdnnSetConvolutionGroupCount` | 8.0 |
|
||||
|`cudnnGetConvolutionGroupCount` | | 8.0 |
|
||||
|`cudnnSetConvolutionReorderType` | | 10.1 |
|
||||
|`cudnnGetConvolutionReorderType` | | 10.1 |
|
||||
|`cudnnSetConvolution2dDescriptor` |`hipdnnSetConvolution2dDescriptor` |
|
||||
|`cudnnGetConvolution2dDescriptor` |`hipdnnGetConvolution2dDescriptor` |
|
||||
|`cudnnGetConvolution2dForwardOutputDim` |`hipdnnGetConvolution2dForwardOutputDim` |
|
||||
|`cudnnSetConvolutionNdDescriptor` |`hipdnnSetConvolutionNdDescriptor` |
|
||||
|`cudnnGetConvolutionNdDescriptor` | |
|
||||
|`cudnnGetConvolutionNdForwardOutputDim` | |
|
||||
|`cudnnDestroyConvolutionDescriptor` | |
|
||||
|`cudnnGetConvolutionForwardAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindConvolutionForwardAlgorithm` |`hipdnnFindConvolutionForwardAlgorithm` |
|
||||
|`cudnnFindConvolutionForwardAlgorithmEx` |`hipdnnFindConvolutionForwardAlgorithmEx` | 7.5 |
|
||||
|`cudnnGetConvolutionForwardAlgorithm` |`hipdnnGetConvolutionForwardAlgorithm` |
|
||||
|`cudnnGetConvolutionForwardAlgorithm_v7` | | 8.0 |
|
||||
|`cudnnGetConvolutionForwardWorkspaceSize` |`hipdnnGetConvolutionForwardWorkspaceSize` |
|
||||
|`cudnnConvolutionForward` |`hipdnnConvolutionForward` |
|
||||
|`cudnnConvolutionBiasActivationForward` | | 7.5 |
|
||||
|`cudnnConvolutionBackwardBias` |`hipdnnConvolutionBackwardBias` |
|
||||
|`cudnnGetConvolutionBackwardFilterAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindConvolutionBackwardFilterAlgorithm` |`hipdnnFindConvolutionBackwardFilterAlgorithm` |
|
||||
|`cudnnFindConvolutionBackwardFilterAlgorithmEx` |`hipdnnFindConvolutionBackwardFilterAlgorithmEx` | 7.5 |
|
||||
|`cudnnGetConvolutionBackwardFilterAlgorithm` |`hipdnnGetConvolutionBackwardFilterAlgorithm` |
|
||||
|`cudnnGetConvolutionBackwardFilterAlgorithm_v7` | | 8.0 |
|
||||
|`cudnnGetConvolutionBackwardFilterWorkspaceSize` |`hipdnnGetConvolutionBackwardFilterWorkspaceSize`|
|
||||
|`cudnnConvolutionBackwardFilter` |`hipdnnConvolutionBackwardFilter` |
|
||||
|`cudnnGetConvolutionBackwardDataAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindConvolutionBackwardDataAlgorithm` |`hipdnnFindConvolutionBackwardDataAlgorithm` |
|
||||
|`cudnnFindConvolutionBackwardDataAlgorithmEx` |`hipdnnFindConvolutionBackwardDataAlgorithmEx` | 7.5 |
|
||||
|`cudnnGetConvolutionBackwardDataAlgorithm` |`hipdnnGetConvolutionBackwardDataAlgorithm` |
|
||||
|`cudnnGetConvolutionBackwardDataAlgorithm_v7` | | 8.0 |
|
||||
|`cudnnGetConvolutionBackwardDataWorkspaceSize` |`hipdnnGetConvolutionBackwardDataWorkspaceSize` |
|
||||
|`cudnnConvolutionBackwardData` |`hipdnnConvolutionBackwardData` |
|
||||
|`cudnnIm2Col` | |
|
||||
|`cudnnSoftmaxForward` |`hipdnnSoftmaxForward` |
|
||||
|`cudnnSoftmaxBackward` |`hipdnnSoftmaxBackward` |
|
||||
|`cudnnCreatePoolingDescriptor` |`hipdnnCreatePoolingDescriptor` |
|
||||
|`cudnnSetPooling2dDescriptor` |`hipdnnSetPooling2dDescriptor` |
|
||||
|`cudnnGetPooling2dDescriptor` |`hipdnnGetPooling2dDescriptor` |
|
||||
|`cudnnSetPoolingNdDescriptor` |`hipdnnSetPoolingNdDescriptor` |
|
||||
|`cudnnGetPoolingNdDescriptor` | |
|
||||
|`cudnnGetPoolingNdForwardOutputDim` | |
|
||||
|`cudnnGetPooling2dForwardOutputDim` |`hipdnnGetPooling2dForwardOutputDim` |
|
||||
|`cudnnDestroyPoolingDescriptor` |`hipdnnDestroyPoolingDescriptor` |
|
||||
|`cudnnPoolingForward` |`hipdnnPoolingForward` |
|
||||
|`cudnnPoolingBackward` |`hipdnnPoolingBackward` |
|
||||
|`cudnnCreateActivationDescriptor` |`hipdnnCreateActivationDescriptor` |
|
||||
|`cudnnSetActivationDescriptor` |`hipdnnSetActivationDescriptor` |
|
||||
|`cudnnGetActivationDescriptor` |`hipdnnGetActivationDescriptor` |
|
||||
|`cudnnDestroyActivationDescriptor` |`hipdnnDestroyActivationDescriptor` |
|
||||
|`cudnnActivationForward` |`hipdnnActivationForward` |
|
||||
|`cudnnActivationBackward` |`hipdnnActivationBackward` |
|
||||
|`cudnnCreateLRNDescriptor` |`hipdnnCreateLRNDescriptor` |
|
||||
|`cudnnSetLRNDescriptor` |`hipdnnSetLRNDescriptor` |
|
||||
|`cudnnGetLRNDescriptor` |`hipdnnGetLRNDescriptor` |
|
||||
|`cudnnDestroyLRNDescriptor` |`hipdnnDestroyLRNDescriptor` |
|
||||
|`cudnnLRNCrossChannelForward` |`hipdnnLRNCrossChannelForward` |
|
||||
|`cudnnLRNCrossChannelBackward` |`hipdnnLRNCrossChannelBackward` |
|
||||
|`cudnnDivisiveNormalizationForward` | |
|
||||
|`cudnnDivisiveNormalizationBackward` | |
|
||||
|`cudnnDeriveBNTensorDescriptor` |`hipdnnDeriveBNTensorDescriptor` |
|
||||
|`cudnnBatchNormalizationForwardTraining` |`hipdnnBatchNormalizationForwardTraining` |
|
||||
|`cudnnBatchNormalizationForwardTrainingEx` | | 9.0 |
|
||||
|`cudnnBatchNormalizationForwardInference` |`hipdnnBatchNormalizationForwardInference` |
|
||||
|`cudnnBatchNormalizationBackward` |`hipdnnBatchNormalizationBackward` |
|
||||
|`cudnnBatchNormalizationBackwardEx` | | 9.0 |
|
||||
|`cudnnCreateSpatialTransformerDescriptor` | | 7.5 |
|
||||
|`cudnnSetSpatialTransformerNdDescriptor` | | 7.5 |
|
||||
|`cudnnDestroySpatialTransformerDescriptor` | | 7.5 |
|
||||
|`cudnnSpatialTfGridGeneratorForward` | | 7.5 |
|
||||
|`cudnnSpatialTfGridGeneratorBackward` | | 7.5 |
|
||||
|`cudnnSpatialTfSamplerForward` | | 7.5 |
|
||||
|`cudnnSpatialTfSamplerBackward` | | 7.5 |
|
||||
|`cudnnCreateDropoutDescriptor` |`hipdnnCreateDropoutDescriptor` | 7.5 |
|
||||
|`cudnnDestroyDropoutDescriptor` |`hipdnnDestroyDropoutDescriptor` | 7.5 |
|
||||
|`cudnnDropoutGetStatesSize` |`hipdnnDropoutGetStatesSize` | 7.5 |
|
||||
|`cudnnDropoutGetReserveSpaceSize` | | 7.5 |
|
||||
|`cudnnSetDropoutDescriptor` |`hipdnnSetDropoutDescriptor` | 7.5 |
|
||||
|`cudnnGetDropoutDescriptor` | | 8.0 |
|
||||
|`cudnnRestoreDropoutDescriptor` | | 8.0 |
|
||||
|`cudnnDropoutForward` | | 7.5 |
|
||||
|`cudnnDropoutBackward` | | 7.5 |
|
||||
|`cudnnCreateRNNDescriptor` |`hipdnnCreateRNNDescriptor` | 7.5 |
|
||||
|`cudnnDestroyRNNDescriptor` |`hipdnnDestroyRNNDescriptor` | 7.5 |
|
||||
|`cudnnGetRNNForwardInferenceAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindRNNForwardInferenceAlgorithmEx` | | 8.0 |
|
||||
|`cudnnGetRNNForwardTrainingAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindRNNForwardTrainingAlgorithmEx` | | 8.0 |
|
||||
|`cudnnGetRNNBackwardDataAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindRNNBackwardDataAlgorithmEx` | | 8.0 |
|
||||
|`cudnnGetRNNBackwardWeightsAlgorithmMaxCount` | | 8.0 |
|
||||
|`cudnnFindRNNBackwardWeightsAlgorithmEx` | | 8.0 |
|
||||
|`cudnnCreatePersistentRNNPlan` |`hipdnnCreatePersistentRNNPlan` | 7.5 |
|
||||
|`cudnnSetPersistentRNNPlan` |`hipdnnSetPersistentRNNPlan` | 7.5 |
|
||||
|`cudnnDestroyPersistentRNNPlan` |`hipdnnDestroyPersistentRNNPlan` | 7.5 |
|
||||
|`cudnnSetRNNDescriptor` |`hipdnnSetRNNDescriptor` | 7.5 |
|
||||
|`cudnnGetRNNDescriptor` |`hipdnnGetRNNDescriptor` | 8.0 |
|
||||
|`cudnnSetRNNProjectionLayers` | | 8.0 |
|
||||
|`cudnnGetRNNProjectionLayers` | | 8.0 |
|
||||
|`cudnnSetRNNAlgorithmDescriptor` | | 8.0 |
|
||||
|`cudnnSetRNNMatrixMathType` | | 8.0 |
|
||||
|`cudnnGetRNNMatrixMathType` | | 8.0 |
|
||||
|`cudnnGetRNNWorkspaceSize` |`hipdnnGetRNNWorkspaceSize` | 7.5 |
|
||||
|`cudnnGetRNNTrainingReserveSize` |`hipdnnGetRNNTrainingReserveSize` | 7.5 |
|
||||
|`cudnnGetRNNParamsSize` |`hipdnnGetRNNParamsSize` | 7.5 |
|
||||
|`cudnnGetRNNLinLayerMatrixParams` |`hipdnnGetRNNLinLayerMatrixParams` | 7.5 |
|
||||
|`cudnnGetRNNLinLayerBiasParams` |`hipdnnGetRNNLinLayerBiasParams` | 7.5 |
|
||||
|`cudnnRNNForwardInference` |`hipdnnRNNForwardInference` | 7.5 |
|
||||
|`cudnnRNNForwardInferenceEx` | | 9.0 |
|
||||
|`cudnnRNNForwardTraining` |`hipdnnRNNForwardTraining` | 7.5 |
|
||||
|`cudnnRNNForwardTrainingEx` | | 9.0 |
|
||||
|`cudnnRNNBackwardData` |`hipdnnRNNBackwardData` | 7.5 |
|
||||
|`cudnnRNNBackwardDataEx` | | 9.0 |
|
||||
|`cudnnRNNBackwardWeights` |`hipdnnRNNBackwardWeights` | 7.5 |
|
||||
|`cudnnRNNBackwardWeightsEx` | | 9.0 |
|
||||
|`cudnnSetRNNPaddingMode` | | 9.0 |
|
||||
|`cudnnGetRNNPaddingMode` | | 9.0 |
|
||||
|`cudnnCreateRNNDataDescriptor` | | 9.0 |
|
||||
|`cudnnDestroyRNNDataDescriptor` | | 9.0 |
|
||||
|`cudnnSetRNNDataDescriptor` | | 9.0 |
|
||||
|`cudnnGetRNNDataDescriptor` | | 9.0 |
|
||||
|`cudnnSetRNNBiasMode` | | 9.0 |
|
||||
|`cudnnGetRNNBiasMode` | | 9.0 |
|
||||
|`cudnnCreateCTCLossDescriptor` | | 8.0 |
|
||||
|`cudnnSetCTCLossDescriptor` | | 8.0 |
|
||||
|`cudnnSetCTCLossDescriptorEx` | | 10.1 |
|
||||
|`cudnnGetCTCLossDescriptor` | | 8.0 |
|
||||
|`cudnnGetCTCLossDescriptorEx` | | 10.1 |
|
||||
|`cudnnDestroyCTCLossDescriptor` | | 8.0 |
|
||||
|`cudnnCTCLoss` | | 8.0 |
|
||||
|`cudnnGetCTCLossWorkspaceSize` | | 8.0 |
|
||||
|`cudnnCreateAlgorithmDescriptor` | | 8.0 |
|
||||
|`cudnnSetAlgorithmDescriptor` | | 8.0 |
|
||||
|`cudnnGetAlgorithmDescriptor` | | 8.0 |
|
||||
|`cudnnCopyAlgorithmDescriptor` | | 8.0 |
|
||||
|`cudnnDestroyAlgorithmDescriptor` | | 8.0 |
|
||||
|`cudnnCreateAlgorithmPerformance` | | 8.0 |
|
||||
|`cudnnSetAlgorithmPerformance` | | 8.0 |
|
||||
|`cudnnGetAlgorithmPerformance` | | 8.0 |
|
||||
|`cudnnDestroyAlgorithmPerformance` | | 8.0 |
|
||||
|`cudnnGetAlgorithmSpaceSize` | | 8.0 |
|
||||
|`cudnnSaveAlgorithm` | | 8.0 |
|
||||
|`cudnnRestoreAlgorithm` | | 8.0 |
|
||||
|`cudnnSetRNNDescriptor_v5` |`hipdnnSetRNNDescriptor_v5` | 8.0 |
|
||||
|`cudnnSetRNNDescriptor_v6` |`hipdnnSetRNNDescriptor_v6` | 7.5 |
|
||||
|`cudnnSetCallback` | | 8.0 |
|
||||
|`cudnnGetCallback` | | 8.0 |
|
||||
|`cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize` | | 9.0 |
|
||||
|`cudnnGetBatchNormalizationBackwardExWorkspaceSize` | | 9.0 |
|
||||
|`cudnnGetBatchNormalizationTrainingExReserveSpaceSize` | | 9.0 |
|
||||
|`cudnnRNNSetClip` | | 9.0 |
|
||||
|`cudnnRNNGetClip` | | 9.0 |
|
||||
|`cudnnCreateSeqDataDescriptor` | | 9.0 |
|
||||
|`cudnnDestroySeqDataDescriptor` | | 9.0 |
|
||||
|`cudnnSetSeqDataDescriptor` | | 9.0 |
|
||||
|`cudnnGetSeqDataDescriptor` | | 9.0 |
|
||||
|`cudnnCreateAttnDescriptor` | | 9.0 |
|
||||
|`cudnnDestroyAttnDescriptor` | | 9.0 |
|
||||
|`cudnnSetAttnDescriptor` | | 9.0 |
|
||||
|`cudnnGetAttnDescriptor` | | 9.0 |
|
||||
|`cudnnGetMultiHeadAttnBuffers` | | 9.0 |
|
||||
|`cudnnGetMultiHeadAttnWeights` | | 9.0 |
|
||||
|`cudnnMultiHeadAttnForward` | | 9.0 |
|
||||
|`cudnnMultiHeadAttnBackwardData` | | 9.0 |
|
||||
|`cudnnMultiHeadAttnBackwardWeights` | | 9.0 |
|
||||
|`cudnnCreateFusedOpsConstParamPack` | | 10.1 |
|
||||
|`cudnnDestroyFusedOpsConstParamPack` | | 10.1 |
|
||||
|`cudnnSetFusedOpsConstParamPackAttribute` | | 10.1 |
|
||||
|`cudnnGetFusedOpsConstParamPackAttribute` | | 10.1 |
|
||||
|`cudnnCreateFusedOpsVariantParamPack` | | 10.1 |
|
||||
|`cudnnDestroyFusedOpsVariantParamPack` | | 10.1 |
|
||||
|`cudnnSetFusedOpsVariantParamPackAttribute` | | 10.1 |
|
||||
|`cudnnGetFusedOpsVariantParamPackAttribute` | | 10.1 |
|
||||
|`cudnnCreateFusedOpsPlan` | | 10.1 |
|
||||
|`cudnnDestroyFusedOpsPlan` | | 10.1 |
|
||||
|`cudnnMakeFusedOpsPlan` | | 10.1 |
|
||||
|`cudnnFusedOpsExecute` | | 10.1 |
|
||||
|
||||
\* CUDA version, in which API has appeared and (optional) last version before abandoning it; no value in case of earlier versions < 7.5.
|
||||
@@ -1,81 +0,0 @@
|
||||
# CUFFT API supported by HIP
|
||||
|
||||
## **1. CUFFT Data types**
|
||||
|
||||
| **type** | **CUDA** |**CUDA version\***| **HIP** |**HIP value** (if differs) |
|
||||
|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|---------------------------|
|
||||
| enum |***`cufftResult_t`*** | |***`hipfftResult_t`*** |
|
||||
| enum |***`cufftResult`*** | |***`hipfftResult`*** |
|
||||
| 0x0 |*`CUFFT_SUCCESS`* | |*`HIPFFT_SUCCESS`* | 0 |
|
||||
| 0x1 |*`CUFFT_INVALID_PLAN`* | |*`HIPFFT_INVALID_PLAN`* | 1 |
|
||||
| 0x2 |*`CUFFT_ALLOC_FAILED`* | |*`HIPFFT_ALLOC_FAILED`* | 2 |
|
||||
| 0x3 |*`CUFFT_INVALID_TYPE`* | |*`HIPFFT_INVALID_TYPE`* | 3 |
|
||||
| 0x4 |*`CUFFT_INVALID_VALUE`* | |*`HIPFFT_INVALID_VALUE`* | 4 |
|
||||
| 0x5 |*`CUFFT_INTERNAL_ERROR`* | |*`HIPFFT_INTERNAL_ERROR`* | 5 |
|
||||
| 0x6 |*`CUFFT_EXEC_FAILED`* | |*`HIPFFT_EXEC_FAILED`* | 6 |
|
||||
| 0x7 |*`CUFFT_SETUP_FAILED`* | |*`HIPFFT_SETUP_FAILED`* | 7 |
|
||||
| 0x8 |*`CUFFT_INVALID_SIZE`* | |*`HIPFFT_INVALID_SIZE`* | 8 |
|
||||
| 0x9 |*`CUFFT_UNALIGNED_DATA`* | |*`HIPFFT_UNALIGNED_DATA`* | 9 |
|
||||
| 0xA |*`CUFFT_INCOMPLETE_PARAMETER_LIST`* | |*`HIPFFT_INCOMPLETE_PARAMETER_LIST`* | 10 |
|
||||
| 0xB |*`CUFFT_INVALID_DEVICE`* | |*`HIPFFT_INVALID_DEVICE`* | 11 |
|
||||
| 0xC |*`CUFFT_PARSE_ERROR`* | |*`HIPFFT_PARSE_ERROR`* | 12 |
|
||||
| 0xD |*`CUFFT_NO_WORKSPACE`* | |*`HIPFFT_NO_WORKSPACE`* | 13 |
|
||||
| 0xE |*`CUFFT_NOT_IMPLEMENTED`* | |*`HIPFFT_NOT_IMPLEMENTED`* | 14 |
|
||||
| 0xF |*`CUFFT_LICENSE_ERROR`* | | |
|
||||
| 0x10 |*`CUFFT_NOT_SUPPORTED`* | 8.0 |*`HIPFFT_NOT_SUPPORTED`* | 16 |
|
||||
| float |***`cufftReal`*** | |***`hipfftReal`*** |
|
||||
| double |***`cufftDoubleReal`*** | |***`hipfftDoubleReal`*** |
|
||||
| float2 |***`cufftComplex`*** | |***`hipfftComplex`*** |
|
||||
| double2 |***`cufftDoubleComplex`*** | |***`hipfftDoubleComplex`*** |
|
||||
| define |`CUFFT_FORWARD` | |`HIPFFT_FORWARD` |
|
||||
| define |`CUFFT_INVERSE` | |`HIPFFT_BACKWARD` |
|
||||
| enum |***`cufftType_t`*** | |***`hipfftType_t`*** |
|
||||
| enum |***`cufftType`*** | |***`hipfftType`*** |
|
||||
| 0x2a |*`CUFFT_R2C`* | |*`HIPFFT_R2C`* |
|
||||
| 0x2c |*`CUFFT_C2R`* | |*`HIPFFT_C2R`* |
|
||||
| 0x29 |*`CUFFT_C2C`* | |*`HIPFFT_C2C`* |
|
||||
| 0x6a |*`CUFFT_D2Z`* | |*`HIPFFT_D2Z`* |
|
||||
| 0x6c |*`CUFFT_Z2D`* | |*`HIPFFT_Z2D`* |
|
||||
| 0x69 |*`CUFFT_Z2Z`* | |*`HIPFFT_Z2Z`* |
|
||||
| enum |***`cufftCompatibility_t`*** | | |
|
||||
| enum |***`cufftCompatibility`*** | | |
|
||||
| 0x01 |*`CUFFT_COMPATIBILITY_FFTW_PADDING`* | | |
|
||||
| define |`CUFFT_COMPATIBILITY_DEFAULT` | | |
|
||||
| int |***`cufftHandle`*** | |***`hipfftHandle`*** |
|
||||
|
||||
## **2. CUFFT API functions**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cufftPlan1d` |`hipfftPlan1d` |
|
||||
|`cufftPlan2d` |`hipfftPlan2d` |
|
||||
|`cufftPlan3d` |`hipfftPlan3d` |
|
||||
|`cufftPlanMany` |`hipfftPlanMany` |
|
||||
|`cufftMakePlan1d` |`hipfftMakePlan1d` |
|
||||
|`cufftMakePlan2d` |`hipfftMakePlan2d` |
|
||||
|`cufftMakePlan3d` |`hipfftMakePlan3d` |
|
||||
|`cufftMakePlanMany` |`hipfftMakePlanMany` |
|
||||
|`cufftMakePlanMany64` |`hipfftMakePlanMany64` | 7.5 |
|
||||
|`cufftGetSizeMany64` |`hipfftGetSizeMany64` | 7.5 |
|
||||
|`cufftEstimate1d` |`hipfftEstimate1d` |
|
||||
|`cufftEstimate2d` |`hipfftEstimate2d` |
|
||||
|`cufftEstimate3d` |`hipfftEstimate3d` |
|
||||
|`cufftEstimateMany` |`hipfftEstimateMany` |
|
||||
|`cufftCreate` |`hipfftCreate` |
|
||||
|`cufftGetSize1d` |`hipfftGetSize1d` |
|
||||
|`cufftGetSize2d` |`hipfftGetSize2d` |
|
||||
|`cufftGetSize3d` |`hipfftGetSize3d` |
|
||||
|`cufftGetSizeMany` |`hipfftGetSizeMany` |
|
||||
|`cufftGetSize` |`hipfftGetSize` |
|
||||
|`cufftSetWorkArea` |`hipfftSetWorkArea` |
|
||||
|`cufftSetAutoAllocation` |`hipfftSetAutoAllocation` |
|
||||
|`cufftExecC2C` |`hipfftExecC2C` |
|
||||
|`cufftExecR2C` |`hipfftExecR2C` |
|
||||
|`cufftExecC2R` |`hipfftExecC2R` |
|
||||
|`cufftExecZ2Z` |`hipfftExecZ2Z` |
|
||||
|`cufftExecD2Z` |`hipfftExecD2Z` |
|
||||
|`cufftExecZ2D` |`hipfftExecZ2D` |
|
||||
|`cufftSetStream` |`hipfftSetStream` |
|
||||
|`cufftDestroy` |`hipfftDestroy` |
|
||||
|`cufftGetVersion` |`hipfftGetVersion` |
|
||||
|`cufftGetProperty` | | 8.0 |
|
||||
@@ -1,172 +0,0 @@
|
||||
# CURAND API supported by HIP
|
||||
|
||||
## **1. CURAND Data types**
|
||||
|
||||
| **type** | **CUDA** |**CUDA version\***| **HIP** | **HIP value** (if differs) |
|
||||
|-------------:|---------------------------------------------------------------|:----------------:|------------------------------------------------------------|----------------------------|
|
||||
| define |`CURAND_VER_MAJOR` | 10.1 Update 2 | |
|
||||
| define |`CURAND_VER_MINOR` | 10.1 Update 2 | |
|
||||
| define |`CURAND_VER_PATCH` | 10.1 Update 2 | |
|
||||
| define |`CURAND_VER_BUILD` | 10.1 Update 2 | |
|
||||
| define |`CURAND_VERSION` | 10.1 Update 2 | |
|
||||
| enum |***`curandStatus`*** | |***`hiprandStatus`*** |
|
||||
| enum |***`curandStatus_t`*** | |***`hiprandStatus_t`*** |
|
||||
| 0 |*`CURAND_STATUS_SUCCESS`* | |*`HIPRAND_STATUS_SUCCESS`* |
|
||||
| 100 |*`CURAND_STATUS_VERSION_MISMATCH`* | |*`HIPRAND_STATUS_VERSION_MISMATCH`* |
|
||||
| 101 |*`CURAND_STATUS_NOT_INITIALIZED`* | |*`HIPRAND_STATUS_NOT_INITIALIZED`* |
|
||||
| 102 |*`CURAND_STATUS_ALLOCATION_FAILED`* | |*`HIPRAND_STATUS_ALLOCATION_FAILED`* |
|
||||
| 103 |*`CURAND_STATUS_TYPE_ERROR`* | |*`HIPRAND_STATUS_TYPE_ERROR`* |
|
||||
| 104 |*`CURAND_STATUS_OUT_OF_RANGE`* | |*`HIPRAND_STATUS_OUT_OF_RANGE`* |
|
||||
| 105 |*`CURAND_STATUS_LENGTH_NOT_MULTIPLE`* | |*`HIPRAND_STATUS_LENGTH_NOT_MULTIPLE`* |
|
||||
| 106 |*`CURAND_STATUS_DOUBLE_PRECISION_REQUIRED`* | |*`HIPRAND_STATUS_DOUBLE_PRECISION_REQUIRED`* |
|
||||
| 201 |*`CURAND_STATUS_LAUNCH_FAILURE`* | |*`HIPRAND_STATUS_LAUNCH_FAILURE`* |
|
||||
| 202 |*`CURAND_STATUS_PREEXISTING_FAILURE`* | |*`HIPRAND_STATUS_PREEXISTING_FAILURE`* |
|
||||
| 203 |*`CURAND_STATUS_INITIALIZATION_FAILED`* | |*`HIPRAND_STATUS_INITIALIZATION_FAILED`* |
|
||||
| 204 |*`CURAND_STATUS_ARCH_MISMATCH`* | |*`HIPRAND_STATUS_ARCH_MISMATCH`* |
|
||||
| 999 |*`CURAND_STATUS_INTERNAL_ERROR`* | |*`HIPRAND_STATUS_INTERNAL_ERROR`* |
|
||||
| enum |***`curandRngType`*** | |***`hiprandRngType`*** |
|
||||
| enum |***`curandRngType_t`*** | |***`hiprandRngType_t`*** |
|
||||
| 0 |*`CURAND_RNG_TEST`* | |*`HIPRAND_RNG_TEST`* |
|
||||
| 100 |*`CURAND_RNG_PSEUDO_DEFAULT`* | |*`HIPRAND_RNG_PSEUDO_DEFAULT`* | 400 |
|
||||
| 101 |*`CURAND_RNG_PSEUDO_XORWOW`* | |*`HIPRAND_RNG_PSEUDO_XORWOW`* | 401 |
|
||||
| 121 |*`CURAND_RNG_PSEUDO_MRG32K3A`* | |*`HIPRAND_RNG_PSEUDO_MRG32K3A`* | 402 |
|
||||
| 141 |*`CURAND_RNG_PSEUDO_MTGP32`* | |*`HIPRAND_RNG_PSEUDO_MTGP32`* | 403 |
|
||||
| 142 |*`CURAND_RNG_PSEUDO_MT19937`* | |*`HIPRAND_RNG_PSEUDO_MT19937`* | 404 |
|
||||
| 161 |*`CURAND_RNG_PSEUDO_PHILOX4_32_10`* | |*`HIPRAND_RNG_PSEUDO_PHILOX4_32_10`* | 405 |
|
||||
| 200 |*`CURAND_RNG_QUASI_DEFAULT`* | |*`HIPRAND_RNG_QUASI_DEFAULT`* | 500 |
|
||||
| 201 |*`CURAND_RNG_QUASI_SOBOL32`* | |*`HIPRAND_RNG_QUASI_SOBOL32`* | 501 |
|
||||
| 202 |*`CURAND_RNG_QUASI_SCRAMBLED_SOBOL32`* | |*`HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL32`* | 502 |
|
||||
| 203 |*`CURAND_RNG_QUASI_SOBOL64`* | |*`HIPRAND_RNG_QUASI_SOBOL64`* | 503 |
|
||||
| 204 |*`CURAND_RNG_QUASI_SCRAMBLED_SOBOL64`* | |*`HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64`* | 504 |
|
||||
| enum |***`curandOrdering`*** | | |
|
||||
| enum |***`curandOrdering_t`*** | | |
|
||||
| 100 |*`CURAND_ORDERING_PSEUDO_BEST`* | | |
|
||||
| 101 |*`CURAND_ORDERING_PSEUDO_DEFAULT`* | | |
|
||||
| 102 |*`CURAND_ORDERING_PSEUDO_SEEDED`* | | |
|
||||
| 201 |*`CURAND_ORDERING_QUASI_DEFAULT`* | | |
|
||||
| enum |***`curandDirectionVectorSet`*** | | |
|
||||
| enum |***`curandDirectionVectorSet_t`*** | | |
|
||||
| 101 |*`CURAND_DIRECTION_VECTORS_32_JOEKUO6`* | | |
|
||||
| 102 |*`CURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6`* | | |
|
||||
| 103 |*`CURAND_DIRECTION_VECTORS_64_JOEKUO6`* | | |
|
||||
| 104 |*`CURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6`* | | |
|
||||
| uint | `curandDirectionVectors32_t` | | `hiprandDirectionVectors32_t` |
|
||||
| uint | `curandDirectionVectors64_t` | | |
|
||||
| struct | `curandGenerator_st` | | `hiprandGenerator_st` |
|
||||
| struct* | `curandGenerator_t` | | `hiprandGenerator_t` |
|
||||
| double | `curandDistribution_st` | | |
|
||||
| double | `curandHistogramM2V_st` | | |
|
||||
| double* | `curandDistribution_t` | | |
|
||||
| double* | `curandHistogramM2V_t` | | |
|
||||
| struct | `curandDistributionShift_st` | | |
|
||||
| struct* | `curandDistributionShift_t` | | |
|
||||
| struct | `curandDistributionM2Shift_st` | | |
|
||||
| struct* | `curandDistributionM2Shift_t` | | |
|
||||
| struct | `curandHistogramM2_st` | | |
|
||||
| struct* | `curandHistogramM2_t` | | |
|
||||
| uint | `curandHistogramM2K_st` | | |
|
||||
| uint* | `curandHistogramM2K_t` | | |
|
||||
| struct | `curandDiscreteDistribution_st` | | `hiprandDiscreteDistribution_st` |
|
||||
| struct* | `curandDiscreteDistribution_t` | | `hiprandDiscreteDistribution_t` |
|
||||
| enum |***`curandMethod`*** | | |
|
||||
| enum |***`curandMethod_t`*** | | |
|
||||
| 0 |*`CURAND_CHOOSE_BEST`* | | |
|
||||
| 1 |*`CURAND_ITR`* | | |
|
||||
| 2 |*`CURAND_KNUTH`* | | |
|
||||
| 3 |*`CURAND_HITR`* | | |
|
||||
| 4 |*`CURAND_M1`* | | |
|
||||
| 5 |*`CURAND_M2`* | | |
|
||||
| 6 |*`CURAND_BINARY_SEARCH`* | | |
|
||||
| 7 |*`CURAND_DISCRETE_GAUSS`* | | |
|
||||
| 8 |*`CURAND_REJECTION`* | | |
|
||||
| 9 |*`CURAND_DEVICE_API`* | | |
|
||||
| 10 |*`CURAND_FAST_REJECTION`* | | |
|
||||
| 11 |*`CURAND_3RD`* | | |
|
||||
| 12 |*`CURAND_DEFINITION`* | | |
|
||||
| 13 |*`CURAND_POISSON`* | | |
|
||||
| struct | `curandStateMtgp32` | | `hiprandStateMtgp32` |
|
||||
| typedef | `curandStateMtgp32_t` | | `hiprandStateMtgp32_t` |
|
||||
| struct | `curandStateScrambledSobol64` | | |
|
||||
| typedef | `curandStateScrambledSobol64_t` | | |
|
||||
| struct | `curandStateSobol64` | | |
|
||||
| typedef | `curandStateSobol64_t` | | |
|
||||
| struct | `curandStateScrambledSobol32` | | |
|
||||
| typedef | `curandStateScrambledSobol32_t` | | |
|
||||
| struct | `curandStateSobol32` | | `hiprandStateSobol32` |
|
||||
| typedef | `curandStateSobol32_t` | | `hiprandStateSobol32_t` |
|
||||
| struct | `curandStateMRG32k3a` | | `hiprandStateMRG32k3a` |
|
||||
| typedef | `curandStateMRG32k3a_t` | | `hiprandStateMRG32k3a_t` |
|
||||
| struct | `curandStatePhilox4_32_10` | | `hiprandStatePhilox4_32_10` |
|
||||
| typedef | `curandStatePhilox4_32_10_t` | | `hiprandStatePhilox4_32_10_t` |
|
||||
| struct | `curandStateXORWOW` | | `hiprandStateXORWOW` |
|
||||
| typedef | `curandStateXORWOW_t` | | `hiprandStateXORWOW_t` |
|
||||
| struct | `curandState` | | `hiprandState` |
|
||||
| typedef | `curandState_t` | | `hiprandState_t` |
|
||||
|
||||
## **2. Host API Functions**
|
||||
|
||||
| **CUDA** | **HIP** |
|
||||
|-----------------------------------------------------------|--------------------------------------------|
|
||||
| `curandCreateGenerator` | `hiprandCreateGenerator` |
|
||||
| `curandCreateGeneratorHost` | `hiprandCreateGeneratorHost` |
|
||||
| `curandCreatePoissonDistribution` | `hiprandCreatePoissonDistribution` |
|
||||
| `curandDestroyDistribution` | `hiprandDestroyDistribution` |
|
||||
| `curandDestroyGenerator` | `hiprandDestroyGenerator` |
|
||||
| `curandGenerate` | `hiprandGenerate` |
|
||||
| `curandGenerateLogNormal` | `hiprandGenerateLogNormal` |
|
||||
| `curandGenerateLogNormalDouble` | `hiprandGenerateLogNormalDouble` |
|
||||
| `curandGenerateLongLong` | |
|
||||
| `curandGenerateNormal` | `hiprandGenerateNormal` |
|
||||
| `curandGenerateNormalDouble` | `hiprandGenerateNormalDouble` |
|
||||
| `curandGeneratePoisson` | `hiprandGeneratePoisson` |
|
||||
| `curandGenerateSeeds` | `hiprandGenerateSeeds` |
|
||||
| `curandGenerateUniform` | `hiprandGenerateUniform` |
|
||||
| `curandGenerateUniformDouble` | `hiprandGenerateUniformDouble` |
|
||||
| `curandGetDirectionVectors32` | |
|
||||
| `curandGetDirectionVectors64` | |
|
||||
| `curandGetProperty` | |
|
||||
| `curandGetScrambleConstants32` | |
|
||||
| `curandGetScrambleConstants64` | |
|
||||
| `curandGetVersion` | `hiprandGetVersion` |
|
||||
| `curandSetGeneratorOffset` | `hiprandSetGeneratorOffset` |
|
||||
| `curandSetGeneratorOrdering` | |
|
||||
| `curandSetPseudoRandomGeneratorSeed` | `hiprandSetPseudoRandomGeneratorSeed` |
|
||||
| `curandSetQuasiRandomGeneratorDimensions` | `hiprandSetQuasiRandomGeneratorDimensions` |
|
||||
| `curandSetStream` | `hiprandSetStream` |
|
||||
| `curandMakeMTGP32Constants` | `hiprandMakeMTGP32Constants` |
|
||||
| `curandMakeMTGP32KernelState` | `hiprandMakeMTGP32KernelState` |
|
||||
|
||||
## **3. Device API Functions**
|
||||
|
||||
| **CUDA** | **HIP** |
|
||||
|-----------------------------------------------------------|--------------------------------------------|
|
||||
| `curand` | `hiprand` |
|
||||
| `curand_init` | `hiprand_init` |
|
||||
| `curand_log_normal` | `hiprand_log_normal` |
|
||||
| `curand_log_normal_double` | `hiprand_log_normal_double` |
|
||||
| `curand_log_normal2` | `hiprand_log_normal2` |
|
||||
| `curand_log_normal2_double` | `hiprand_log_normal2_double` |
|
||||
| `curand_log_normal4` | `hiprand_log_normal4` |
|
||||
| `curand_log_normal4_double` | `hiprand_log_normal4_double` |
|
||||
| `curand_mtgp32_single` | |
|
||||
| `curand_mtgp32_single_specific` | |
|
||||
| `curand_mtgp32_specific` | |
|
||||
| `curand_normal` | `hiprand_normal` |
|
||||
| `curand_normal_double` | `hiprand_normal_double` |
|
||||
| `curand_normal2` | `hiprand_normal2` |
|
||||
| `curand_normal2_double` | `hiprand_normal2_double` |
|
||||
| `curand_normal4` | `hiprand_normal4` |
|
||||
| `curand_normal4_double` | `hiprand_normal4_double` |
|
||||
| `curand_uniform` | `hiprand_uniform` |
|
||||
| `curand_uniform_double` | `hiprand_uniform_double` |
|
||||
| `curand_uniform2_double` | `hiprand_uniform2_double` |
|
||||
| `curand_uniform4` | `hiprand_uniform4` |
|
||||
| `curand_uniform4_double` | `hiprand_uniform4_double` |
|
||||
| `curand_discrete` | `hiprand_discrete` |
|
||||
| `curand_discrete4` | `hiprand_discrete4` |
|
||||
| `curand_poisson` | `hiprand_poisson` |
|
||||
| `curand_poisson4` | `hiprand_poisson4` |
|
||||
| `curand_Philox4x32_10` | |
|
||||
| `skipahead` | `skipahead` |
|
||||
| `skipahead_sequence` | `skipahead_sequence` |
|
||||
| `skipahead_subsequence` | `skipahead_subsequence` |
|
||||
@@ -1,797 +0,0 @@
|
||||
# CUSPARSE API supported by HIP
|
||||
|
||||
## **1. cuSPARSE Data types**
|
||||
|
||||
| **type** | **CUDA** |**CUDA version\***| **HIP** |
|
||||
|-------------:|---------------------------------------------------------------|:-----------------|------------------------------------------------------------|
|
||||
| define |`CUSPARSE_VER_MAJOR` | 10.1 Update 2 | |
|
||||
| define |`CUSPARSE_VER_MINOR` | 10.1 Update 2 | |
|
||||
| define |`CUSPARSE_VER_PATCH` | 10.1 Update 2 | |
|
||||
| define |`CUSPARSE_VER_BUILD` | 10.1 Update 2 | |
|
||||
| define |`CUSPARSE_VERSION` | 10.1 Update 2 | |
|
||||
| enum |***`cusparseAction_t`*** | |***`hipsparseAction_t`*** |
|
||||
| 0 |*`CUSPARSE_ACTION_SYMBOLIC`* | |*`HIPSPARSE_ACTION_SYMBOLIC`* |
|
||||
| 1 |*`CUSPARSE_ACTION_NUMERIC`* | |*`HIPSPARSE_ACTION_NUMERIC`* |
|
||||
| enum |***`cusparseDirection_t`*** | |***`hipsparseDirection_t`*** |
|
||||
| 0 |*`CUSPARSE_DIRECTION_ROW`* | |*`HIPSPARSE_DIRECTION_ROW`* |
|
||||
| 1 |*`CUSPARSE_DIRECTION_COLUMN`* | |*`HIPSPARSE_DIRECTION_COLUMN`* |
|
||||
| enum |***`cusparseHybPartition_t`*** | |***`hipsparseHybPartition_t`*** |
|
||||
| 0 |*`CUSPARSE_HYB_PARTITION_AUTO`* | |*`HIPSPARSE_HYB_PARTITION_AUTO`* |
|
||||
| 1 |*`CUSPARSE_HYB_PARTITION_USER`* | |*`HIPSPARSE_HYB_PARTITION_USER`* |
|
||||
| 2 |*`CUSPARSE_HYB_PARTITION_MAX`* | |*`HIPSPARSE_HYB_PARTITION_MAX`* |
|
||||
| enum |***`cusparseDiagType_t`*** | |***`hipsparseDiagType_t`*** |
|
||||
| 0 |*`CUSPARSE_DIAG_TYPE_NON_UNIT`* | |*`HIPSPARSE_DIAG_TYPE_NON_UNIT`* |
|
||||
| 1 |*`CUSPARSE_DIAG_TYPE_UNIT`* | |*`HIPSPARSE_DIAG_TYPE_UNIT`* |
|
||||
| enum |***`cusparseFillMode_t`*** | |***`hipsparseFillMode_t`*** |
|
||||
| 0 |*`CUSPARSE_FILL_MODE_LOWER`* | |*`HIPSPARSE_FILL_MODE_LOWER`* |
|
||||
| 1 |*`CUSPARSE_FILL_MODE_UPPER`* | |*`HIPSPARSE_FILL_MODE_UPPER`* |
|
||||
| enum |***`cusparseIndexBase_t`*** | |***`hipsparseIndexBase_t`*** |
|
||||
| 0 |*`CUSPARSE_INDEX_BASE_ZERO`* | |*`HIPSPARSE_INDEX_BASE_ZERO`* |
|
||||
| 1 |*`CUSPARSE_INDEX_BASE_ONE`* | |*`HIPSPARSE_INDEX_BASE_ONE`* |
|
||||
| enum |***`cusparseMatrixType_t`*** | |***`hipsparseMatrixType_t`*** |
|
||||
| 0 |*`CUSPARSE_MATRIX_TYPE_GENERAL`* | |*`HIPSPARSE_MATRIX_TYPE_GENERAL`* |
|
||||
| 1 |*`CUSPARSE_MATRIX_TYPE_SYMMETRIC`* | |*`HIPSPARSE_MATRIX_TYPE_SYMMETRIC`* |
|
||||
| 2 |*`CUSPARSE_MATRIX_TYPE_HERMITIAN`* | |*`HIPSPARSE_MATRIX_TYPE_HERMITIAN`* |
|
||||
| 3 |*`CUSPARSE_MATRIX_TYPE_TRIANGULAR`* | |*`HIPSPARSE_MATRIX_TYPE_TRIANGULAR`* |
|
||||
| enum |***`cusparseOperation_t`*** | |***`hipsparseOperation_t`*** |
|
||||
| 0 |*`CUSPARSE_OPERATION_NON_TRANSPOSE`* | |*`HIPSPARSE_OPERATION_NON_TRANSPOSE`* |
|
||||
| 1 |*`CUSPARSE_OPERATION_TRANSPOSE`* | |*`HIPSPARSE_OPERATION_TRANSPOSE`* |
|
||||
| 2 |*`CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE`* | |*`HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE`* |
|
||||
| enum |***`cusparsePointerMode_t`*** | |***`hipsparsePointerMode_t`*** |
|
||||
| 0 |*`CUSPARSE_POINTER_MODE_HOST`* | |*`HIPSPARSE_POINTER_MODE_HOST`* |
|
||||
| 1 |*`CUSPARSE_POINTER_MODE_DEVICE`* | |*`HIPSPARSE_POINTER_MODE_DEVICE`* |
|
||||
| enum |***`cusparseAlgMode_t`*** | 8.0 | |
|
||||
| 0 |*`CUSPARSE_ALG0`* | 8.0 | |
|
||||
| 1 |*`CUSPARSE_ALG1`* | 8.0 | |
|
||||
| 0 |*`CUSPARSE_ALG_NAIVE`* | 9.2 | |
|
||||
| 1 |*`CUSPARSE_ALG_MERGE_PATH`* | 9.2 | |
|
||||
| enum |***`cusparseSolvePolicy_t`*** | |***`hipsparseSolvePolicy_t`*** |
|
||||
| 0 |*`CUSPARSE_SOLVE_POLICY_NO_LEVEL`* | |*`HIPSPARSE_SOLVE_POLICY_NO_LEVEL`* |
|
||||
| 1 |*`CUSPARSE_SOLVE_POLICY_USE_LEVEL`* | |*`HIPSPARSE_SOLVE_POLICY_USE_LEVEL`* |
|
||||
| enum |***`cusparseStatus_t`*** | |***`hipsparseMatrixType_t`*** |
|
||||
| 0 |*`CUSPARSE_STATUS_SUCCESS`* | |*`HIPSPARSE_STATUS_SUCCESS`* |
|
||||
| 1 |*`CUSPARSE_STATUS_NOT_INITIALIZED`* | |*`HIPSPARSE_STATUS_NOT_INITIALIZED`* |
|
||||
| 2 |*`CUSPARSE_STATUS_ALLOC_FAILED`* | |*`HIPSPARSE_STATUS_ALLOC_FAILED`* |
|
||||
| 3 |*`CUSPARSE_STATUS_INVALID_VALUE`* | |*`HIPSPARSE_STATUS_INVALID_VALUE`* |
|
||||
| 4 |*`CUSPARSE_STATUS_ARCH_MISMATCH`* | |*`HIPSPARSE_STATUS_ARCH_MISMATCH`* |
|
||||
| 5 |*`CUSPARSE_STATUS_MAPPING_ERROR`* | |*`HIPSPARSE_STATUS_MAPPING_ERROR`* |
|
||||
| 6 |*`CUSPARSE_STATUS_EXECUTION_FAILED`* | |*`HIPSPARSE_STATUS_EXECUTION_FAILED`* |
|
||||
| 7 |*`CUSPARSE_STATUS_INTERNAL_ERROR`* | |*`HIPSPARSE_STATUS_INTERNAL_ERROR`* |
|
||||
| 8 |*`CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED`* | |*`HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED`* |
|
||||
| 9 |*`CUSPARSE_STATUS_ZERO_PIVOT`* | |*`HIPSPARSE_STATUS_ZERO_PIVOT`* |
|
||||
| struct |`cusparseContext` | | |
|
||||
| typedef |`cusparseHandle_t` | |`hipsparseHandle_t` |
|
||||
| struct |`cusparseHybMat` | | |
|
||||
| typedef |`cusparseHybMat_t` | |`hipsparseHybMat_t` |
|
||||
| struct |`cusparseMatDescr` | | |
|
||||
| typedef |`cusparseMatDescr_t` | |`hipsparseMatDescr_t` |
|
||||
| struct |`cusparseSolveAnalysisInfo` | | |
|
||||
| typedef |`cusparseSolveAnalysisInfo_t` | | |
|
||||
| struct |`csrsv2Info` | | |
|
||||
| typedef |`csrsv2Info_t` | |`csrsv2Info_t` |
|
||||
| struct |`csrsm2Info` | 9.2 |`csrsm2Info` |
|
||||
| typedef |`csrsm2Info_t` | |`csrsm2Info_t` |
|
||||
| struct |`bsrsv2Info` | | |
|
||||
| typedef |`bsrsv2Info_t` | | |
|
||||
| struct |`bsrsm2Info` | | |
|
||||
| typedef |`bsrsm2Info_t` | | |
|
||||
| struct |`bsric02Info` | | |
|
||||
| typedef |`bsric02Info_t` | | |
|
||||
| struct |`csrilu02Info` | | |
|
||||
| typedef |`csrilu02Info_t` | |`csrilu02Info_t` |
|
||||
| struct |`bsrilu02Info` | | |
|
||||
| typedef |`bsrilu02Info_t` | | |
|
||||
| struct |`csru2csrInfo` | | |
|
||||
| typedef |`csru2csrInfo_t` | | |
|
||||
| struct |`csrgemm2Info` | |`csrgemm2Info` |
|
||||
| typedef |`csrgemm2Info_t` | |`csrgemm2Info_t` |
|
||||
| struct |`cusparseColorInfo` | | |
|
||||
| typedef |`cusparseColorInfo_t` | | |
|
||||
| struct |`pruneInfo` | 9.0 | |
|
||||
| typedef |`pruneInfo_t` | 9.0 | |
|
||||
| enum |***`cusparseCsr2CscAlg_t`*** | 10.1 | |
|
||||
| 1 |*`CUSPARSE_CSR2CSC_ALG1`* | 10.1 | |
|
||||
| 2 |*`CUSPARSE_CSR2CSC_ALG2`* | 10.1 | |
|
||||
| enum |***`cusparseFormat_t`*** | 10.1 | |
|
||||
| 1 |*`CUSPARSE_FORMAT_CSR`* | 10.1 | |
|
||||
| 2 |*`CUSPARSE_FORMAT_CSC`* | 10.1 | |
|
||||
| 3 |*`CUSPARSE_FORMAT_COO`* | 10.1 | |
|
||||
| 4 |*`CUSPARSE_FORMAT_COO_AOS`* | 10.1 | |
|
||||
| enum |***`cusparseOrder_t`*** | 10.1 | |
|
||||
| 1 |*`CUSPARSE_ORDER_COL`* | 10.1 | |
|
||||
| 2 |*`CUSPARSE_ORDER_ROW`* | 10.1 | |
|
||||
| enum |***`cusparseSpMVAlg_t`*** | 10.1 | |
|
||||
| 0 |*`CUSPARSE_MV_ALG_DEFAULT`* | 10.1 | |
|
||||
| 1 |*`CUSPARSE_COOMV_ALG`* | 10.1 | |
|
||||
| 2 |*`CUSPARSE_CSRMV_ALG1`* | 10.1 | |
|
||||
| 3 |*`CUSPARSE_CSRMV_ALG2`* | 10.1 | |
|
||||
| enum |***`cusparseSpMMAlg_t`*** | 10.1 | |
|
||||
| 0 |*`CUSPARSE_MM_ALG_DEFAULT`* | 10.1 | |
|
||||
| 1 |*`CUSPARSE_COOMM_ALG1`* | 10.1 | |
|
||||
| 2 |*`CUSPARSE_COOMM_ALG2`* | 10.1 | |
|
||||
| 3 |*`CUSPARSE_COOMM_ALG3`* | 10.1 | |
|
||||
| 4 |*`CUSPARSE_CSRMM_ALG1`* | 10.1 | |
|
||||
| enum |***`cusparseIndexType_t`*** | 10.1 | |
|
||||
| 1 |*`CUSPARSE_INDEX_16U`* | 10.1 | |
|
||||
| 2 |*`CUSPARSE_INDEX_32I`* | 10.1 | |
|
||||
| 3 |*`CUSPARSE_INDEX_64I`* | 10.1 | |
|
||||
| struct |`cusparseSpMatDescr` | 10.1 | |
|
||||
| typedef |`cusparseSpMatDescr_t` | 10.1 | |
|
||||
| struct |`cusparseDnMatDescr` | 10.1 | |
|
||||
| typedef |`cusparseDnMatDescr_t` | 10.1 | |
|
||||
| struct |`cusparseSpVecDescr` | 10.1 | |
|
||||
| typedef |`cusparseSpVecDescr_t` | 10.1 | |
|
||||
| struct |`cusparseDnVecDescr` | 10.1 | |
|
||||
| typedef |`cusparseDnVecDescr_t` | 10.1 | |
|
||||
|
||||
## **2. cuSPARSE Helper Function Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseCreate` |`hipsparseCreate` |
|
||||
|`cusparseCreateSolveAnalysisInfo` | |
|
||||
|`cusparseCreateHybMat` |`hipsparseCreateHybMat` |
|
||||
|`cusparseCreateMatDescr` |`hipsparseCreateMatDescr` |
|
||||
|`cusparseDestroy` |`hipsparseDestroy` |
|
||||
|`cusparseDestroySolveAnalysisInfo` | |
|
||||
|`cusparseDestroyHybMat` |`hipsparseDestroyHybMat` |
|
||||
|`cusparseDestroyMatDescr` |`hipsparseDestroyMatDescr` |
|
||||
|`cusparseGetLevelInfo` | |
|
||||
|`cusparseGetMatDiagType` |`hipsparseGetMatDiagType` |
|
||||
|`cusparseGetMatFillMode` |`hipsparseGetMatFillMode` |
|
||||
|`cusparseGetMatIndexBase` |`hipsparseGetMatIndexBase` |
|
||||
|`cusparseGetMatType` |`hipsparseGetMatType` |
|
||||
|`cusparseGetPointerMode` |`hipsparseGetPointerMode` |
|
||||
|`cusparseGetVersion` |`hipsparseGetVersion` |
|
||||
|`cusparseSetMatDiagType` |`hipsparseSetMatDiagType` |
|
||||
|`cusparseSetMatFillMode` |`hipsparseSetMatFillMode` |
|
||||
|`cusparseSetMatType` |`hipsparseSetMatType` |
|
||||
|`cusparseSetPointerMode` |`hipsparseSetPointerMode` |
|
||||
|`cusparseSetStream` |`hipsparseSetStream` |
|
||||
|`cusparseGetStream` |`hipsparseGetStream` | 8.0 |
|
||||
|`cusparseCreateCsrsv2Info` |`hipsparseCreateCsrsv2Info` |
|
||||
|`cusparseDestroyCsrsv2Info` |`hipsparseDestroyCsrsv2Info` |
|
||||
|`cusparseCreateCsrsm2Info` |`hipsparseCreateCsrsm2Info` | 9.2 |
|
||||
|`cusparseDestroyCsrsm2Info` |`hipsparseDestroyCsrsm2Info` | 9.2 |
|
||||
|`cusparseCreateCsric02Info` | |
|
||||
|`cusparseDestroyCsric02Info` | |
|
||||
|`cusparseCreateCsrilu02Info` |`hipsparseCreateCsrilu02Info` |
|
||||
|`cusparseDestroyCsrilu02Info` |`hipsparseDestroyCsrilu02Info` |
|
||||
|`cusparseCreateBsrsv2Info` | |
|
||||
|`cusparseDestroyBsrsv2Info` | |
|
||||
|`cusparseCreateBsrsm2Info` | |
|
||||
|`cusparseDestroyBsrsm2Info` | |
|
||||
|`cusparseCreateBsric02Info` | |
|
||||
|`cusparseDestroyBsric02Info` | |
|
||||
|`cusparseCreateBsrilu02Info` | |
|
||||
|`cusparseDestroyBsrilu02Info` | |
|
||||
|`cusparseCreateCsrgemm2Info` |`hipsparseCreateCsrgemm2Info` |
|
||||
|`cusparseDestroyCsrgemm2Info` |`hipsparseDestroyCsrgemm2Info` |
|
||||
|`cusparseCreatePruneInfo` | | 9.0 |
|
||||
|`cusparseDestroyPruneInfo` | | 9.0 |
|
||||
|
||||
## **3. cuSPARSE Level 1 Function Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSaxpyi` |`hipsparseSaxpyi` |
|
||||
|`cusparseDaxpyi` |`hipsparseDaxpyi` |
|
||||
|`cusparseCaxpyi` |`hipsparseCaxpyi` |
|
||||
|`cusparseZaxpyi` |`hipsparseZaxpyi` |
|
||||
|`cusparseSdoti` |`hipsparseSdoti` |
|
||||
|`cusparseDdoti` |`hipsparseDdoti` |
|
||||
|`cusparseCdoti` |`hipsparseCdoti` |
|
||||
|`cusparseZdoti` |`hipsparseZdoti` |
|
||||
|`cusparseCdotci` |`hipsparseCdotci` |
|
||||
|`cusparseZdotci` |`hipsparseZdotci` |
|
||||
|`cusparseSgthr` |`hipsparseSgthr` |
|
||||
|`cusparseDgthr` |`hipsparseDgthr` |
|
||||
|`cusparseCgthr` |`hipsparseCgthr` |
|
||||
|`cusparseZgthr` |`hipsparseZgthr` |
|
||||
|`cusparseSgthrz` |`hipsparseSgthrz` |
|
||||
|`cusparseDgthrz` |`hipsparseDgthrz` |
|
||||
|`cusparseCgthrz` |`hipsparseCgthrz` |
|
||||
|`cusparseZgthrz` |`hipsparseZgthrz` |
|
||||
|`cusparseSroti` |`hipsparseSroti` |
|
||||
|`cusparseDroti` |`hipsparseDroti` |
|
||||
|`cusparseSsctr` |`hipsparseSsctr` |
|
||||
|`cusparseDsctr` |`hipsparseDsctr` |
|
||||
|`cusparseCsctr` |`hipsparseCsctr` |
|
||||
|`cusparseZsctr` |`hipsparseZsctr` |
|
||||
|
||||
## **4. cuSPARSE Level 2 Function Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSbsrmv` |`hipsparseSbsrmv` |
|
||||
|`cusparseDbsrmv` |`hipsparseDbsrmv` |
|
||||
|`cusparseCbsrmv` |`hipsparseCbsrmv` |
|
||||
|`cusparseZbsrmv` |`hipsparseZbsrmv` |
|
||||
|`cusparseSbsrxmv` | |
|
||||
|`cusparseDbsrxmv` | |
|
||||
|`cusparseCbsrxmv` | |
|
||||
|`cusparseZbsrxmv` | |
|
||||
|`cusparseScsrmv` |`hipsparseScsrmv` |
|
||||
|`cusparseDcsrmv` |`hipsparseDcsrmv` |
|
||||
|`cusparseCcsrmv` |`hipsparseCcsrmv` |
|
||||
|`cusparseZcsrmv` |`hipsparseZcsrmv` |
|
||||
|`cusparseCsrmvEx` | | 8.0 |
|
||||
|`cusparseCsrmvEx_bufferSize` | | 8.0 |
|
||||
|`cusparseScsrmv_mp` | | 8.0 |
|
||||
|`cusparseDcsrmv_mp` | | 8.0 |
|
||||
|`cusparseCcsrmv_mp` | | 8.0 |
|
||||
|`cusparseZcsrmv_mp` | | 8.0 |
|
||||
|`cusparseSgemvi` | | 7.5 |
|
||||
|`cusparseDgemvi` | | 7.5 |
|
||||
|`cusparseCgemvi` | | 7.5 |
|
||||
|`cusparseZgemvi` | | 7.5 |
|
||||
|`cusparseSgemvi_bufferSize` | | 7.5 |
|
||||
|`cusparseDgemvi_bufferSize` | | 7.5 |
|
||||
|`cusparseCgemvi_bufferSize` | | 7.5 |
|
||||
|`cusparseZgemvi_bufferSize` | | 7.5 |
|
||||
|`cusparseSbsrsv2_bufferSize` | |
|
||||
|`cusparseSbsrsv2_bufferSizeExt` | |
|
||||
|`cusparseDbsrsv2_bufferSize` | |
|
||||
|`cusparseDbsrsv2_bufferSizeExt` | |
|
||||
|`cusparseCbsrsv2_bufferSize` | |
|
||||
|`cusparseCbsrsv2_bufferSizeExt` | |
|
||||
|`cusparseZbsrsv2_bufferSize` | |
|
||||
|`cusparseZbsrsv2_bufferSizeExt` | |
|
||||
|`cusparseSbsrsv2_analysis` | |
|
||||
|`cusparseDbsrsv2_analysis` | |
|
||||
|`cusparseCbsrsv2_analysis` | |
|
||||
|`cusparseZbsrsv2_analysis` | |
|
||||
|`cusparseXbsrsv2_zeroPivot` | |
|
||||
|`cusparseSbsrsv2_solve | |
|
||||
|`cusparseDbsrsv2_solve | |
|
||||
|`cusparseCbsrsv2_solve | |
|
||||
|`cusparseZbsrsv2_solve | |
|
||||
|`cusparseScsrsv_analysis` | |
|
||||
|`cusparseDcsrsv_analysis` | |
|
||||
|`cusparseCcsrsv_analysis` | |
|
||||
|`cusparseZcsrsv_analysis` | |
|
||||
|`cusparseCsrsv_analysisEx` | | 8.0 |
|
||||
|`cusparseScsrsv_solve` | |
|
||||
|`cusparseDcsrsv_solve` | |
|
||||
|`cusparseCcsrsv_solve` | |
|
||||
|`cusparseZcsrsv_solve` | |
|
||||
|`cusparseCsrsv_solveEx` | | 8.0 |
|
||||
|`cusparseScsrsv2_bufferSize` |`hipsparseScsrsv2_bufferSize` |
|
||||
|`cusparseScsrsv2_bufferSizeExt` |`hipsparseScsrsv2_bufferSizeExt` |
|
||||
|`cusparseDcsrsv2_bufferSize` |`hipsparseDcsrsv2_bufferSize` |
|
||||
|`cusparseDcsrsv2_bufferSizeExt` |`hipsparseDcsrsv2_bufferSizeExt` |
|
||||
|`cusparseCcsrsv2_bufferSize` |`hipsparseCcsrsv2_bufferSize` |
|
||||
|`cusparseCcsrsv2_bufferSizeExt` |`hipsparseCcsrsv2_bufferSizeExt` |
|
||||
|`cusparseZcsrsv2_bufferSize` |`hipsparseZcsrsv2_bufferSize` |
|
||||
|`cusparseZcsrsv2_bufferSizeExt` |`hipsparseZcsrsv2_bufferSizeExt` |
|
||||
|`cusparseScsrsv2_analysis` |`hipsparseScsrsv2_analysis` |
|
||||
|`cusparseDcsrsv2_analysis` |`hipsparseDcsrsv2_analysis` |
|
||||
|`cusparseCcsrsv2_analysis` |`hipsparseCcsrsv2_analysis` |
|
||||
|`cusparseZcsrsv2_analysis` |`hipsparseZcsrsv2_analysis` |
|
||||
|`cusparseScsrsv2_solve` |`hipsparseScsrsv2_solve` |
|
||||
|`cusparseDcsrsv2_solve` |`hipsparseDcsrsv2_solve` |
|
||||
|`cusparseCcsrsv2_solve` |`hipsparseCcsrsv2_solve` |
|
||||
|`cusparseZcsrsv2_solve` |`hipsparseZcsrsv2_solve` |
|
||||
|`cusparseXcsrsv2_zeroPivot` |`hipsparseXcsrsv2_zeroPivot` |
|
||||
|`cusparseShybmv` |`hipsparseShybmv` |
|
||||
|`cusparseDhybmv` |`hipsparseDhybmv` |
|
||||
|`cusparseChybmv` |`hipsparseChybmv` |
|
||||
|`cusparseZhybmv` |`hipsparseZhybmv` |
|
||||
|`cusparseShybsv_analysis` | |
|
||||
|`cusparseDhybsv_analysis` | |
|
||||
|`cusparseChybsv_analysis` | |
|
||||
|`cusparseZhybsv_analysis` | |
|
||||
|`cusparseShybsv_solve` | |
|
||||
|`cusparseDhybsv_solve` | |
|
||||
|`cusparseChybsv_solve` | |
|
||||
|`cusparseZhybsv_solve` | |
|
||||
|
||||
## **5. cuSPARSE Level 3 Function Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseScsrmm` |`hipsparseScsrmm` |
|
||||
|`cusparseDcsrmm` |`hipsparseDcsrmm` |
|
||||
|`cusparseCcsrmm` |`hipsparseCcsrmm` |
|
||||
|`cusparseZcsrmm` |`hipsparseZcsrmm` |
|
||||
|`cusparseScsrmm2` |`hipsparseScsrmm2` |
|
||||
|`cusparseDcsrmm2` |`hipsparseDcsrmm2` |
|
||||
|`cusparseCcsrmm2` |`hipsparseCcsrmm2` |
|
||||
|`cusparseZcsrmm2` |`hipsparseZcsrmm2` |
|
||||
|`cusparseScsrsm_analysis` | |
|
||||
|`cusparseDcsrsm_analysis` | |
|
||||
|`cusparseCcsrsm_analysis` | |
|
||||
|`cusparseZcsrsm_analysis` | |
|
||||
|`cusparseScsrsm_solve` | |
|
||||
|`cusparseDcsrsm_solve` | |
|
||||
|`cusparseCcsrsm_solve` | |
|
||||
|`cusparseZcsrsm_solve` | |
|
||||
|`cusparseScsrsm2_bufferSizeExt` |`hipsparseScsrsm2_bufferSizeExt` | 9.2 |
|
||||
|`cusparseDcsrsm2_bufferSizeExt` |`hipsparseDcsrsm2_bufferSizeExt` | 9.2 |
|
||||
|`cusparseCcsrsm2_bufferSizeExt` |`hipsparseCcsrsm2_bufferSizeExt` | 9.2 |
|
||||
|`cusparseZcsrsm2_bufferSizeExt` |`hipsparseZcsrsm2_bufferSizeExt` | 9.2 |
|
||||
|`cusparseScsrsm2_analysis` |`hipsparseScsrsm2_analysis` | 9.2 |
|
||||
|`cusparseDcsrsm2_analysis` |`hipsparseDcsrsm2_analysis` | 9.2 |
|
||||
|`cusparseCcsrsm2_analysis` |`hipsparseCcsrsm2_analysis` | 9.2 |
|
||||
|`cusparseZcsrsm2_analysis` |`hipsparseZcsrsm2_analysis` | 9.2 |
|
||||
|`cusparseScsrsm2_solve` |`hipsparseScsrsm2_solve` | 9.2 |
|
||||
|`cusparseDcsrsm2_solve` |`hipsparseDcsrsm2_solve` | 9.2 |
|
||||
|`cusparseCcsrsm2_solve` |`hipsparseCcsrsm2_solve` | 9.2 |
|
||||
|`cusparseZcsrsm2_solve` |`hipsparseZcsrsm2_solve` | 9.2 |
|
||||
|`cusparseXcsrsm2_zeroPivot` |`hipsparseXcsrsm2_zeroPivot` | 9.2 |
|
||||
|`cusparseSbsrmm` | |
|
||||
|`cusparseDbsrmm` | |
|
||||
|`cusparseCbsrmm` | |
|
||||
|`cusparseZbsrmm` | |
|
||||
|`cusparseSbsrsm2_bufferSize` | |
|
||||
|`cusparseSbsrsm2_bufferSizeExt` | |
|
||||
|`cusparseDbsrsm2_bufferSize` | |
|
||||
|`cusparseDbsrsm2_bufferSizeExt` | |
|
||||
|`cusparseCbsrsm2_bufferSize` | |
|
||||
|`cusparseCbsrsm2_bufferSizeExt` | |
|
||||
|`cusparseZbsrsm2_bufferSize` | |
|
||||
|`cusparseZbsrsm2_bufferSizeExt` | |
|
||||
|`cusparseSbsrsm2_analysis` | |
|
||||
|`cusparseDbsrsm2_analysis` | |
|
||||
|`cusparseCbsrsm2_analysis` | |
|
||||
|`cusparseZbsrsm2_analysis` | |
|
||||
|`cusparseSbsrsm2_solve` | |
|
||||
|`cusparseDbsrsm2_solve` | |
|
||||
|`cusparseCbsrsm2_solve` | |
|
||||
|`cusparseZbsrsm2_solve` | |
|
||||
|`cusparseXbsrsm2_zeroPivot` | |
|
||||
|`cusparseSgemmi` | | 8.0 |
|
||||
|`cusparseDgemmi` | | 8.0 |
|
||||
|`cusparseCgemmi` | | 8.0 |
|
||||
|`cusparseZgemmi` | | 8.0 |
|
||||
|
||||
## **6. cuSPARSE Extra Function Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`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` |
|
||||
|`cusparseCcsrgemm` |`hipsparseCcsrgemm` |
|
||||
|`cusparseZcsrgemm` |`hipsparseZcsrgemm` |
|
||||
|`cusparseXcsrgemm2Nnz` |`hipsparseXcsrgemm2Nnz` |
|
||||
|`cusparseScsrgemm2` |`hipsparseScsrgemm2` |
|
||||
|`cusparseDcsrgemm2` |`hipsparseDcsrgemm2` |
|
||||
|`cusparseCcsrgemm2` |`hipsparseCcsrgemm2` |
|
||||
|`cusparseZcsrgemm2` |`hipsparseZcsrgemm2` |
|
||||
|`cusparseScsrgemm2_bufferSizeExt` |`hipsparseScsrgemm2_bufferSizeExt` |
|
||||
|`cusparseDcsrgemm2_bufferSizeExt` |`hipsparseDcsrgemm2_bufferSizeExt` |
|
||||
|`cusparseCcsrgemm2_bufferSizeExt` |`hipsparseCcsrgemm2_bufferSizeExt` |
|
||||
|`cusparseZcsrgemm2_bufferSizeExt` |`hipsparseZcsrgemm2_bufferSizeExt` |
|
||||
|
||||
## **7. cuSPARSE Preconditioners Reference**
|
||||
|
||||
## ***7.1. Incomplete Cholesky Factorization: level 0***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseScsric0` | |
|
||||
|`cusparseDcsric0` | |
|
||||
|`cusparseCcsric0` | |
|
||||
|`cusparseZcsric0` | |
|
||||
|`cusparseScsric02_bufferSize` | |
|
||||
|`cusparseScsric02_bufferSizeExt` | |
|
||||
|`cusparseDcsric02_bufferSize` | |
|
||||
|`cusparseDcsric02_bufferSizeExt` | |
|
||||
|`cusparseCcsric02_bufferSize` | |
|
||||
|`cusparseCcsric02_bufferSizeExt` | |
|
||||
|`cusparseZcsric02_bufferSize` | |
|
||||
|`cusparseZcsric02_bufferSizeExt` | |
|
||||
|`cusparseScsric02_analysis` | |
|
||||
|`cusparseDcsric02_analysis` | |
|
||||
|`cusparseCcsric02_analysis` | |
|
||||
|`cusparseZcsric02_analysis` | |
|
||||
|`cusparseScsric02` | |
|
||||
|`cusparseDcsric02` | |
|
||||
|`cusparseCcsric02` | |
|
||||
|`cusparseZcsric02` | |
|
||||
|`cusparseXcsric02_zeroPivot` | |
|
||||
|`cusparseSbsric02_bufferSize` | |
|
||||
|`cusparseSbsric02_bufferSizeExt` | |
|
||||
|`cusparseDbsric02_bufferSize` | |
|
||||
|`cusparseDbsric02_bufferSizeExt` | |
|
||||
|`cusparseCbsric02_bufferSize` | |
|
||||
|`cusparseCbsric02_bufferSizeExt` | |
|
||||
|`cusparseZbsric02_bufferSize` | |
|
||||
|`cusparseZbsric02_bufferSizeExt` | |
|
||||
|`cusparseSbsric02_analysis` | |
|
||||
|`cusparseDbsric02_analysis` | |
|
||||
|`cusparseCbsric02_analysis` | |
|
||||
|`cusparseZbsric02_analysis` | |
|
||||
|`cusparseSbsric02` | |
|
||||
|`cusparseDbsric02` | |
|
||||
|`cusparseCbsric02` | |
|
||||
|`cusparseZbsric02` | |
|
||||
|`cusparseXbsric02_zeroPivot` | |
|
||||
|
||||
## ***7.2. Incomplete LU Factorization: level 0***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseScsrilu0` | |
|
||||
|`cusparseDcsrilu0` | |
|
||||
|`cusparseCcsrilu0` | |
|
||||
|`cusparseZcsrilu0` | |
|
||||
|`cusparseCsrilu0Ex` | | 8.0 |
|
||||
|`cusparseScsrilu02_numericBoost` | |
|
||||
|`cusparseDcsrilu02_numericBoost` | |
|
||||
|`cusparseCcsrilu02_numericBoost` | |
|
||||
|`cusparseZcsrilu02_numericBoost` | |
|
||||
|`cusparseXcsrilu02_zeroPivot` |`hipsparseXcsrilu02_zeroPivot` |
|
||||
|`cusparseScsrilu02_bufferSize` |`hipsparseScsrilu02_bufferSize` |
|
||||
|`cusparseScsrilu02_bufferSizeExt` |`hipsparseScsrilu02_bufferSizeExt` |
|
||||
|`cusparseDcsrilu02_bufferSize` |`hipsparseDcsrilu02_bufferSize` |
|
||||
|`cusparseDcsrilu02_bufferSizeExt` |`hipsparseDcsrilu02_bufferSizeExt` |
|
||||
|`cusparseCcsrilu02_bufferSize` |`hipsparseCcsrilu02_bufferSize` |
|
||||
|`cusparseCcsrilu02_bufferSizeExt` |`hipsparseCcsrilu02_bufferSizeExt` |
|
||||
|`cusparseZcsrilu02_bufferSize` |`hipsparseZcsrilu02_bufferSize` |
|
||||
|`cusparseZcsrilu02_bufferSizeExt` |`hipsparseZcsrilu02_bufferSizeExt` |
|
||||
|`cusparseScsrilu02_analysis` |`hipsparseScsrilu02_analysis` |
|
||||
|`cusparseDcsrilu02_analysis` |`hipsparseDcsrilu02_analysis` |
|
||||
|`cusparseCcsrilu02_analysis` |`hipsparseCcsrilu02_analysis` |
|
||||
|`cusparseZcsrilu02_analysis` |`hipsparseZcsrilu02_analysis` |
|
||||
|`cusparseScsrilu02` |`hipsparseScsrilu02` |
|
||||
|`cusparseDcsrilu02` |`hipsparseDcsrilu02` |
|
||||
|`cusparseCcsrilu02` |`hipsparseCcsrilu02` |
|
||||
|`cusparseZcsrilu02` |`hipsparseZcsrilu02` |
|
||||
|`cusparseXbsric02_zeroPivot` |`hipsparseXcsrilu02_zeroPivot` |
|
||||
|`cusparseSbsrilu02_numericBoost` | |
|
||||
|`cusparseDbsrilu02_numericBoost` | |
|
||||
|`cusparseCbsrilu02_numericBoost` | |
|
||||
|`cusparseZbsrilu02_numericBoost` | |
|
||||
|`cusparseSbsrilu02_bufferSize` | |
|
||||
|`cusparseSbsrilu02_bufferSizeExt` | |
|
||||
|`cusparseDbsrilu02_bufferSize` | |
|
||||
|`cusparseDbsrilu02_bufferSizeExt` | |
|
||||
|`cusparseCbsrilu02_bufferSize` | |
|
||||
|`cusparseCbsrilu02_bufferSizeExt` | |
|
||||
|`cusparseZbsrilu02_bufferSize` | |
|
||||
|`cusparseZbsrilu02_bufferSizeExt` | |
|
||||
|`cusparseSbsrilu02_analysis` | |
|
||||
|`cusparseDbsrilu02_analysis` | |
|
||||
|`cusparseCbsrilu02_analysis` | |
|
||||
|`cusparseZbsrilu02_analysis` | |
|
||||
|`cusparseSbsrilu02` | |
|
||||
|`cusparseDbsrilu02` | |
|
||||
|`cusparseCbsrilu02` | |
|
||||
|`cusparseZbsrilu02` | |
|
||||
|`cusparseXbsrilu02_zeroPivot` | |
|
||||
|
||||
## ***7.3. Tridiagonal Solve***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSgtsv` | |
|
||||
|`cusparseDgtsv` | |
|
||||
|`cusparseCgtsv` | |
|
||||
|`cusparseZgtsv` | |
|
||||
|`cusparseSgtsv_nopivot` | |
|
||||
|`cusparseDgtsv_nopivot` | |
|
||||
|`cusparseCgtsv_nopivot` | |
|
||||
|`cusparseZgtsv_nopivot` | |
|
||||
|`cusparseSgtsv2_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDgtsv2_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseCgtsv2_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseZgtsv2_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSgtsv2` | | 9.0 |
|
||||
|`cusparseDgtsv2` | | 9.0 |
|
||||
|`cusparseCgtsv2` | | 9.0 |
|
||||
|`cusparseZgtsv2` | | 9.0 |
|
||||
|`cusparseSgtsv2_nopivot_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDgtsv2_nopivot_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseCgtsv2_nopivot_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseZgtsv2_nopivot_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSgtsv2_nopivot` | | 9.0 |
|
||||
|`cusparseDgtsv2_nopivot` | | 9.0 |
|
||||
|`cusparseCgtsv2_nopivot` | | 9.0 |
|
||||
|`cusparseZgtsv2_nopivot` | | 9.0 |
|
||||
|
||||
## ***7.4. Batched Tridiagonal Solve***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSgtsvStridedBatch` | |
|
||||
|`cusparseDgtsvStridedBatch` | |
|
||||
|`cusparseCgtsvStridedBatch` | |
|
||||
|`cusparseZgtsvStridedBatch` | |
|
||||
|`cusparseSgtsv2StridedBatch_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDgtsv2StridedBatch_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseCgtsv2StridedBatch_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseZgtsv2StridedBatch_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSgtsv2StridedBatch` | | 9.0 |
|
||||
|`cusparseDgtsv2StridedBatch` | | 9.0 |
|
||||
|`cusparseCgtsv2StridedBatch` | | 9.0 |
|
||||
|`cusparseZgtsv2StridedBatch` | | 9.0 |
|
||||
|`cusparseSgtsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseDgtsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseCgtsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseZgtsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseSgtsvInterleavedBatch` | | 9.2 |
|
||||
|`cusparseDgtsvInterleavedBatch` | | 9.2 |
|
||||
|`cusparseCgtsvInterleavedBatch` | | 9.2 |
|
||||
|`cusparseZgtsvInterleavedBatch` | | 9.2 |
|
||||
|
||||
## ***7.5. Batched Pentadiagonal Solve***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSgpsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseDgpsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseCgpsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseZgpsvInterleavedBatch_bufferSizeExt` | | 9.2 |
|
||||
|`cusparseSgpsvInterleavedBatch` | | 9.2 |
|
||||
|`cusparseDgpsvInterleavedBatch` | | 9.2 |
|
||||
|`cusparseCgpsvInterleavedBatch` | | 9.2 |
|
||||
|`cusparseZgpsvInterleavedBatch` | | 9.2 |
|
||||
|
||||
## **8. cuSPARSE Matrix Reorderings Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseScsrcolor` | |
|
||||
|`cusparseDcsrcolor` | |
|
||||
|`cusparseCcsrcolor` | |
|
||||
|`cusparseZcsrcolor` | |
|
||||
|
||||
## **9. cuSPARSE Format Conversion Reference**
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSbsr2csr` | |
|
||||
|`cusparseDbsr2csr` | |
|
||||
|`cusparseCbsr2csr` | |
|
||||
|`cusparseZbsr2csr` | |
|
||||
|`cusparseSgebsr2gebsc_bufferSize` | |
|
||||
|`cusparseSgebsr2gebsc_bufferSizeExt` | |
|
||||
|`cusparseDgebsr2gebsc_bufferSize` | |
|
||||
|`cusparseDgebsr2gebsc_bufferSizeExt` | |
|
||||
|`cusparseCgebsr2gebsc_bufferSize` | |
|
||||
|`cusparseCgebsr2gebsc_bufferSizeExt` | |
|
||||
|`cusparseZgebsr2gebsc_bufferSize` | |
|
||||
|`cusparseZgebsr2gebsc_bufferSizeExt` | |
|
||||
|`cusparseSgebsr2gebsc` | |
|
||||
|`cusparseDgebsr2gebsc` | |
|
||||
|`cusparseCgebsr2gebsc` | |
|
||||
|`cusparseZgebsr2gebsc` | |
|
||||
|`cusparseSgebsr2gebsr_bufferSize` | |
|
||||
|`cusparseSgebsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseDgebsr2gebsr_bufferSize` | |
|
||||
|`cusparseDgebsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseCgebsr2gebsr_bufferSize` | |
|
||||
|`cusparseCgebsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseZgebsr2gebsr_bufferSize` | |
|
||||
|`cusparseZgebsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseXgebsr2gebsrNnz` | |
|
||||
|`cusparseSgebsr2gebsr` | |
|
||||
|`cusparseDgebsr2gebsr` | |
|
||||
|`cusparseCgebsr2gebsr` | |
|
||||
|`cusparseZgebsr2gebsr` | |
|
||||
|`cusparseXgebsr2csr` | |
|
||||
|`cusparseSgebsr2csr` | |
|
||||
|`cusparseDgebsr2csr` | |
|
||||
|`cusparseCgebsr2csr` | |
|
||||
|`cusparseZgebsr2csr` | |
|
||||
|`cusparseScsr2gebsr_bufferSize` | |
|
||||
|`cusparseScsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseDcsr2gebsr_bufferSize` | |
|
||||
|`cusparseDcsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseCcsr2gebsr_bufferSize` | |
|
||||
|`cusparseCcsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseZcsr2gebsr_bufferSize` | |
|
||||
|`cusparseZcsr2gebsr_bufferSizeExt` | |
|
||||
|`cusparseXcsr2gebsrNnz` | |
|
||||
|`cusparseScsr2gebsr` | |
|
||||
|`cusparseDcsr2gebsr` | |
|
||||
|`cusparseCcsr2gebsr` | |
|
||||
|`cusparseZcsr2gebsr` | |
|
||||
|`cusparseXcoo2csr` |`hipsparseXcoo2csr` |
|
||||
|`cusparseScsc2dense` | |
|
||||
|`cusparseDcsc2dense` | |
|
||||
|`cusparseCcsc2dense` | |
|
||||
|`cusparseZcsc2dense` | |
|
||||
|`cusparseScsc2hyb` | |
|
||||
|`cusparseDcsc2hyb` | |
|
||||
|`cusparseCcsc2hyb` | |
|
||||
|`cusparseZcsc2hyb` | |
|
||||
|`cusparseXcsr2bsrNnz` | |
|
||||
|`cusparseScsr2bsr` | |
|
||||
|`cusparseDcsr2bsr` | |
|
||||
|`cusparseCcsr2bsr` | |
|
||||
|`cusparseZcsr2bsr` | |
|
||||
|`cusparseXcsr2coo` |`hipsparseXcsr2coo` |
|
||||
|`cusparseScsr2csc` |`hipsparseScsr2csc` |
|
||||
|`cusparseDcsr2csc` |`hipsparseDcsr2csc` |
|
||||
|`cusparseCcsr2csc` |`hipsparseCcsr2csc` |
|
||||
|`cusparseZcsr2csc` |`hipsparseZcsr2csc` |
|
||||
|`cusparseCsr2cscEx` | | 8.0 |
|
||||
|`cusparseCsr2cscEx2` | | 10.1 |
|
||||
|`cusparseCsr2cscEx2_bufferSize` | | 10.1 |
|
||||
|`cusparseScsr2dense` | |
|
||||
|`cusparseDcsr2dense` | |
|
||||
|`cusparseCcsr2dense` | |
|
||||
|`cusparseZcsr2dense` | |
|
||||
|`cusparseScsr2csr_compress` | | 8.0 |
|
||||
|`cusparseDcsr2csr_compress` | | 8.0 |
|
||||
|`cusparseCcsr2csr_compress` | | 8.0 |
|
||||
|`cusparseZcsr2csr_compress` | | 8.0 |
|
||||
|`cusparseScsr2hyb` |`hipsparseScsr2hyb` |
|
||||
|`cusparseDcsr2hyb` |`hipsparseDcsr2hyb` |
|
||||
|`cusparseCcsr2hyb` |`hipsparseCcsr2hyb` |
|
||||
|`cusparseZcsr2hyb` |`hipsparseZcsr2hyb` |
|
||||
|`cusparseSdense2csc` | |
|
||||
|`cusparseDdense2csc` | |
|
||||
|`cusparseCdense2csc` | |
|
||||
|`cusparseZdense2csc` | |
|
||||
|`cusparseSdense2csr` | |
|
||||
|`cusparseDdense2csr` | |
|
||||
|`cusparseCdense2csr` | |
|
||||
|`cusparseZdense2csr` | |
|
||||
|`cusparseSdense2hyb` | |
|
||||
|`cusparseDdense2hyb` | |
|
||||
|`cusparseCdense2hyb` | |
|
||||
|`cusparseZdense2hyb` | |
|
||||
|`cusparseShyb2csc` | |
|
||||
|`cusparseDhyb2csc` | |
|
||||
|`cusparseChyb2csc` | |
|
||||
|`cusparseZhyb2csc` | |
|
||||
|`cusparseShyb2csr` | |
|
||||
|`cusparseDhyb2csr` | |
|
||||
|`cusparseChyb2csr` | |
|
||||
|`cusparseZhyb2csr` | |
|
||||
|`cusparseShyb2dense` | |
|
||||
|`cusparseDhyb2dense` | |
|
||||
|`cusparseChyb2dense` | |
|
||||
|`cusparseZhyb2dense` | |
|
||||
|`cusparseSnnz` |`cusparseSnnz` |
|
||||
|`cusparseDnnz` |`cusparseDnnz` |
|
||||
|`cusparseCnnz` |`cusparseCnnz` |
|
||||
|`cusparseZnnz` |`cusparseZnnz` |
|
||||
|`cusparseCreateIdentityPermutation` |`hipsparseCreateIdentityPermutation` |
|
||||
|`cusparseXcoosort_bufferSizeExt` |`hipsparseXcoosort_bufferSizeExt` |
|
||||
|`cusparseXcoosortByRow` |`hipsparseXcoosortByRow` |
|
||||
|`cusparseXcoosortByColumn` |`hipsparseXcoosortByColumn` |
|
||||
|`cusparseXcsrsort_bufferSizeExt` |`hipsparseXcsrsort_bufferSizeExt` |
|
||||
|`cusparseXcsrsort` |`hipsparseXcsrsort` |
|
||||
|`cusparseXcscsort_bufferSizeExt` |`hipsparseXcscsort_bufferSizeExt` |
|
||||
|`cusparseXcscsort` |`hipsparseXcscsort` |
|
||||
|`cusparseCreateCsru2csrInfo` | |
|
||||
|`cusparseDestroyCsru2csrInfo` | |
|
||||
|`cusparseScsru2csr_bufferSizeExt` | |
|
||||
|`cusparseDcsru2csr_bufferSizeExt` | |
|
||||
|`cusparseCcsru2csr_bufferSizeExt` | |
|
||||
|`cusparseZcsru2csr_bufferSizeExt` | |
|
||||
|`cusparseScsru2csr` | |
|
||||
|`cusparseDcsru2csr` | |
|
||||
|`cusparseCcsru2csr` | |
|
||||
|`cusparseZcsru2csr` | |
|
||||
|`cusparseScsr2csru` | |
|
||||
|`cusparseDcsr2csru` | |
|
||||
|`cusparseCcsr2csru` | |
|
||||
|`cusparseZcsr2csru` | |
|
||||
|`cusparseHpruneDense2csr` | | 9.0 |
|
||||
|`cusparseSpruneDense2csr` | | 9.0 |
|
||||
|`cusparseDpruneDense2csr` | | 9.0 |
|
||||
|`cusparseHpruneDense2csr_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSpruneDense2csr_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDpruneDense2csr_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseHpruneDense2csrNnz` | | 9.0 |
|
||||
|`cusparseSpruneDense2csrNnz` | | 9.0 |
|
||||
|`cusparseDpruneDense2csrNnz` | | 9.0 |
|
||||
|`cusparseHpruneCsr2csr` | | 9.0 |
|
||||
|`cusparseSpruneCsr2csr` | | 9.0 |
|
||||
|`cusparseDpruneCsr2csr` | | 9.0 |
|
||||
|`cusparseHpruneCsr2csr_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSpruneCsr2csr_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDpruneCsr2csr_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseHpruneCsr2csrNnz` | | 9.0 |
|
||||
|`cusparseSpruneCsr2csrNnz` | | 9.0 |
|
||||
|`cusparseDpruneCsr2csrNnz` | | 9.0 |
|
||||
|`cusparseHpruneDense2csrByPercentage` | | 9.0 |
|
||||
|`cusparseSpruneDense2csrByPercentage` | | 9.0 |
|
||||
|`cusparseDpruneDense2csrByPercentage` | | 9.0 |
|
||||
|`cusparseHpruneDense2csrByPercentage_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSpruneDense2csrByPercentage_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDpruneDense2csrByPercentage_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseHpruneDense2csrNnzByPercentage` | | 9.0 |
|
||||
|`cusparseSpruneDense2csrNnzByPercentage` | | 9.0 |
|
||||
|`cusparseDpruneDense2csrNnzByPercentage` | | 9.0 |
|
||||
|`cusparseHpruneCsr2csrByPercentage` | | 9.0 |
|
||||
|`cusparseSpruneCsr2csrByPercentage` | | 9.0 |
|
||||
|`cusparseDpruneCsr2csrByPercentage` | | 9.0 |
|
||||
|`cusparseHpruneCsr2csrByPercentage_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseSpruneCsr2csrByPercentage_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseDpruneCsr2csrByPercentage_bufferSizeExt` | | 9.0 |
|
||||
|`cusparseHpruneCsr2csrNnzByPercentage` | | 9.0 |
|
||||
|`cusparseSpruneCsr2csrNnzByPercentage` | | 9.0 |
|
||||
|`cusparseDpruneCsr2csrNnzByPercentage` | | 9.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**
|
||||
|
||||
## ***10.1. Generic Sparse API helper functions***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseCreateCoo` | | 10.1 |
|
||||
|`cusparseCreateCooAoS` | | 10.1 |
|
||||
|`cusparseCreateCsr` | | 10.1 |
|
||||
|`cusparseDestroySpMat` | | 10.1 |
|
||||
|`cusparseCooGet` | | 10.1 |
|
||||
|`cusparseCooAoSGet` | | 10.1 |
|
||||
|`cusparseCsrGet` | | 10.1 |
|
||||
|`cusparseSpMatGetFormat` | | 10.1 |
|
||||
|`cusparseSpMatGetIndexBase` | | 10.1 |
|
||||
|`cusparseSpMatGetValues` | | 10.1 |
|
||||
|`cusparseSpMatSetValues` | | 10.1 |
|
||||
|`cusparseSpMatGetStridedBatch` | | 10.1 |
|
||||
|`cusparseSpMatSetStridedBatch` | | 10.1 |
|
||||
|`cusparseSpMatGetNumBatches` | | 10.1 |
|
||||
|`cusparseSpMatSetNumBatches` | | 10.1 |
|
||||
|`cusparseCreateSpVec` | | 10.1 |
|
||||
|`cusparseDestroySpVec` | | 10.1 |
|
||||
|`cusparseSpVecGet` | | 10.1 |
|
||||
|`cusparseSpVecGetIndexBase` | | 10.1 |
|
||||
|`cusparseSpVecGetValues` | | 10.1 |
|
||||
|`cusparseSpVecSetValues` | | 10.1 |
|
||||
|
||||
## ***10.2. Generic Dense API helper functions***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseCreateDnMat` | | 10.1 |
|
||||
|`cusparseDestroyDnMat` | | 10.1 |
|
||||
|`cusparseDnMatGet` | | 10.1 |
|
||||
|`cusparseDnMatGetValues` | | 10.1 |
|
||||
|`cusparseDnMatSetValues` | | 10.1 |
|
||||
|`cusparseDnMatSetStridedBatch` | | 10.1 |
|
||||
|`cusparseDnMatGetStridedBatch` | | 10.1 |
|
||||
|`cusparseCreateDnVec` | | 10.1 |
|
||||
|`cusparseDestroyDnVec` | | 10.1 |
|
||||
|`cusparseDnVecGet` | | 10.1 |
|
||||
|`cusparseDnVecGetValues` | | 10.1 |
|
||||
|`cusparseDnVecSetValues` | | 10.1 |
|
||||
|
||||
## ***10.3. Generic SpMM API functions***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSpMM` | | 10.1 |
|
||||
|`cusparseSpMM_bufferSize` | | 10.1 |
|
||||
|
||||
## ***10.4. Generic SpVV API functions [Undocumented]***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSpVV` | | 10.1 |
|
||||
|`cusparseSpVV_bufferSize` | | 10.1 |
|
||||
|
||||
## ***10.5. Generic SpMV API functions [Undocumented]***
|
||||
|
||||
| **CUDA** | **HIP** |**CUDA version\***|
|
||||
|-----------------------------------------------------------|-------------------------------------------------|:----------------:|
|
||||
|`cusparseSpMV` | | 10.1 |
|
||||
|`cusparseSpMV_bufferSize` | | 10.1 |
|
||||
|
||||
\* CUDA version, in which API has appeared and (optional) last version before abandoning it; no value in case of earlier versions < 7.5.
|
||||
@@ -33,6 +33,7 @@
|
||||
- [Why _OpenMP is undefined when compiling with -fopenmp?](#why-_openmp-is-undefined-when-compiling-with--fopenmp)
|
||||
- [Does the HIP-Clang compiler support extern shared declarations?](#does-the-hip-clang-compiler-support-extern-shared-declarations)
|
||||
- [I have multiple HIP enabled devices and I am getting an error message hipErrorNoBinaryForGpu: Unable to find code object for all current devices?](#i-have-multiple-hip-enabled-devices-and-i-am-getting-an-error-message-hipErrorNoBinaryForGpu-unable-to-find-code-object-for-all-current-devices)
|
||||
- [How to use per-thread default stream in HIP?](#how-to-use-per-thread-default-stream-in-hip)
|
||||
- [How can I know the version of HIP?](#how-can-I-know-the-version-of-hip)
|
||||
<!-- tocstop -->
|
||||
|
||||
@@ -94,7 +95,7 @@ However, we can provide a rough summary of the features included in each CUDA SD
|
||||
- CUDA 6.5 :
|
||||
- __shfl intriniscs (supported)
|
||||
- CUDA 7.0 :
|
||||
- Per-thread-streams (under development)
|
||||
- Per-thread default streams (supported)
|
||||
- C++11 (Hip-Clang supports all of C++11, all of C++14 and some C++17 features)
|
||||
- CUDA 7.5 :
|
||||
- float16 (supported)
|
||||
@@ -260,6 +261,18 @@ If you have a precompiled application/library (like rocblas, tensorflow etc) whi
|
||||
- The application/library does not ship code object bundles for *all* of your device(s): in this case you need to recompile the application/library yourself with correct `--offload-arch`.
|
||||
- The application/library does not ship code object bundles for *some* of your device(s), for example you have a system with an APU + GPU and the library does not ship code objects for your APU. For this you can set the environment variable `HIP_VISIBLE_DEVICES` to only enable GPUs for which code object is available. This will limit the GPUs visible to your application and allow it to run.
|
||||
|
||||
### How to use per-thread default stream in HIP?
|
||||
|
||||
The per-thread default stream is an implicit stream local to both the thread and the current device. It does not do any implicit synchronization with other streams (like explicitly created streams), or default per-thread stream on other threads.
|
||||
|
||||
The per-thread default stream is a blocking stream and will synchronize with the default null stream if both are used in a program.
|
||||
|
||||
In ROCm, a compilation option should be added in order to compile the translation unit with per-thread default stream enabled.
|
||||
“-fgpu-default-stream=per-thread”.
|
||||
Once source is compiled with per-thread default stream enabled, all APIs will be executed on per thread default stream, hence there will not be any implicit synchronization with other streams.
|
||||
|
||||
Besides, per-thread default stream be enabled per translation unit, users can compile some files with feature enabled and some with feature disabled. Feature enabled translation unit will have default stream as per thread and there will not be any implicit synchronization done but other modules will have legacy default stream which will do implicit synchronization.
|
||||
|
||||
### How can I know the version of HIP?
|
||||
|
||||
HIP version definition has been updated since ROCm 4.2 release as the following:
|
||||
|
||||
@@ -139,6 +139,15 @@ This implementation does not require the use of `hipDeviceSetLimit(hipLimitMallo
|
||||
|
||||
The test codes in the link (https://github.com/ROCm-Developer-Tools/HIP/blob/develop/tests/src/deviceLib/hipDeviceMalloc.cpp) show how to implement application using malloc and free functions in device kernels.
|
||||
|
||||
## Use of Per-thread default stream
|
||||
|
||||
The per-thread default stream is supported in HIP. It is an implicit stream local to both the thread and the current device. This means that the command issued to the per-thread default stream by the thread does not implicitly synchronize with other streams (like explicitly created streams), or default per-thread stream on other threads.
|
||||
The per-thread default stream is a blocking stream and will synchronize with the default null stream if both are used in a program.
|
||||
The per-thread default stream can be enabled via adding a compilation option,
|
||||
“-fgpu-default-stream=per-thread”.
|
||||
|
||||
And users can explicitly use "hipStreamPerThread" as per-thread default stream handle as input in API commands. There are test codes as examples in the link (https://github.com/ROCm-Developer-Tools/HIP/tree/develop/tests/catch/unit/streamperthread).
|
||||
|
||||
## Use of Long Double Type
|
||||
|
||||
In HIP-Clang, long double type is 80-bit extended precision format for x86_64, which is not supported by AMDGPU. HIP-Clang treats long double type as IEEE double type for AMDGPU. Using long double type in HIP source code will not cause issue as long as data of long double type is not transferred between host and device. However, long double type should not be used as kernel argument type.
|
||||
|
||||
@@ -10,7 +10,9 @@ NOTE:
|
||||
- But it does depend on COMGr. We may try to statically link COMGr into hipRTC to avoid any ambiguity.
|
||||
- Developers can decide to bundle this library with their application.
|
||||
|
||||
## Example
|
||||
## Compile APIs
|
||||
|
||||
#### Example
|
||||
To use hiprtc functionality, hiprtc header needs to be included first.
|
||||
```#include <hip/hiprtc.h>```
|
||||
|
||||
@@ -68,7 +70,7 @@ size_t codeSize;
|
||||
hiprtcGetCodeSize(prog, &codeSize);
|
||||
|
||||
vector<char> kernel_binary(codeSize);
|
||||
hiprtcGetCode(kernel_binary, code.data());
|
||||
hiprtcGetCode(prog, kernel_binary.data());
|
||||
```
|
||||
|
||||
After loading the binary, hiprtcProgram can be destroyed.
|
||||
@@ -87,12 +89,218 @@ And now this kernel can be launched via hipModule APIs.
|
||||
|
||||
Please have a look at saxpy.cpp and hiprtcGetLoweredName.cpp files for a detailed example.
|
||||
|
||||
## HIPRTC specific options
|
||||
#### HIPRTC specific options
|
||||
HIPRTC provides a few hiprtc specific flags
|
||||
- ```--gpu-architecture``` : This flag can guide the code object generation for a specific gpu arch. Example: ```--gpu-architecture=gfx906:sramecc+:xnack-```, its equivalent to ```--offload-arch```.
|
||||
- This option is compulsory if compilation is done on a system without AMD GPUs supported by HIP runtime.
|
||||
- Otherwise, hipRTC will load the hip runtime and gather the current device and its architecture info and use it as option.
|
||||
- ```-fgpu-rdc``` : This flag when provided during the hiprtcCompileProgram generates the bitcode (HIPRTC doesn't convert this bitcode into ISA and binary). This bitcode can later be fetched using hiprtcGetBitcode and hiprtcGetBitcodeSize APIs.
|
||||
|
||||
#### Bitcode
|
||||
In the usual scenario, the kernel associated with hiprtcProgram is compiled into the binary which can be loaded and run. However, if -fpu-rdc option is provided in the compile options, HIPRTC calls comgr and generates only the LLVM bitcode. It doesn't convert this bitcode to ISA and generate the final binary.
|
||||
```cpp
|
||||
std::string sarg = std::string("-fgpu-rdc");
|
||||
const char* options[] = {
|
||||
sarg.c_str() };
|
||||
hiprtcCompileProgram(prog, // hiprtcProgram
|
||||
1, // Number of options
|
||||
options);
|
||||
```
|
||||
|
||||
If the compilation is successful, one can load the bitcode in a local variable using the bitcode APIs provided by HIPRTC.
|
||||
```cpp
|
||||
size_t bitCodeSize;
|
||||
hiprtcGetBitcodeSize(prog, &bitCodeSize);
|
||||
|
||||
vector<char> kernel_bitcode(bitCodeSize);
|
||||
hiprtcGetBitcode(prog, kernel_bitcode.data());
|
||||
```
|
||||
|
||||
## Linker APIs
|
||||
|
||||
#### Introduction
|
||||
The bitcode generated using the HIPRTC Bitcode APIs can be loaded using hipModule APIs and also can be linked with other generated bitcodes with appropriate linker flags using the HIPRTC linker APIs. This also provides more flexibility and optimizations to the applications who want to generate the binary dynamically according to their needs. The input bitcodes can be generated only for a specific architecture or it can be a bundled bitcode which is generated for multiple architectures.
|
||||
|
||||
#### Example
|
||||
Firstly, hiprtc link instance or a pending linker invocation must be created using hiprtcLinkCreate, with the appropriate linker options provided.
|
||||
```cpp
|
||||
hiprtcLinkCreate( num_options, // number of options
|
||||
options, // Array of options
|
||||
option_vals, // Array of option values cast to void*
|
||||
&rtc_link_state ); // hiprtc link state created upon success
|
||||
```
|
||||
|
||||
Following which, the bitcode data can be added to this link instance via hiprtcLinkAddData (if the data is present as a string) or hiprtcLinkAddFile (if the data is present as a file) with the appropriate input type according to the data or the bitcode used.
|
||||
```cpp
|
||||
hiprtcLinkAddData(rtc_link_state, // hiprtc link state
|
||||
input_type, // type of the input data or bitcode
|
||||
bit_code_ptr, // input data which is null terminated
|
||||
bit_code_size, // size of the input data
|
||||
"a", // optional name for this input
|
||||
0, // size of the options
|
||||
0, // Array of options applied to this input
|
||||
0); // Array of option values cast to void*
|
||||
```
|
||||
```cpp
|
||||
hiprtcLinkAddFile(rtc_link_state, // hiprtc link state
|
||||
input_type, // type of the input data or bitcode
|
||||
bc_file_path.c_str(), // path to the input file where bitcode is present
|
||||
0, // size of the options
|
||||
0, // Array of options applied to this input
|
||||
0); // Array of option values cast to void*
|
||||
```
|
||||
|
||||
Once the bitcodes for multiple archs are added to the link instance, the linking of the device code must be completed using hiprtcLinkComplete which generates the final binary.
|
||||
```cpp
|
||||
hiprtcLinkComplete(rtc_link_state, // hiprtc link state
|
||||
&binary, // upon success, points to the output binary
|
||||
&binarySize); // size of the binary is stored (optional)
|
||||
```
|
||||
|
||||
If the hiprtcLinkComplete returns successfully, the generated binary can be loaded and run using the hipModule* APIs.
|
||||
```cpp
|
||||
hipModuleLoadData( &module, binary );
|
||||
```
|
||||
|
||||
#### Note
|
||||
- The compiled binary must be loaded before hiprtc link instance is destroyed using the hiprtcLinkDestroy API.
|
||||
```cpp
|
||||
hiprtcLinkDestroy( rtc_link_state);
|
||||
```
|
||||
- The correct sequence of calls is : hiprtcLinkCreate, hiprtcLinkAddData or hiprtcLinkAddFile, hiprtcLinkComplete, hiprtcModuleLoadData, hiprtcLinkDestroy.
|
||||
|
||||
#### Input Types
|
||||
HIPRTC provides hiprtcJITInputType enumeration type which defines the input types accepted by the Linker APIs. Here are the enum values of hiprtcJITInputType. However only the input types HIPRTC_JIT_INPUT_LLVM_BITCODE, HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE and HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE are supported currently.
|
||||
|
||||
```cpp
|
||||
HIPRTC_JIT_INPUT_CUBIN = 0,
|
||||
HIPRTC_JIT_INPUT_PTX,
|
||||
HIPRTC_JIT_INPUT_FATBINARY,
|
||||
HIPRTC_JIT_INPUT_OBJECT,
|
||||
HIPRTC_JIT_INPUT_LIBRARY,
|
||||
HIPRTC_JIT_INPUT_NVVM,
|
||||
HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES,
|
||||
HIPRTC_JIT_INPUT_LLVM_BITCODE = 100,
|
||||
HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE = 101,
|
||||
HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE = 102,
|
||||
HIPRTC_JIT_NUM_INPUT_TYPES = (HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES + 3)
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
HIPRTC defines the hiprtcResult enumeration type and a function hiprtcGetErrorString for API call error handling. hiprtcResult enum defines the API result codes. HIPRTC APIs return hiprtcResult to indicate the call result. hiprtcGetErrorString function returns a string describing the given hiprtcResult code, e.g., HIPRTC_SUCCESS to "HIPRTC_SUCCESS". For unrecognized enumeration values, it returns "Invalid HIPRTC error code".
|
||||
|
||||
hiprtcResult enum supported values and the hiprtcGetErrorString usage are mentioned below.
|
||||
```cpp
|
||||
HIPRTC_SUCCESS = 0,
|
||||
HIPRTC_ERROR_OUT_OF_MEMORY = 1,
|
||||
HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
|
||||
HIPRTC_ERROR_INVALID_INPUT = 3,
|
||||
HIPRTC_ERROR_INVALID_PROGRAM = 4,
|
||||
HIPRTC_ERROR_INVALID_OPTION = 5,
|
||||
HIPRTC_ERROR_COMPILATION = 6,
|
||||
HIPRTC_ERROR_LINKING = 7,
|
||||
HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 8,
|
||||
HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 9,
|
||||
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 10,
|
||||
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 11,
|
||||
HIPRTC_ERROR_INTERNAL_ERROR = 12
|
||||
```
|
||||
```cpp
|
||||
hiprtcResult result;
|
||||
result = hiprtcCompileProgram(prog, 1, opts);
|
||||
if (result != HIPRTC_SUCCESS) {
|
||||
std::cout << "hiprtcCompileProgram fails with error " << hiprtcGetErrorString(result);
|
||||
}
|
||||
```
|
||||
|
||||
## HIPRTC General APIs
|
||||
HIPRTC provides the following API for querying the version.
|
||||
|
||||
hiprtcVersion(int* major, int* minor) - This sets the output parameters major and minor with the HIP Runtime compilation major version and minor version number respectively.
|
||||
|
||||
Currently, it returns hardcoded value. This should be implemented to return HIP runtime major and minor version in the future releases.
|
||||
|
||||
## Lowered Names (Mangled Names)
|
||||
HIPRTC mangles the ```__global__``` function names and names of ```__device__``` and ```__constant__``` variables. If the generated binary is being loaded using the HIP Runtime API, the kernel function or ```__device__/__constant__``` variable must be looked up by name, but this is very hard when the name has been mangled. To overcome this, HIPRTC provides API functions that map ```__global__``` function or ```__device__/__constant__``` variable names in the source to the mangled names present in the generated binary.
|
||||
|
||||
The two APIs hiprtcAddNameExpression and hiprtcGetLoweredName provide this functionality. First, a 'name expression' string denoting the address for the ```__global__``` function or ```__device__/__constant__``` variable is provided to hiprtcAddNameExpression. Then, the program is compiled with hiprtcCompileProgram. During compilation, HIPRTC will parse the name expression string as a C++ constant expression at the end of the user program. Finally, the function hiprtcGetLoweredName is called with the original name expression and it returns a pointer to the lowered name. The lowered name can be used to refer to the kernel or variable in the HIP Runtime API.
|
||||
|
||||
#### Note
|
||||
- The identical name expression string must be provided on a subsequent call to hiprtcGetLoweredName to extract the lowered name.
|
||||
- The correct sequence of calls is : hiprtcAddNameExpression, hiprtcCompileProgram, hiprtcGetLoweredName, hiprtcDestroyProgram.
|
||||
- The lowered names must be fetched using hiprtcGetLoweredName only after the HIPRTC program has been compiled, and before it has been destroyed.
|
||||
|
||||
#### Example
|
||||
kernel containing various definitions ```__global__``` functions/function templates and ```__device__/__constant__``` variables can be stored in a string.
|
||||
|
||||
```cpp
|
||||
static constexpr const char gpu_program[]{
|
||||
R"(
|
||||
__device__ int V1; // set from host code
|
||||
static __global__ void f1(int *result) { *result = V1 + 10; }
|
||||
namespace N1 {
|
||||
namespace N2 {
|
||||
__constant__ int V2; // set from host code
|
||||
__global__ void f2(int *result) { *result = V2 + 20; }
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
__global__ void f3(int *result) { *result = sizeof(T); }
|
||||
)"};
|
||||
```
|
||||
hiprtcAddNameExpression is called with various name expressions referring to the address of ```__global__``` functions and ```__device__/__constant__``` variables.
|
||||
|
||||
```cpp
|
||||
kernel_name_vec.push_back("&f1");
|
||||
kernel_name_vec.push_back("N1::N2::f2");
|
||||
kernel_name_vec.push_back("f3<int>");
|
||||
for (auto&& x : kernel_name_vec) hiprtcAddNameExpression(prog, x.c_str());
|
||||
variable_name_vec.push_back("&V1");
|
||||
variable_name_vec.push_back("&N1::N2::V2");
|
||||
for (auto&& x : variable_name_vec) hiprtcAddNameExpression(prog, x.c_str());
|
||||
```
|
||||
|
||||
After which, the program is compiled using hiprtcCompileProgram and the generated binary is loaded using hipModuleLoadData. And the mangled names can be fetched using hirtcGetLoweredName.
|
||||
```cpp
|
||||
for (decltype(variable_name_vec.size()) i = 0; i != variable_name_vec.size(); ++i) {
|
||||
const char* name;
|
||||
hiprtcGetLoweredName(prog, variable_name_vec[i].c_str(), &name);
|
||||
}
|
||||
```
|
||||
```cpp
|
||||
for (decltype(kernel_name_vec.size()) i = 0; i != kernel_name_vec.size(); ++i) {
|
||||
const char* name;
|
||||
hiprtcGetLoweredName(prog, kernel_name_vec[i].c_str(), &name);
|
||||
}
|
||||
```
|
||||
|
||||
The mangled name of the variables are used to look up the variable in the module and update its value.
|
||||
```
|
||||
hipDeviceptr_t variable_addr;
|
||||
size_t bytes{};
|
||||
hipModuleGetGlobal(&variable_addr, &bytes, module, name);
|
||||
hipMemcpyHtoD(variable_addr, &initial_value, sizeof(initial_value));
|
||||
```
|
||||
|
||||
Finally, the mangled name of the kernel is used to launch it using the hipModule APIs.
|
||||
|
||||
```cpp
|
||||
hipFunction_t kernel;
|
||||
hipModuleGetFunction(&kernel, module, name);
|
||||
hipModuleLaunchKernel(kernel, 1, 1, 1, 1, 1, 1, 0, nullptr, nullptr, config);
|
||||
```
|
||||
|
||||
Please have a look at hiprtcGetLoweredName.cpp for the detailed example.
|
||||
|
||||
## Versioning
|
||||
HIPRTC follows the below versioning.
|
||||
- Linux
|
||||
- HIPRTC follows the same versioning as HIP runtime library.
|
||||
- The soname field for the shared library is set to MAJOR version. eg: For HIP 5.3 the soname is set to 5 (hiprtc.so.5).
|
||||
- Windows
|
||||
- Currently, the HIPRTC dll doesn't have any version attached. It is just named as hiprtc.dll.
|
||||
- In the upcoming releases, HIPRTC dll will be named as hiprtc_XXYY.dll where XX is MAJOR version and YY is MINOR version. eg: For HIP 5.3 the name is hiprtc_0503.dll.
|
||||
|
||||
## Deprecation notice
|
||||
Currently HIPRTC APIs are separated from HIP APIs and HIPRTC is available as a separate library libhiprtc.so/libhiprtc.dll. But hiprtc symbols are present in libhipamd64.so/libhipamd64.dll in order to support the existing applications. Gradually, these symbols will be removed from HIP library and applications using HIPRTC will be required to explictly link to HIPRTC library.
|
||||
Currently HIPRTC APIs are separated from HIP APIs and HIPRTC is available as a separate library libhiprtc.so/libhiprtc.dll. But on Linux, HIPRTC symbols are also present in libhipamd64.so in order to support the existing applications. Gradually, these symbols will be removed from HIP library and applications using HIPRTC will be required to explictly link to HIPRTC library. However, on Windows hiprtc.dll must be used as the hipamd64.dll doesn't contain the HIPRTC symbols.
|
||||
|
||||
|
||||
@@ -0,0 +1,468 @@
|
||||
# HIP C++ Feature
|
||||
|
||||
## C++ 11
|
||||
|
||||
### Rvalue References
|
||||
|
||||
```cpp
|
||||
struct Y {
|
||||
int x;
|
||||
};
|
||||
|
||||
__device__ void do_something(Y &&val) { val.x += 1; }
|
||||
|
||||
__global__ void kernel() {
|
||||
Y y{10};
|
||||
// do_something(y); // does not compile since the argument is an lvalue
|
||||
do_something(std::move(y));
|
||||
}
|
||||
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Rvalue References for `*this`
|
||||
|
||||
```cpp
|
||||
struct Sample {
|
||||
__host__ __device__ void callMe() & { printf("Lval Func\n"); }
|
||||
__host__ __device__ void callMe() && { printf("Rval Func\n"); }
|
||||
};
|
||||
|
||||
__global__ void kernel() {
|
||||
Sample s;
|
||||
s.callMe(); // prints Lval Func
|
||||
Sample().callMe(); // prints Rval Func
|
||||
}
|
||||
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Variadic templates, Static Assertions, `auto` Variables
|
||||
|
||||
```cpp
|
||||
template <typename T> __host__ __device__ T add(T val) { return val; }
|
||||
|
||||
template <typename T, typename... Targs>
|
||||
__host__ __device__ T add(T val, Targs... pVal) {
|
||||
static_assert(std::is_arithmetic<T>::value, "Not a valid type");
|
||||
return val + add(pVal...);
|
||||
}
|
||||
|
||||
template <typename T, typename... Targs>
|
||||
__global__ void kernel(T *ptr, Targs... args) {
|
||||
auto &&sum = add(args...);
|
||||
*ptr = sum;
|
||||
}
|
||||
|
||||
// Or something like
|
||||
|
||||
__device__ int &getX(int &x) { return ++x; }
|
||||
__device__ int getY(int &x) { return x + 10; }
|
||||
|
||||
__global__ void kernel() {
|
||||
int X = 0;
|
||||
auto &&x = getX(X);
|
||||
auto &&y = getY(X);
|
||||
|
||||
// Init with value or initializer list
|
||||
auto val{10};
|
||||
auto list = {10};
|
||||
}
|
||||
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Non-static Data Member Initialization
|
||||
|
||||
```cpp
|
||||
struct S {
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
};
|
||||
|
||||
__global__ void kernel() {
|
||||
S s; // s.a == 1 and s.b == 2
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Lambda Device Functions
|
||||
|
||||
```cpp
|
||||
template <typename T> __global__ void kernel(T f) { f(); }
|
||||
|
||||
int main() {
|
||||
auto func = [=] __device__() { printf("In Kernel\n"); };
|
||||
kernel<<<1, 1>>>(func);
|
||||
hipDeviceSynchronize();
|
||||
}
|
||||
```
|
||||
|
||||
### `decltype` Usage
|
||||
|
||||
```cpp
|
||||
template <typename T> __device__ T ret() {
|
||||
T x{0};
|
||||
return x;
|
||||
}
|
||||
|
||||
template <typename T> __global__ void kernel() {
|
||||
decltype(ret<T>()) a;
|
||||
int i = 0;
|
||||
decltype(i) j = i + 1;
|
||||
}
|
||||
int main() { kernel<float><<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Default Template Arguments
|
||||
|
||||
```cpp
|
||||
template <int N = 5> __global__ void kernel(int x) { x += N; }
|
||||
int main() {
|
||||
kernel<<<1, 1>>>(1);
|
||||
kernel<-2><<<1, 1>>>(1);
|
||||
}
|
||||
```
|
||||
|
||||
### Template Alias
|
||||
|
||||
```cpp
|
||||
template <typename T> struct Alloc {};
|
||||
|
||||
template <typename T, typename U> struct Vector {};
|
||||
|
||||
template <typename T> using V = Vector<T, Alloc<T>>;
|
||||
|
||||
template <typename T> __global__ void kernel(T x) { V<T> v; }
|
||||
|
||||
int main() { kernel<<<1, 1>>>(5); }
|
||||
```
|
||||
|
||||
### Extern Template
|
||||
|
||||
```cpp
|
||||
template <typename T> __global__ void kernel(T x) {}
|
||||
|
||||
extern template __global__ void kernel(long x);
|
||||
|
||||
int main() {
|
||||
kernel<<<1, 1, 0, 0>>>(10); // will create a template specialization
|
||||
// kernel<<<1,1,0,0>>>(10l); // looks for existing kernel<long>, causing
|
||||
// linking to fail
|
||||
}
|
||||
```
|
||||
|
||||
### `nullptr` as a Keyword in Device Compiler
|
||||
|
||||
```cpp
|
||||
__global__ void kernel() {
|
||||
int *ptr = nullptr;
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Strongly Typed Enums
|
||||
|
||||
```cpp
|
||||
enum class EnumVals { Red, Blue, Green };
|
||||
__global__ void kernel() {
|
||||
auto val = EnumVals::Red;
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Standardized Attribute Syntax
|
||||
|
||||
```cpp
|
||||
[[deprecated]] __global__ void kernel() {
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### `constexpr`
|
||||
|
||||
```cpp
|
||||
struct S {
|
||||
constexpr __device__ S(double v) : val(v) {}
|
||||
constexpr __device__ double value() const { return val; }
|
||||
|
||||
private:
|
||||
double val;
|
||||
};
|
||||
|
||||
constexpr __device__ int factorial(int n) {
|
||||
return n <= 1 ? 1 : (n * factorial(n - 1));
|
||||
}
|
||||
|
||||
__global__ void kernel() {
|
||||
constexpr S s(factorial(5));
|
||||
constexpr double d = s.value();
|
||||
// ...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### `alignas` with Struct
|
||||
|
||||
```cpp
|
||||
struct alignas(alignof(int)) S {
|
||||
//...
|
||||
};
|
||||
|
||||
__global__ void kernel() {
|
||||
S s;
|
||||
static_assert(alignof(S) == alignof(int), "they have the same alignment");
|
||||
// check the alignment
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Delegating Constructors
|
||||
|
||||
```cpp
|
||||
struct S {
|
||||
private:
|
||||
int val;
|
||||
|
||||
public:
|
||||
__device__ S(int v) : val(v) {}
|
||||
__device__ S() : S(42) {}
|
||||
};
|
||||
__global__ void kernel() { S s{}; }
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Explicit Conversion Functions
|
||||
|
||||
```cpp
|
||||
struct S {
|
||||
private:
|
||||
int val;
|
||||
|
||||
public:
|
||||
__device__ S(int val) : val(val) {}
|
||||
__device__ explicit operator int *() { return &val; }
|
||||
};
|
||||
|
||||
__global__ void kernel() {
|
||||
S s{0};
|
||||
// if (s) { // compile error
|
||||
// without the explicit function specifier then s would be converted to the
|
||||
// pointer to s.val, which would be non-zero so always true.
|
||||
//}
|
||||
if ((int *)(s)) {
|
||||
// this compiles but is likely not what the user intended
|
||||
}
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Unicode Character Types, Unicode String, Universal Character Literal
|
||||
|
||||
```cpp
|
||||
__global__ void kernel() {
|
||||
// cant print it since printf(gpu) doesnot support unicode char arguments
|
||||
char16_t a = u'y';
|
||||
char32_t l = U'猫';
|
||||
auto *string = U"इस अनुवाद को करने से आपको क्या मिला?";
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### User Defined Literals
|
||||
|
||||
```cpp
|
||||
__device__ long double operator"" _w(long double a) { return a; }
|
||||
__device__ unsigned operator"" _w(char const *c) { return *c - '0'; }
|
||||
|
||||
__global__ void kernel() {
|
||||
auto ld = 1.2_w; // calls operator "" _w(1.2L)
|
||||
auto val = 2_w; // calls operator "" _w("2")
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### `default`/`delete` Functions
|
||||
|
||||
```cpp
|
||||
struct S {
|
||||
__device__ S() = default;
|
||||
__device__ S &operator=(const S &) = delete;
|
||||
};
|
||||
__global__ void kernel() {
|
||||
S s, other; // fine
|
||||
// other = s; // compile error, function deleted
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Friend Declaration
|
||||
|
||||
```cpp
|
||||
struct Y {};
|
||||
|
||||
struct A {
|
||||
__device__ A() = default;
|
||||
friend Y;
|
||||
// friend Z; // compile error since class or struct Z doesn't exist
|
||||
friend class Z; // this is fine
|
||||
friend void asdf(int); // functions can be declared without a definition
|
||||
};
|
||||
__global__ void kernel() { A a; }
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Extended `sizeof`
|
||||
|
||||
```cpp
|
||||
template <typename... Ts> __global__ void kernel(Ts... ts) {
|
||||
auto size = sizeof...(ts);
|
||||
// ...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Unrestricted Unions
|
||||
|
||||
```cpp
|
||||
struct Point {
|
||||
__device__ Point() {}
|
||||
__device__ Point(int x, int y) : x_(x), y_(y) {}
|
||||
int x_, y_;
|
||||
};
|
||||
|
||||
union U {
|
||||
int z;
|
||||
double w;
|
||||
Point p;
|
||||
__device__ U() {}
|
||||
__device__ U(const Point &pt) : p(pt) {}
|
||||
__device__ U &operator=(const Point &pt) {
|
||||
new (&p) Point(pt);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
__global__ void kernel() {
|
||||
U u;
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Inline Namespaces
|
||||
|
||||
```cpp
|
||||
namespace XX {
|
||||
inline namespace YY {
|
||||
struct Y {
|
||||
int x;
|
||||
};
|
||||
} // namespace YY
|
||||
struct X {
|
||||
int a;
|
||||
};
|
||||
} // namespace XX
|
||||
|
||||
__global__ void kernel() {
|
||||
XX::X x{};
|
||||
XX::Y y{};
|
||||
}
|
||||
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Range Based For-loop
|
||||
|
||||
```cpp
|
||||
__global__ void kernel() {
|
||||
for (auto &x : {1, 2, 3, 4, 5}) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### `override` Specifier
|
||||
|
||||
```cpp
|
||||
struct Base {
|
||||
int n;
|
||||
__device__ Base(int v) : n(v + 1) {}
|
||||
__device__ Base() : Base(10) {}
|
||||
__device__ virtual ~Base() {}
|
||||
__device__ virtual int get() { return n; }
|
||||
};
|
||||
|
||||
struct Derived : public Base {
|
||||
int n;
|
||||
__device__ Derived(int v) : n(v) {}
|
||||
__device__ int get() override { return n; }
|
||||
__device__ ~Derived() {}
|
||||
};
|
||||
|
||||
__global__ void kernel() {
|
||||
Derived d(10);
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### `noexcept` Keyword
|
||||
|
||||
```cpp
|
||||
__global__ void kernel() noexcept {
|
||||
int n;
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Consecutive Right Angle Brackets in Templates
|
||||
|
||||
```cpp
|
||||
template <typename T> struct A { T a; };
|
||||
|
||||
template <typename T> struct B { T b; };
|
||||
|
||||
__global__ void kernel() {
|
||||
A<B<int>> ab;
|
||||
//...
|
||||
}
|
||||
int main() { kernel<<<1, 1>>>(); }
|
||||
```
|
||||
|
||||
### Not Yet Documented
|
||||
|
||||
* Right Angled Brackets : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
|
||||
* Initializer List : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
|
||||
* Solving SFINAE problem for expression : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html
|
||||
* Forward Declaration of Enum : http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1206 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf
|
||||
* Conditionally supported behavior : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1627.pdf
|
||||
* Inheriting Constructors : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm
|
||||
* Standard layout types : https://en.cppreference.com/w/cpp/named_req/StandardLayoutType
|
||||
* Local and unnamed types as template arguments : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm
|
||||
* Minimal support for Garbage Collection : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm
|
||||
* Move special functions : https://en.cppreference.com/w/cpp/language/rule_of_three
|
||||
* long long int
|
||||
|
||||
|
||||
## C++14
|
||||
|
||||
### Not Yet Documented
|
||||
|
||||
* Tweak C++ contextual conversions : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf
|
||||
* Binary literals : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf
|
||||
* Functions to deduce return type : https://isocpp.org/files/papers/N3638.html
|
||||
* Lambda capture changes : https://isocpp.org/files/papers/N3648.html
|
||||
* Polymorphic lambda : https://isocpp.org/files/papers/N3649.html
|
||||
* Variable template : https://en.cppreference.com/w/cpp/language/variable_template
|
||||
* constexpr changes : https://isocpp.org/files/papers/N3652.html
|
||||
* struct member initializer : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3653.html
|
||||
* clarifying mem allocation : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3664.html
|
||||
* sized dealloc : https://isocpp.org/files/papers/n3778.html
|
||||
* deprecated attribute : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html
|
||||
* digit separator : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf
|
||||
@@ -4483,6 +4483,8 @@ hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags);
|
||||
* @param [in] fname
|
||||
* @param [out] module
|
||||
*
|
||||
* @warning File/memory resources allocated in this function are released only in hipModuleUnload.
|
||||
*
|
||||
* @returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidContext, hipErrorFileNotFound,
|
||||
* hipErrorOutOfMemory, hipErrorSharedObjectInitFailed, hipErrorNotInitialized
|
||||
*
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Copyright (C) 2022 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.
|
||||
|
||||
project(cmake_hiprtc_test)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10.2)
|
||||
|
||||
# Find hiprtc
|
||||
find_package(hiprtc REQUIRED)
|
||||
# Find hip
|
||||
find_package(hip REQUIRED)
|
||||
|
||||
# Create the excutable
|
||||
add_executable(test saxpy.cpp)
|
||||
|
||||
# Link with HIPRTC
|
||||
target_link_libraries(test hiprtc::hiprtc)
|
||||
# Link with HIP
|
||||
target_link_libraries(test hip::device)
|
||||
@@ -0,0 +1,9 @@
|
||||
### This will test linking hiprtc::hiprtc interface in cmake
|
||||
I. Build
|
||||
mkdir -p build; cd build
|
||||
rm -rf *; CXX=amdclang++ cmake -DCMAKE_PREFIX_PATH=/opt/rocm/hip ..
|
||||
make
|
||||
|
||||
II. Test
|
||||
$ ./test
|
||||
SAXPY test completed
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
Copyright (c) 2022 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 <hip/hiprtc.h>
|
||||
#include <hip/hip_runtime.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
static constexpr auto NUM_THREADS{128};
|
||||
static constexpr auto NUM_BLOCKS{32};
|
||||
|
||||
static constexpr auto saxpy{
|
||||
R"(
|
||||
#include "test_header.h"
|
||||
#include "test_header1.h"
|
||||
extern "C"
|
||||
__global__
|
||||
void saxpy(real a, realptr x, realptr y, realptr out, size_t n)
|
||||
{
|
||||
size_t tid = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
if (tid < n) {
|
||||
out[tid] = a * x[tid] + y[tid] ;
|
||||
}
|
||||
}
|
||||
)"};
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
hiprtcProgram prog;
|
||||
int num_headers = 2;
|
||||
vector<const char*> header_names;
|
||||
vector<const char*> header_sources;
|
||||
header_names.push_back("test_header.h");
|
||||
header_names.push_back("test_header1.h");
|
||||
header_sources.push_back("#ifndef HIPRTC_TEST_HEADER_H\n#define HIPRTC_TEST_HEADER_H\ntypedef float real;\n#endif //HIPRTC_TEST_HEADER_H\n");
|
||||
header_sources.push_back("#ifndef HIPRTC_TEST_HEADER1_H\n#define HIPRTC_TEST_HEADER1_H\ntypedef float* realptr;\n#endif //HIPRTC_TEST_HEADER1_H\n");
|
||||
hiprtcCreateProgram(&prog, // prog
|
||||
saxpy, // buffer
|
||||
"saxpy.cu", // name
|
||||
num_headers, // numHeaders
|
||||
&header_sources[0], // headers
|
||||
&header_names[0]); // includeNames
|
||||
|
||||
hipDeviceProp_t props;
|
||||
int device = 0;
|
||||
hipGetDeviceProperties(&props, device);
|
||||
|
||||
const char* options[] = {};
|
||||
|
||||
hiprtcResult compileResult{hiprtcCompileProgram(prog, 0, options)};
|
||||
|
||||
size_t logSize;
|
||||
hiprtcGetProgramLogSize(prog, &logSize);
|
||||
|
||||
if (logSize) {
|
||||
string log(logSize, '\0');
|
||||
hiprtcGetProgramLog(prog, &log[0]);
|
||||
|
||||
cout << log << '\n';
|
||||
}
|
||||
|
||||
if (compileResult != HIPRTC_SUCCESS) {
|
||||
cout << "Compilation failed." << endl;
|
||||
}
|
||||
|
||||
size_t codeSize;
|
||||
hiprtcGetCodeSize(prog, &codeSize);
|
||||
|
||||
vector<char> code(codeSize);
|
||||
hiprtcGetCode(prog, code.data());
|
||||
|
||||
hiprtcDestroyProgram(&prog);
|
||||
|
||||
hipModule_t module;
|
||||
hipFunction_t kernel;
|
||||
|
||||
hipModuleLoadData(&module, code.data());
|
||||
hipModuleGetFunction(&kernel, module, "saxpy");
|
||||
|
||||
size_t n = NUM_THREADS * NUM_BLOCKS;
|
||||
size_t bufferSize = n * sizeof(float);
|
||||
|
||||
float a = 5.1f;
|
||||
unique_ptr<float[]> hX{new float[n]};
|
||||
unique_ptr<float[]> hY{new float[n]};
|
||||
unique_ptr<float[]> hOut{new float[n]};
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
hX[i] = static_cast<float>(i);
|
||||
hY[i] = static_cast<float>(i * 2);
|
||||
}
|
||||
|
||||
hipDeviceptr_t dX, dY, dOut;
|
||||
hipMalloc((void **)&dX, bufferSize);
|
||||
hipMalloc((void **)&dY, bufferSize);
|
||||
hipMalloc((void **)&dOut, bufferSize);
|
||||
hipMemcpyHtoD(dX, hX.get(), bufferSize);
|
||||
hipMemcpyHtoD(dY, hY.get(), bufferSize);
|
||||
|
||||
struct {
|
||||
float a_;
|
||||
hipDeviceptr_t b_;
|
||||
hipDeviceptr_t c_;
|
||||
hipDeviceptr_t d_;
|
||||
size_t e_;
|
||||
} args{a, dX, dY, dOut, n};
|
||||
|
||||
auto size = sizeof(args);
|
||||
void* config[] = {HIP_LAUNCH_PARAM_BUFFER_POINTER, &args,
|
||||
HIP_LAUNCH_PARAM_BUFFER_SIZE, &size,
|
||||
HIP_LAUNCH_PARAM_END};
|
||||
|
||||
hipModuleLaunchKernel(kernel, NUM_BLOCKS, 1, 1, NUM_THREADS, 1, 1,
|
||||
0, nullptr, nullptr, config);
|
||||
hipMemcpyDtoH(hOut.get(), dOut, bufferSize);
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
if (fabs(a * hX[i] + hY[i] - hOut[i]) > fabs(hOut[i])* 1e-6) {
|
||||
cout << "Validation failed." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
hipFree((void *)dX);
|
||||
hipFree((void *)dY);
|
||||
hipFree((void *)dOut);
|
||||
|
||||
hipModuleUnload(module);
|
||||
|
||||
cout << "SAXPY test completed" << endl;
|
||||
}
|
||||
@@ -29,6 +29,7 @@ TEMPLATE_TEST_CASE("ABM_AddKernel_MultiTypeMultiSize", "", int, long, float, lon
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
hipLaunchKernelGGL(add<TestType>, 1, size, 0, 0, d_a, d_b, d_c, size);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
res = hipMemcpy(a.data(), d_c, sizeof(TestType) * size, hipMemcpyDeviceToHost);
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
@@ -53,6 +53,7 @@ TEST_CASE("Unit_hipManagedKeyword_SingleGpu") {
|
||||
hipLaunchKernelGGL(add, dimGrid, dimBlock, 0, 0, static_cast<const float*>(A),
|
||||
static_cast<float*>(B));
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
|
||||
float maxError = 0.0f;
|
||||
|
||||
@@ -2,27 +2,18 @@
|
||||
"DisabledTests":
|
||||
[
|
||||
"Unit_hipMalloc_CoherentTst",
|
||||
"Unit_printf_flags",
|
||||
"Unit_printf_specifier",
|
||||
"Unit_hipTextureMipmapObj2D_Check",
|
||||
"Unit_hipGraphAddHostNode_ClonedGraphwithHostNode",
|
||||
"Unit_hipEventIpc",
|
||||
"Unit_hipMalloc3D_Negative",
|
||||
"Unit_hipPointerGetAttribute_MappedMem",
|
||||
"Unit_hipStreamValue_Write",
|
||||
"Unit_hipMemPoolApi_Basic",
|
||||
"Unit_hipMemPoolApi_BasicAlloc",
|
||||
"Unit_hipMemPoolApi_BasicTrim",
|
||||
"Unit_hipMemPoolApi_BasicReuse",
|
||||
"Unit_hipMemPoolApi_Opportunistic",
|
||||
"Unit_hipMemPoolApi_Default",
|
||||
"Unit_hipDeviceGetUuid",
|
||||
"Unit_hipGraphMemcpyNodeSetParams_Functional",
|
||||
"Unit_hipMalloc3D_ValidatePitch",
|
||||
"Unit_hipArrayCreate_happy",
|
||||
"Unit_hipHostRegister_Negative - int",
|
||||
"Unit_hipHostRegister_Negative - float",
|
||||
"Unit_hipHostRegister_Negative - double",
|
||||
"Unit_hipMemAllocPitch_ValidatePitch",
|
||||
"Unit_hipArrayCreate_happy - int",
|
||||
"Unit_hipArrayCreate_happy - int4",
|
||||
@@ -32,7 +23,6 @@
|
||||
"Unit_hipArrayCreate_happy - float",
|
||||
"Unit_hipArrayCreate_happy - float2",
|
||||
"Unit_hipArrayCreate_happy - float4",
|
||||
"Unit_hipMemVmm_Basic",
|
||||
"Unit_hipGraphExecMemcpyNodeSetParamsToSymbol_Functional",
|
||||
"Unit_hipMallocManaged_MultiChunkMultiDevice",
|
||||
"Unit_hipMallocManaged_TwoPointers - int",
|
||||
@@ -43,9 +33,10 @@
|
||||
"Unit_hipMallocManaged_DeviceContextChange - float",
|
||||
"Unit_hipMallocManaged_DeviceContextChange - double",
|
||||
"Unit_hipGraphNodeGetDependentNodes_Functional",
|
||||
"Unit_hipGraphNodeGetDependentNodes_ParamValidation",
|
||||
"Unit_hipGraphNodeGetDependencies_Functional",
|
||||
"Unit_hipGraphNodeGetDependencies_ParamValidation",
|
||||
"Unit_hipMemGetInfo_Negative",
|
||||
"Unit_hipStreamCreateWithPriority_ValidateWithEvents",
|
||||
"Unit_hipStreamPerThread_StrmWaitEvt",
|
||||
"Unit_hipMemGetInfo_DifferentMallocSmall",
|
||||
"Unit_hipMemGetInfo_MallocArray - int",
|
||||
"Unit_hipMemGetInfo_MallocArray - int4",
|
||||
@@ -73,6 +64,13 @@
|
||||
"Unit_hipMultiThreadDevice_NearZero",
|
||||
"Unit_hipStreamPerThread_DeviceReset_1",
|
||||
"Unit_hipStreamCreateWithPriority_ValidateWithEvents",
|
||||
"Unit_hipStreamPerThread_StrmWaitEvt"
|
||||
"Unit_hipStreamPerThread_StrmWaitEvt",
|
||||
"Unit_hipGraphHostNodeGetParams_ClonedGraphwithHostNode",
|
||||
"Unit_hipGraphHostNodeGetParams_BasicFunc",
|
||||
"Unit_hipGraphHostNodeGetParams_SetParams",
|
||||
"Unit_hipGraphExecChildGraphNodeSetParams_BasicFunc",
|
||||
"Unit_hipGraphExecChildGraphNodeSetParams_ChildTopology",
|
||||
"Unit_hipGraphMemcpyNodeSetParams1D_Functional",
|
||||
"Unit_hipGraphMemcpyNodeSetParamsToSymbol_Functional"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ THE SOFTWARE.
|
||||
#include <fstream>
|
||||
#include <regex>
|
||||
#include <type_traits>
|
||||
|
||||
#define TOL 0.001
|
||||
#define guarantee(cond, str) \
|
||||
{ \
|
||||
if (!(cond)) { \
|
||||
@@ -45,7 +45,7 @@ size_t checkVectors(T* A, T* B, T* Out, size_t N, T (*F)(T a, T b), bool expectM
|
||||
size_t mismatchesToPrint = 10;
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
T expected = F(A[i], B[i]);
|
||||
if (Out[i] != expected) {
|
||||
if (std::fabs(Out[i] - expected) > TOL) {
|
||||
if (mismatchCount == 0) {
|
||||
firstMismatch = i;
|
||||
}
|
||||
|
||||
@@ -270,6 +270,7 @@ void launchKernel(K kernel, Dim numBlocks, Dim numThreads, std::uint32_t memPerB
|
||||
launchRTCKernel<Typenames...>(kernel, numBlocks, numThreads, memPerBlock, stream,
|
||||
std::forward<Args>(packedArgs)...);
|
||||
#endif
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
//---
|
||||
|
||||
@@ -44,7 +44,7 @@ Negative/Argument Validation:
|
||||
|
||||
|
||||
#define BUF_SIZE 4096
|
||||
#define MAX_DEVICES 8
|
||||
#define MAX_DEVICES 16
|
||||
|
||||
|
||||
typedef struct ipcEventInfo {
|
||||
@@ -221,6 +221,7 @@ void runMultiProcKernel(ipcEventInfo_t *shmEventInfo, int index) {
|
||||
const dim3 blocks(BUF_SIZE / threads.x, 1);
|
||||
hipLaunchKernelGGL(computeKernel, dim3(blocks), dim3(threads), 0, 0,
|
||||
d_ptr + index *BUF_SIZE, d_ptr, index + 1);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipEventRecord(event));
|
||||
|
||||
// Barrier 2 : Signals that event is recorded
|
||||
@@ -250,7 +251,7 @@ TEST_CASE("Unit_hipIpcEventHandle_Functional") {
|
||||
return;
|
||||
}
|
||||
|
||||
g_processCnt = shmDevices->count;
|
||||
g_processCnt = (shmDevices->count > MAX_DEVICES) ? MAX_DEVICES : shmDevices->count;
|
||||
|
||||
// Barrier is used to synchronize processes created.
|
||||
g_Barrier = reinterpret_cast<ipcBarrier_t *> (mmap(NULL, sizeof(*g_Barrier),
|
||||
|
||||
@@ -120,7 +120,7 @@ static bool validateMemoryOnGPU(int gpu, bool concurOnOneGPU = false) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, 0, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
if (!HipTest::checkVectorADD(A_h, B_h, C_h, N)) {
|
||||
|
||||
@@ -276,12 +276,15 @@ bool test_printf_multistream(uint32_t num_blocks,
|
||||
hipLaunchKernelGGL(kernel_complex_opX, dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, stream[i], Ad, Bd, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipLaunchKernelGGL(kernel_complex_opY, dim3(1, num_blocks, 1),
|
||||
dim3(1, threads_per_block, 1),
|
||||
0, stream[i], Ad, Bd, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipLaunchKernelGGL(kernel_complex_opZ, dim3(1, 1, num_blocks),
|
||||
dim3(1, 1, threads_per_block),
|
||||
0, stream[i], Ad, Bd, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
for (int i = 0; i < NUM_STREAM; i++) {
|
||||
@@ -368,12 +371,15 @@ bool test_printf_multigpu(int gpu,
|
||||
hipLaunchKernelGGL(kernel_complex_opX, dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, 0, Ad, Bd, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipLaunchKernelGGL(kernel_complex_opY, dim3(1, num_blocks, 1),
|
||||
dim3(1, threads_per_block, 1),
|
||||
0, 0, Ad, Bd, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipLaunchKernelGGL(kernel_complex_opZ, dim3(1, 1, num_blocks),
|
||||
dim3(1, 1, threads_per_block),
|
||||
0, 0, Ad, Bd, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
std::ifstream CapturedData = captured.getCapturedData();
|
||||
char *buffer = new char[CHUNK_SIZE];
|
||||
|
||||
@@ -246,6 +246,7 @@ bool test_printf_conststr(uint32_t num_blocks, uint32_t threads_per_block,
|
||||
hipLaunchKernelGGL(kernel_printf_conststr, dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, 0, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(0));
|
||||
std::ifstream CapturedData = captured.getCapturedData();
|
||||
char *buffer = new char[CHUNK_SIZE];
|
||||
@@ -308,6 +309,7 @@ bool test_printf_two_conditionalstr(uint32_t num_blocks,
|
||||
dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, 0, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(0));
|
||||
std::ifstream CapturedData = captured.getCapturedData();
|
||||
char *buffer = new char[CHUNK_SIZE];
|
||||
@@ -370,6 +372,7 @@ bool test_printf_single_conditionalstr(uint32_t num_blocks,
|
||||
dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, 0, iterCount);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(0));
|
||||
std::ifstream CapturedData = captured.getCapturedData();
|
||||
char *buffer = new char[CHUNK_SIZE];
|
||||
@@ -427,6 +430,7 @@ bool test_variable_str(uint32_t print_limit,
|
||||
hipLaunchKernelGGL(func, dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, 0, iterCount, Ad);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(0));
|
||||
HIP_CHECK(hipMemcpy(Ah, Ad, buffsize*sizeof(int32_t),
|
||||
hipMemcpyDeviceToHost));
|
||||
@@ -483,6 +487,7 @@ bool test_decimal_str(uint32_t num_blocks, uint32_t threads_per_block,
|
||||
hipLaunchKernelGGL(kernel_decimal_calculation, dim3(num_blocks, 1, 1),
|
||||
dim3(threads_per_block, 1, 1),
|
||||
0, 0, iterCount, maxPrecision);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(0));
|
||||
std::ifstream CapturedData = captured.getCapturedData();
|
||||
char *buffer = new char[CHUNK_SIZE];
|
||||
|
||||
@@ -157,6 +157,7 @@ static void test_group_partition(unsigned int tileSz) {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_cg_group_partition, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0, dResult, tileSz, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
fprintf(stderr, "Failed to launch kernel (error code %s)!\n", hipGetErrorString(err));
|
||||
@@ -217,6 +218,7 @@ static void test_shfl_down() {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_shfl_down, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0, dPtr, dResults, lane_delta, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost);
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
|
||||
@@ -138,6 +138,7 @@ static void test_group_partition(unsigned tileSz) {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_cg_group_partition, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0, dPtr, tileSz, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipMemcpy(hPtr, dPtr, arrSize, hipMemcpyDeviceToHost);
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
@@ -207,6 +208,7 @@ static void test_shfl_up() {
|
||||
hipLaunchKernelGGL(kernel_shfl_up, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0, dPtr, dResults, lane_delta, i);
|
||||
hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
fprintf(stderr, "Failed to launch kernel (error code %s)!\n", hipGetErrorString(err));
|
||||
|
||||
@@ -244,6 +244,7 @@ static void test_active_threads_grouping() {
|
||||
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_coalesced_active_groups, blockSize, threadsPerBlock, 0, 0);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
@@ -308,6 +309,7 @@ static void test_group_partition(unsigned int tileSz, bool useGlobalMem) {
|
||||
if (useGlobalMem) {
|
||||
hipLaunchKernelGGL(kernel_cg_coalesced_group_partition, blockSize, threadsPerBlock, 0, 0, tileSz,
|
||||
dResult, useGlobalMem, globalMem, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
@@ -316,6 +318,7 @@ static void test_group_partition(unsigned int tileSz, bool useGlobalMem) {
|
||||
} else {
|
||||
hipLaunchKernelGGL(kernel_cg_coalesced_group_partition, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0, tileSz, dResult, useGlobalMem, globalMem, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
@@ -390,6 +393,7 @@ static void test_shfl_any_to_any() {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_shfl_any_to_any, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0 , dPtr, dsrcArr, dResults, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost);
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
@@ -459,6 +463,7 @@ static void test_shfl_broadcast() {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_shfl, blockSize, threadsPerBlock,
|
||||
threadsPerBlock * sizeof(int), 0, dPtr, dResults, srcLane, i);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
hipMemcpy(hPtr, dResults, group_size_in_bytes, hipMemcpyDeviceToHost);
|
||||
err = hipDeviceSynchronize();
|
||||
if (err != hipSuccess) {
|
||||
|
||||
@@ -18,6 +18,7 @@ set(TEST_SRC
|
||||
hipDeviceGetUuid.cc
|
||||
hipDeviceGetP2PAttribute.cc
|
||||
hipExtGetLinkTypeAndHopCount.cc
|
||||
hipDeviceSetLimit.cc
|
||||
)
|
||||
|
||||
set_source_files_properties(hipGetDeviceCount.cc PROPERTIES COMPILE_FLAGS -std=c++17)
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright (c) 2022 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 WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Conformance test for checking functionality of
|
||||
* hipError_t hipDeviceSetLimit ( enum hipLimit_t limit, size_t value );
|
||||
*/
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
// Currently the HIGHER_VALUE is fixed to 16 KB based on currently
|
||||
// set maximum value for hipLimitStackSize. In future, this value
|
||||
// might need to change to avoid test case failure. In the same way
|
||||
// LOWER_VALUE is empirically determined.
|
||||
#define HIGHER_VALUE (16*1024) // 16 KB
|
||||
#define LOWER_VALUE (512) // 512 bytes
|
||||
|
||||
/**
|
||||
* hipDeviceSetLimit tests =>
|
||||
*/
|
||||
static bool testSetLimitFunc(hipLimit_t limit_to_test) {
|
||||
size_t value = 0;
|
||||
size_t setValue = LOWER_VALUE;
|
||||
// Set Value to low Value.
|
||||
HIP_CHECK(hipDeviceSetLimit(limit_to_test, setValue));
|
||||
HIP_CHECK(hipDeviceGetLimit(&value, limit_to_test));
|
||||
// The returned value could be rounded to maximum or minimum
|
||||
REQUIRE(value >= LOWER_VALUE);
|
||||
// Set Value to High value.
|
||||
setValue = HIGHER_VALUE;
|
||||
HIP_CHECK(hipDeviceSetLimit(limit_to_test, setValue));
|
||||
HIP_CHECK(hipDeviceGetLimit(&value, limit_to_test));
|
||||
// The returned value could be rounded to maximum or minimum
|
||||
REQUIRE(value >= HIGHER_VALUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* hipDeviceSetLimit tests =>
|
||||
*
|
||||
* Scenario1: Single device Set-Get test for hipLimitStackSize flag.
|
||||
*
|
||||
* Scenario2: Single device Set-Get test for hipLimitPrintfFifoSize flag.
|
||||
*
|
||||
* Scenario3: Single device Set-Get test for hipLimitMallocHeapSize flag.
|
||||
*
|
||||
* Scenario4: Multidevice Set-Get test for all the flags
|
||||
*
|
||||
* Scenario5: Negative Scenario - Invalid flag value
|
||||
*/
|
||||
TEST_CASE("Unit_hipDeviceSetLimit_SetGet") {
|
||||
size_t value = 0;
|
||||
// Scenario1
|
||||
SECTION("Set Get Test hipLimitStackSize") {
|
||||
REQUIRE(true == testSetLimitFunc(hipLimitStackSize));
|
||||
}
|
||||
#if HT_NVIDIA
|
||||
// Scenario2
|
||||
SECTION("Set Get Test hipLimitPrintfFifoSize") {
|
||||
REQUIRE(true == testSetLimitFunc(hipLimitPrintfFifoSize));
|
||||
}
|
||||
// Scenario3
|
||||
SECTION("Set Get Test hipLimitMallocHeapSize") {
|
||||
REQUIRE(true == testSetLimitFunc(hipLimitMallocHeapSize));
|
||||
}
|
||||
#endif
|
||||
// Scenario4
|
||||
SECTION("Multi device Set-Get test for all flags") {
|
||||
int numDevices = 0;
|
||||
HIP_CHECK(hipGetDeviceCount(&numDevices));
|
||||
for (int dev = 0; dev < numDevices; dev++) {
|
||||
HIP_CHECK(hipSetDevice(dev));
|
||||
REQUIRE(true == testSetLimitFunc(hipLimitStackSize));
|
||||
#if HT_NVIDIA
|
||||
REQUIRE(true == testSetLimitFunc(hipLimitPrintfFifoSize));
|
||||
REQUIRE(true == testSetLimitFunc(hipLimitMallocHeapSize));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Scenario5
|
||||
SECTION("Negative Scenario: Invalid Flag") {
|
||||
HIP_CHECK(hipDeviceGetLimit(&value, hipLimitMallocHeapSize));
|
||||
REQUIRE(hipErrorInvalidValue == hipDeviceSetLimit(
|
||||
static_cast<hipLimit_t>(0xffff), value/2));
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ THE SOFTWARE.
|
||||
|
||||
#define _SIZE sizeof(int) * 1024 * 1024
|
||||
#define NUM_STREAMS 2
|
||||
#define NUM_ITERS 1 << 30
|
||||
|
||||
static __global__ void Iter(int* Ad, int num) {
|
||||
int tx = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
@@ -57,7 +58,8 @@ TEST_CASE("Unit_hipDeviceSynchronize_Functional") {
|
||||
}
|
||||
for (int i = 0; i < NUM_STREAMS; i++) {
|
||||
hipLaunchKernelGGL(HIP_KERNEL_NAME(Iter), dim3(1), dim3(1), 0,
|
||||
stream[i], Ad[i], 1 << 30);
|
||||
stream[i], Ad[i], NUM_ITERS);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
for (int i = 0; i < NUM_STREAMS; i++) {
|
||||
HIP_CHECK(hipMemcpyAsync(A[i], Ad[i], _SIZE, hipMemcpyDeviceToHost,
|
||||
@@ -71,7 +73,7 @@ TEST_CASE("Unit_hipDeviceSynchronize_Functional") {
|
||||
// Conservative implementations which synchronize the hipMemcpyAsync will
|
||||
// fail, ie if HIP_LAUNCH_BLOCKING=true.
|
||||
|
||||
CHECK(1 << 30 != A[NUM_STREAMS - 1][0] - 1);
|
||||
CHECK(NUM_ITERS != A[NUM_STREAMS - 1][0] - 1);
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
CHECK(1 << 30 == A[NUM_STREAMS - 1][0] - 1);
|
||||
CHECK(NUM_ITERS == A[NUM_STREAMS - 1][0] - 1);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,16 @@ THE SOFTWARE.
|
||||
*/
|
||||
// Test the device info API extensions for HIP
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <string.h>
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
static hipError_t test_hipDeviceGetAttribute(int deviceId,
|
||||
hipDeviceAttribute_t attr,
|
||||
int expectedValue = -1) {
|
||||
@@ -366,3 +369,190 @@ TEST_CASE("Unit_hipDeviceGetAttribute_NegTst") {
|
||||
device));
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t n>
|
||||
using AttributeToStringMap = std::array<std::pair<hipDeviceAttribute_t, const char*>, n>;
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr AttributeToStringMap<56> kCommonAttributes{{
|
||||
{hipDeviceAttributeEccEnabled, "hipDeviceAttributeEccEnabled"},
|
||||
{hipDeviceAttributeCanMapHostMemory, "hipDeviceAttributeCanMapHostMemory"},
|
||||
{hipDeviceAttributeClockRate, "hipDeviceAttributeClockRate"},
|
||||
{hipDeviceAttributeComputeMode, "hipDeviceAttributeComputeMode"},
|
||||
{hipDeviceAttributeConcurrentKernels, "hipDeviceAttributeConcurrentKernels"},
|
||||
{hipDeviceAttributeConcurrentManagedAccess, "hipDeviceAttributeConcurrentManagedAccess"},
|
||||
{hipDeviceAttributeCooperativeLaunch, "hipDeviceAttributeCooperativeLaunch"},
|
||||
{hipDeviceAttributeCooperativeMultiDeviceLaunch,
|
||||
"hipDeviceAttributeCooperativeMultiDeviceLaunch"},
|
||||
{hipDeviceAttributeDirectManagedMemAccessFromHost,
|
||||
"hipDeviceAttributeDirectManagedMemAccessFromHost"},
|
||||
{hipDeviceAttributeIntegrated, "hipDeviceAttributeIntegrated"},
|
||||
{hipDeviceAttributeIsMultiGpuBoard, "hipDeviceAttributeIsMultiGpuBoard"},
|
||||
{hipDeviceAttributeKernelExecTimeout, "hipDeviceAttributeKernelExecTimeout"},
|
||||
{hipDeviceAttributeL2CacheSize, "hipDeviceAttributeL2CacheSize"},
|
||||
{hipDeviceAttributeLocalL1CacheSupported, "hipDeviceAttributeLocalL1CacheSupported"},
|
||||
{hipDeviceAttributeComputeCapabilityMajor, "hipDeviceAttributeComputeCapabilityMajor"},
|
||||
{hipDeviceAttributeManagedMemory, "hipDeviceAttributeManagedMemory"},
|
||||
{hipDeviceAttributeMaxBlockDimX, "hipDeviceAttributeMaxBlockDimX"},
|
||||
{hipDeviceAttributeMaxBlockDimY, "hipDeviceAttributeMaxBlockDimY"},
|
||||
{hipDeviceAttributeMaxBlockDimZ, "hipDeviceAttributeMaxBlockDimZ"},
|
||||
{hipDeviceAttributeMaxGridDimX, "hipDeviceAttributeMaxGridDimX"},
|
||||
{hipDeviceAttributeMaxGridDimY, "hipDeviceAttributeMaxGridDimY"},
|
||||
{hipDeviceAttributeMaxGridDimZ, "hipDeviceAttributeMaxGridDimZ"},
|
||||
{hipDeviceAttributeMaxSurface1D, "hipDeviceAttributeMaxSurface1D"},
|
||||
{hipDeviceAttributeMaxSurface2D, "hipDeviceAttributeMaxSurface2D"},
|
||||
{hipDeviceAttributeMaxSurface3D, "hipDeviceAttributeMaxSurface3D"},
|
||||
{hipDeviceAttributeMaxTexture1DWidth, "hipDeviceAttributeMaxTexture1DWidth"},
|
||||
{hipDeviceAttributeMaxTexture1DLinear, "hipDeviceAttributeMaxTexture1DLinear"},
|
||||
{hipDeviceAttributeMaxTexture2DWidth, "hipDeviceAttributeMaxTexture2DWidth"},
|
||||
{hipDeviceAttributeMaxTexture2DHeight, "hipDeviceAttributeMaxTexture2DHeight"},
|
||||
{hipDeviceAttributeMaxTexture3DWidth, "hipDeviceAttributeMaxTexture3DWidth"},
|
||||
{hipDeviceAttributeMaxTexture3DHeight, "hipDeviceAttributeMaxTexture3DHeight"},
|
||||
{hipDeviceAttributeMaxTexture3DDepth, "hipDeviceAttributeMaxTexture3DDepth"},
|
||||
{hipDeviceAttributeMaxThreadsDim, "hipDeviceAttributeMaxThreadsDim"},
|
||||
{hipDeviceAttributeMaxThreadsPerBlock, "hipDeviceAttributeMaxThreadsPerBlock"},
|
||||
{hipDeviceAttributeMaxThreadsPerMultiProcessor,
|
||||
"hipDeviceAttributeMaxThreadsPerMultiProcessor"},
|
||||
{hipDeviceAttributeMaxPitch, "hipDeviceAttributeMaxPitch"},
|
||||
{hipDeviceAttributeMemoryBusWidth, "hipDeviceAttributeMemoryBusWidth"},
|
||||
{hipDeviceAttributeMemoryClockRate, "hipDeviceAttributeMemoryClockRate"},
|
||||
{hipDeviceAttributeComputeCapabilityMinor, "hipDeviceAttributeComputeCapabilityMinor"},
|
||||
{hipDeviceAttributeMultiprocessorCount, "hipDeviceAttributeMultiprocessorCount"},
|
||||
{hipDeviceAttributeName, "hipDeviceAttributeName"},
|
||||
{hipDeviceAttributePageableMemoryAccess, "hipDeviceAttributePageableMemoryAccess"},
|
||||
{hipDeviceAttributePageableMemoryAccessUsesHostPageTables,
|
||||
"hipDeviceAttributePageableMemoryAccessUsesHostPageTables"},
|
||||
{hipDeviceAttributePciBusId, "hipDeviceAttributePciBusId"},
|
||||
{hipDeviceAttributePciDeviceId, "hipDeviceAttributePciDeviceId"},
|
||||
{hipDeviceAttributePciDomainID, "hipDeviceAttributePciDomainID"},
|
||||
{hipDeviceAttributeMaxRegistersPerBlock, "hipDeviceAttributeMaxRegistersPerBlock"},
|
||||
{hipDeviceAttributeMaxRegistersPerMultiprocessor,
|
||||
"hipDeviceAttributeMaxRegistersPerMultiprocessor"},
|
||||
{hipDeviceAttributeMaxSharedMemoryPerBlock, "hipDeviceAttributeMaxSharedMemoryPerBlock"},
|
||||
{hipDeviceAttributeTextureAlignment, "hipDeviceAttributeTextureAlignment"},
|
||||
{hipDeviceAttributeTexturePitchAlignment, "hipDeviceAttributeTexturePitchAlignment"},
|
||||
{hipDeviceAttributeTotalConstantMemory, "hipDeviceAttributeTotalConstantMemory"},
|
||||
{hipDeviceAttributeTotalGlobalMem, "hipDeviceAttributeTotalGlobalMem"},
|
||||
{hipDeviceAttributeWarpSize, "hipDeviceAttributeWarpSize"},
|
||||
{hipDeviceAttributeMemoryPoolsSupported, "hipDeviceAttributeMemoryPoolsSupported"},
|
||||
{hipDeviceAttributeVirtualMemoryManagementSupported,
|
||||
"hipDeviceAttributeVirtualMemoryManagementSupported"}
|
||||
}};
|
||||
|
||||
#if HT_NVIDIA
|
||||
constexpr AttributeToStringMap<34> kCudaOnlyAttributes{
|
||||
{{hipDeviceAttributeAccessPolicyMaxWindowSize, "hipDeviceAttributeAccessPolicyMaxWindowSize"},
|
||||
{hipDeviceAttributeAsyncEngineCount, "hipDeviceAttributeAsyncEngineCount"},
|
||||
{hipDeviceAttributeCanUseHostPointerForRegisteredMem,
|
||||
"hipDeviceAttributeCanUseHostPointerForRegisteredMem"},
|
||||
{hipDeviceAttributeComputePreemptionSupported, "hipDeviceAttributeComputePreemptionSupported"},
|
||||
{hipDeviceAttributeDeviceOverlap, "hipDeviceAttributeDeviceOverlap"},
|
||||
{hipDeviceAttributeGlobalL1CacheSupported, "hipDeviceAttributeGlobalL1CacheSupported"},
|
||||
{hipDeviceAttributeHostNativeAtomicSupported, "hipDeviceAttributeHostNativeAtomicSupported"},
|
||||
{hipDeviceAttributeLuid, "hipDeviceAttributeLuid"},
|
||||
{hipDeviceAttributeLuidDeviceNodeMask, "hipDeviceAttributeLuidDeviceNodeMask"},
|
||||
{hipDeviceAttributeMaxBlocksPerMultiProcessor, "hipDeviceAttributeMaxBlocksPerMultiProcessor"},
|
||||
{hipDeviceAttributeMaxSurface1DLayered, "hipDeviceAttributeMaxSurface1DLayered"},
|
||||
{hipDeviceAttributeMaxSurface2DLayered, "hipDeviceAttributeMaxSurface2DLayered"},
|
||||
{hipDeviceAttributeMaxSurfaceCubemap, "hipDeviceAttributeMaxSurfaceCubemap"},
|
||||
{hipDeviceAttributeMaxSurfaceCubemapLayered, "hipDeviceAttributeMaxSurfaceCubemapLayered"},
|
||||
{hipDeviceAttributeMaxTexture1DLayered, "hipDeviceAttributeMaxTexture1DLayered"},
|
||||
{hipDeviceAttributeMaxTexture1DMipmap, "hipDeviceAttributeMaxTexture1DMipmap"},
|
||||
{hipDeviceAttributeMaxTexture2DGather, "hipDeviceAttributeMaxTexture2DGather"},
|
||||
{hipDeviceAttributeMaxTexture2DLayered, "hipDeviceAttributeMaxTexture2DLayered"},
|
||||
{hipDeviceAttributeMaxTexture2DLinear, "hipDeviceAttributeMaxTexture2DLinear"},
|
||||
{hipDeviceAttributeMaxTexture2DMipmap, "hipDeviceAttributeMaxTexture2DMipmap"},
|
||||
{hipDeviceAttributeMaxTexture3DAlt, "hipDeviceAttributeMaxTexture3DAlt"},
|
||||
{hipDeviceAttributeMaxTextureCubemap, "hipDeviceAttributeMaxTextureCubemap"},
|
||||
{hipDeviceAttributeMaxTextureCubemapLayered, "hipDeviceAttributeMaxTextureCubemapLayered"},
|
||||
{hipDeviceAttributeMultiGpuBoardGroupID, "hipDeviceAttributeMultiGpuBoardGroupID"},
|
||||
{hipDeviceAttributePersistingL2CacheMaxSize, "hipDeviceAttributePersistingL2CacheMaxSize"},
|
||||
{hipDeviceAttributeReservedSharedMemPerBlock, "hipDeviceAttributeReservedSharedMemPerBlock"},
|
||||
{hipDeviceAttributeSharedMemPerBlockOptin, "hipDeviceAttributeSharedMemPerBlockOptin"},
|
||||
{hipDeviceAttributeSharedMemPerMultiprocessor, "hipDeviceAttributeSharedMemPerMultiprocessor"},
|
||||
{hipDeviceAttributeSingleToDoublePrecisionPerfRatio,
|
||||
"hipDeviceAttributeSingleToDoublePrecisionPerfRatio"},
|
||||
{hipDeviceAttributeStreamPrioritiesSupported, "hipDeviceAttributeStreamPrioritiesSupported"},
|
||||
{hipDeviceAttributeSurfaceAlignment, "hipDeviceAttributeSurfaceAlignment"},
|
||||
{hipDeviceAttributeTccDriver, "hipDeviceAttributeTccDriver"},
|
||||
{hipDeviceAttributeUnifiedAddressing, "hipDeviceAttributeUnifiedAddressing"},
|
||||
{hipDeviceAttributeUuid, "hipDeviceAttributeUuid"}}};
|
||||
#endif
|
||||
|
||||
#if HT_AMD
|
||||
constexpr AttributeToStringMap<17> kAmdOnlyAttributes{{
|
||||
{hipDeviceAttributeClockInstructionRate, "hipDeviceAttributeClockInstructionRate"},
|
||||
{hipDeviceAttributeArch, "hipDeviceAttributeArch"},
|
||||
{hipDeviceAttributeMaxSharedMemoryPerMultiprocessor,
|
||||
"hipDeviceAttributeMaxSharedMemoryPerMultiprocessor"},
|
||||
{hipDeviceAttributeGcnArch, "hipDeviceAttributeGcnArch"},
|
||||
{hipDeviceAttributeGcnArchName, "hipDeviceAttributeGcnArchName"},
|
||||
{hipDeviceAttributeHdpMemFlushCntl, "hipDeviceAttributeHdpMemFlushCntl"},
|
||||
{hipDeviceAttributeHdpRegFlushCntl, "hipDeviceAttributeHdpRegFlushCntl"},
|
||||
{hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc,
|
||||
"hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc"},
|
||||
{hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim,
|
||||
"hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim"},
|
||||
{hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim,
|
||||
"hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim"},
|
||||
{hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem,
|
||||
"hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem"},
|
||||
{hipDeviceAttributeIsLargeBar, "hipDeviceAttributeIsLargeBar"},
|
||||
{hipDeviceAttributeAsicRevision, "hipDeviceAttributeAsicRevision"},
|
||||
{hipDeviceAttributeCanUseStreamWaitValue, "hipDeviceAttributeCanUseStreamWaitValue"},
|
||||
{hipDeviceAttributeImageSupport, "hipDeviceAttributeImageSupport"},
|
||||
{hipDeviceAttributePhysicalMultiProcessorCount,
|
||||
"hipDeviceAttributePhysicalMultiProcessorCount"},
|
||||
{hipDeviceAttributeFineGrainSupport, "hipDeviceAttributeFineGrainSupport"}
|
||||
// {hipDeviceAttributeWallClockRate, "hipDeviceAttributeWallClockRate"}
|
||||
}};
|
||||
#endif
|
||||
|
||||
constexpr int kW = 60;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
template <size_t n> void printAttributes(const AttributeToStringMap<n>& attributes, const int device) {
|
||||
int attribute_value;
|
||||
hipError_t ret_val;
|
||||
for (const auto& attribute : attributes) {
|
||||
ret_val = hipDeviceGetAttribute(&attribute_value, attribute.first, device);
|
||||
std::cout << std::setw(kW) << std::string(attribute.second).append(": ");
|
||||
if (ret_val == hipSuccess)
|
||||
std::cout << attribute_value << "\n";
|
||||
else
|
||||
std::cout << "unsupported\n";
|
||||
}
|
||||
std::flush(std::cout);
|
||||
}
|
||||
|
||||
TEST_CASE("Print_Out_Attributes") {
|
||||
const auto device = GENERATE(range(0, HipTest::getDeviceCount()));
|
||||
hipDeviceProp_t properties;
|
||||
HIP_CHECK(hipGetDeviceProperties(&properties, device));
|
||||
|
||||
std::cout << std::left;
|
||||
std::cout << std::setw(kW) << "device#: " << device << "\n";
|
||||
std::cout << std::setw(kW) << "name: " << properties.name << "\n";
|
||||
|
||||
printAttributes(kCommonAttributes, device);
|
||||
|
||||
#if HT_NVIDIA
|
||||
std::cout << "\nCUDA only\n";
|
||||
std::cout << std::setw(kW)
|
||||
<< "--------------------------------------------------------------------------------"
|
||||
<< "\n";
|
||||
printAttributes(kCudaOnlyAttributes, device);
|
||||
#endif
|
||||
|
||||
#if HT_AMD
|
||||
std::cout << "\nAMD only\n";
|
||||
std::cout << std::setw(kW)
|
||||
<< "--------------------------------------------------------------------------------"
|
||||
<< "\n";
|
||||
printAttributes(kAmdOnlyAttributes, device);
|
||||
#endif
|
||||
|
||||
std::flush(std::cout);
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
/*
|
||||
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Copyright (c) 2022 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 WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -55,3 +58,7 @@ TEST_CASE("Unit_hipGetDeviceCount_HideDevices") {
|
||||
REQUIRE(proc.run(visibleStr) == i);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Print_Out_Device_Count") {
|
||||
std::cout << "Device Count: " << HipTest::getDeviceCount() << std::endl;
|
||||
}
|
||||
@@ -163,6 +163,7 @@ TEST_CASE("Unit_hipGetDeviceProperties_ArchPropertiesTst") {
|
||||
hipMemcpyHostToDevice));
|
||||
hipLaunchKernelGGL(mykernel, dim3(1), dim3(1),
|
||||
0, 0, archProp_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(archProp_h, archProp_d,
|
||||
NUM_OF_ARCHPROP*sizeof(int), hipMemcpyDeviceToHost));
|
||||
// Validate the host architecture property with device
|
||||
@@ -199,3 +200,122 @@ TEST_CASE("Unit_hipGetDeviceProperties_NegTst") {
|
||||
REQUIRE_FALSE(hipSuccess == hipGetDeviceProperties(&prop, deviceCount));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Print_Out_Properties") {
|
||||
constexpr int w = 42;
|
||||
const auto device = GENERATE(range(0, HipTest::getDeviceCount()));
|
||||
|
||||
hipDeviceProp_t properties;
|
||||
HIP_CHECK(hipGetDeviceProperties(&properties, device));
|
||||
|
||||
std::cout << std::left;
|
||||
std::cout << std::setw(w) << "device#: " << device << "\n";
|
||||
std::cout << std::setw(w) << "name: " << std::string(properties.name, 256) << "\n";
|
||||
std::cout << std::setw(w) << "totalGlobalMem: " << properties.totalGlobalMem << "\n";
|
||||
std::cout << std::setw(w) << "sharedMemPerBlock: " << properties.sharedMemPerBlock << "\n";
|
||||
std::cout << std::setw(w) << "regsPerBlock: " << properties.regsPerBlock << "\n";
|
||||
std::cout << std::setw(w) << "warpSize: " << properties.warpSize << "\n";
|
||||
std::cout << std::setw(w) << "maxThreadsPerBlock: " << properties.maxThreadsPerBlock << "\n";
|
||||
std::cout << std::setw(w) << "maxThreadsDim.x: " << properties.maxThreadsDim[0] << "\n";
|
||||
std::cout << std::setw(w) << "maxThreadsDim.y: " << properties.maxThreadsDim[1] << "\n";
|
||||
std::cout << std::setw(w) << "maxThreadsDim.z: " << properties.maxThreadsDim[2] << "\n";
|
||||
std::cout << std::setw(w) << "maxGridSize.x: " << properties.maxGridSize[0] << "\n";
|
||||
std::cout << std::setw(w) << "maxGridSize.y: " << properties.maxGridSize[1] << "\n";
|
||||
std::cout << std::setw(w) << "maxGridSize.z: " << properties.maxGridSize[2] << "\n";
|
||||
std::cout << std::setw(w) << "clockRate: " << properties.clockRate << "\n";
|
||||
std::cout << std::setw(w) << "memoryClockRate: " << properties.memoryClockRate << "\n";
|
||||
std::cout << std::setw(w) << "memoryBusWidth: " << properties.memoryBusWidth << "\n";
|
||||
std::cout << std::setw(w) << "totalConstMem: " << properties.totalConstMem << "\n";
|
||||
std::cout << std::setw(w) << "major: " << properties.major << "\n";
|
||||
std::cout << std::setw(w) << "minor: " << properties.minor << "\n";
|
||||
std::cout << std::setw(w) << "multiProcessorCount: " << properties.multiProcessorCount << "\n";
|
||||
std::cout << std::setw(w) << "l2CacheSize: " << properties.l2CacheSize << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "maxThreadsPerMultiProcessor: " << properties.maxThreadsPerMultiProcessor << "\n";
|
||||
std::cout << std::setw(w) << "computeMode: " << properties.computeMode << "\n";
|
||||
std::cout << std::setw(w) << "concurrentKernels: " << properties.concurrentKernels << "\n";
|
||||
std::cout << std::setw(w) << "pciDomainID: " << properties.pciDomainID << "\n";
|
||||
std::cout << std::setw(w) << "pciBusID: " << properties.pciBusID << "\n";
|
||||
std::cout << std::setw(w) << "pciDeviceID: " << properties.pciDeviceID << "\n";
|
||||
std::cout << std::setw(w) << "isMultiGpuBoard: " << properties.isMultiGpuBoard << "\n";
|
||||
std::cout << std::setw(w) << "canMapHostMemory: " << properties.canMapHostMemory << "\n";
|
||||
std::cout << std::setw(w) << "integrated: " << properties.integrated << "\n";
|
||||
std::cout << std::setw(w) << "cooperativeLaunch: " << properties.cooperativeLaunch << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "cooperativeMultiDeviceLaunch: " << properties.cooperativeMultiDeviceLaunch << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture1DLinear: " << properties.maxTexture1DLinear << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture1D: " << properties.maxTexture1D << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture2D.width: " << properties.maxTexture2D[0] << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture2D.height: " << properties.maxTexture2D[1] << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture3D.width: " << properties.maxTexture3D[0] << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture3D.height: " << properties.maxTexture3D[1] << "\n";
|
||||
std::cout << std::setw(w) << "maxTexture3D.depth: " << properties.maxTexture3D[2] << "\n";
|
||||
std::cout << std::setw(w) << "memPitch: " << properties.memPitch << "\n";
|
||||
std::cout << std::setw(w) << "textureAlignment: " << properties.textureAlignment << "\n";
|
||||
std::cout << std::setw(w) << "texturePitchAlignment: " << properties.texturePitchAlignment
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "kernelExecTimeoutEnabled: " << properties.kernelExecTimeoutEnabled
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "ECCEnabled: " << properties.ECCEnabled << "\n";
|
||||
std::cout << std::setw(w) << "tccDriver: " << properties.tccDriver << "\n";
|
||||
std::cout << std::setw(w) << "managedMemory: " << properties.managedMemory << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "directManagedMemAccessFromHost: " << properties.directManagedMemAccessFromHost
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "concurrentManagedAccess: " << properties.concurrentManagedAccess
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "pageableMemoryAccess: " << properties.pageableMemoryAccess << "\n";
|
||||
std::cout << std::setw(w) << "pageableMemoryAccessUsesHostPageTables: "
|
||||
<< properties.pageableMemoryAccessUsesHostPageTables << "\n";
|
||||
|
||||
#if HT_AMD
|
||||
std::cout << std::setw(w) << "gcnArch: " << properties.gcnArch << "\n";
|
||||
std::cout << std::setw(w) << "gcnArchName: " << std::string(properties.gcnArchName, 256) << "\n";
|
||||
std::cout << std::setw(w) << "asicRevision: " << properties.asicRevision << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasGlobalInt32Atomics: " << properties.arch.hasGlobalInt32Atomics << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasGlobalFloatAtomicExch: " << properties.arch.hasGlobalFloatAtomicExch
|
||||
<< "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasSharedInt32Atomics: " << properties.arch.hasSharedInt32Atomics << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasSharedFloatAtomicExch: " << properties.arch.hasSharedFloatAtomicExch
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "arch.hasFloatAtomicAdd: " << properties.arch.hasFloatAtomicAdd
|
||||
<< "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasGlobalInt64Atomics: " << properties.arch.hasGlobalInt64Atomics << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasSharedInt64Atomics: " << properties.arch.hasSharedInt64Atomics << "\n";
|
||||
std::cout << std::setw(w) << "arch.hasDoubles: " << properties.arch.hasDoubles << "\n";
|
||||
std::cout << std::setw(w) << "arch.hasWarpVote: " << properties.arch.hasWarpVote << "\n";
|
||||
std::cout << std::setw(w) << "arch.hasWarpBallot: " << properties.arch.hasWarpBallot << "\n";
|
||||
std::cout << std::setw(w) << "arch.hasWarpShuffle: " << properties.arch.hasWarpShuffle << "\n";
|
||||
std::cout << std::setw(w) << "arch.hasFunnelShift: " << properties.arch.hasFunnelShift << "\n";
|
||||
std::cout << std::setw(w) << "arch.hasThreadFenceSystem: " << properties.arch.hasThreadFenceSystem
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "arch.hasSyncThreadsExt: " << properties.arch.hasSyncThreadsExt
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "arch.hasSurfaceFuncs: " << properties.arch.hasSurfaceFuncs << "\n";
|
||||
std::cout << std::setw(w) << "arch.has3dGrid: " << properties.arch.has3dGrid << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "arch.hasDynamicParallelism: " << properties.arch.hasDynamicParallelism << "\n";
|
||||
std::cout << std::setw(w) << "isLargeBar: " << properties.isLargeBar << "\n";
|
||||
std::cout << std::setw(w)
|
||||
<< "maxSharedMemoryPerMultiProcessor: " << properties.maxSharedMemoryPerMultiProcessor
|
||||
<< "\n";
|
||||
std::cout << std::setw(w) << "hdpMemFlushCntl: " << properties.hdpMemFlushCntl << "\n";
|
||||
std::cout << std::setw(w) << "hdpRegFlushCntl: " << properties.hdpRegFlushCntl << "\n";
|
||||
std::cout << std::setw(w) << "clockInstructionRate: " << properties.clockInstructionRate << "\n";
|
||||
std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedFunc: "
|
||||
<< properties.cooperativeMultiDeviceUnmatchedFunc << "\n";
|
||||
std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedGridDim: "
|
||||
<< properties.cooperativeMultiDeviceUnmatchedGridDim << "\n";
|
||||
std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedBlockDim: "
|
||||
<< properties.cooperativeMultiDeviceUnmatchedBlockDim << "\n";
|
||||
std::cout << std::setw(w) << "cooperativeMultiDeviceUnmatchedSharedMem: "
|
||||
<< properties.cooperativeMultiDeviceUnmatchedSharedMem << "\n";
|
||||
#endif
|
||||
std::flush(std::cout);
|
||||
}
|
||||
@@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_Coherentwithnounsafeflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
testResult = HipTest::assemblyFile_Verification<TestType>(
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_Coherentwithoutflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
testResult = HipTest::assemblyFile_Verification<TestType>(
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_CoherentwithUnsafeflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_NonCoherentwithnounsafeflag", "",
|
||||
dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_NonCoherentwithoutflag", "",
|
||||
dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_NonCoherentwithUnsafeflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -76,6 +76,7 @@ TEST_CASE("Unit_BuiltInAtomicAdd_CoherentGlobalMem") {
|
||||
hipLaunchKernelGGL(AtomicAdd_GlobalMem, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
std::cout << "test 1" << std::endl;
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
REQUIRE(A_h[0] == INITIAL_VAL);
|
||||
@@ -118,6 +119,7 @@ TEST_CASE("Unit_BuiltInAtomicAdd_NonCoherentGlobalMem") {
|
||||
hipLaunchKernelGGL(AtomicAdd_GlobalMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d),
|
||||
static_cast<double* >(result));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost));
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -112,6 +112,7 @@ TEST_CASE("Unit_BuiltinAtomics_fmaxCoherentGlobalMem") {
|
||||
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&result), sizeof(double)));
|
||||
hipLaunchKernelGGL(unsafeAtomicMax_GlobalMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d), result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost));
|
||||
REQUIRE(*B_h == 0);
|
||||
@@ -159,9 +160,11 @@ TEST_CASE("Unit_BuiltinAtomics_fmaxNonCoherentGlobalFlatMem") {
|
||||
if (mem_type) {
|
||||
hipLaunchKernelGGL(unsafeAtomicMax_GlobalMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d), result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
} else {
|
||||
hipLaunchKernelGGL(unsafeAtomicMax_FlatMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d), result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -112,6 +112,7 @@ TEST_CASE("Unit_BuiltinAtomics_fminCoherentGlobalMem") {
|
||||
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&result), sizeof(double)));
|
||||
hipLaunchKernelGGL(unsafeAtomicMin_GlobalMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d), result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost));
|
||||
REQUIRE(*B_h == 0);
|
||||
@@ -159,9 +160,11 @@ TEST_CASE("Unit_BuiltinAtomics_fminNonCoherentGlobalFlatMem") {
|
||||
if (mem_type) {
|
||||
hipLaunchKernelGGL(unsafeAtomicMin_GlobalMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d), result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
} else {
|
||||
hipLaunchKernelGGL(unsafeAtomicMin_FlatMem, dim3(1), dim3(1),
|
||||
0, 0, static_cast<double* >(A_d), result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -65,6 +65,7 @@ TEST_CASE("Unit_AnyAll_CompileTest") {
|
||||
hipLaunchKernelGGL(warpvote, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0,
|
||||
device_any, device_all, pshift);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(
|
||||
hipMemcpy(host_any, device_any, Num_Warps_per_Grid * sizeof(int), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(
|
||||
|
||||
@@ -66,6 +66,7 @@ TEST_CASE("Unit_ballot") {
|
||||
hipLaunchKernelGGL(gpu_ballot, dim3(Num_Blocks_per_Grid), dim3(Num_Threads_per_Block), 0, 0,
|
||||
device_ballot, Num_Warps_per_Block, pshift);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(host_ballot, device_ballot, Num_Warps_per_Grid * sizeof(unsigned int),
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ TEST_CASE("Unit_bitExtract") {
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block), 0, 0, deviceOut32,
|
||||
deviceSrc032, deviceSrc132, deviceSrc232, deviceOut64, deviceSrc064,
|
||||
deviceSrc164, deviceSrc264);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostOut32, deviceOut32, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -158,6 +158,7 @@ TEST_CASE("Unit_bitInsert") {
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block), 0, 0, deviceOut32,
|
||||
deviceSrc032, deviceSrc132, deviceSrc232, deviceSrc332, deviceOut64,
|
||||
deviceSrc064, deviceSrc164, deviceSrc264, deviceSrc364);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostOut32, deviceOut32, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -115,6 +115,7 @@ TEST_CASE("Unit_brev") {
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB,
|
||||
deviceC, deviceD, WIDTH, HEIGHT);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -136,6 +136,7 @@ TEST_CASE("Unit_clz") {
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB,
|
||||
deviceC, deviceD, WIDTH, HEIGHT);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -110,6 +110,7 @@ TEST_CASE("Unit_ffs") {
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB,
|
||||
deviceC, deviceD, WIDTH, HEIGHT);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -56,6 +56,7 @@ TEST_CASE("Unit_deviceFunctions_CompileTest") {
|
||||
res = hipMalloc((void**)&Outd, SIZE);
|
||||
REQUIRE(res == hipSuccess);
|
||||
hipLaunchKernelGGL(floatMath, dim3(LEN, 1, 1), dim3(1, 1, 1), 0, 0, Ind, Outd);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
res = hipDeviceSynchronize();
|
||||
REQUIRE(res == hipSuccess);
|
||||
res = hipGetLastError();
|
||||
|
||||
@@ -129,6 +129,7 @@ template <typename T, typename D> void testType(int msize) {
|
||||
|
||||
auto kernel = testOperationsGPU<T, D>;
|
||||
hipLaunchKernelGGL(kernel, 1, msize, 0, 0, d_fa, d_fb, msize);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
HIP_CHECK(hipMemcpy(fc, d_fa, sizeof(T) * msize, hipMemcpyDeviceToHost));
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ TEST_CASE("Unit_funnelshift") {
|
||||
|
||||
hipLaunchKernelGGL(funnelshift_kernel, dim3(1), dim3(1), 0, 0, device_l_output, device_lc_output,
|
||||
device_r_output, device_rc_output);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(host_l_output, device_l_output, NUM_TESTS * sizeof(unsigned int),
|
||||
hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpy(host_lc_output, device_lc_output, NUM_TESTS * sizeof(unsigned int),
|
||||
|
||||
@@ -69,6 +69,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") {
|
||||
hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), Am, SIZE, 0, hipMemcpyHostToDevice, stream));
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpyFromSymbolAsync(Cm, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost,
|
||||
stream));
|
||||
@@ -83,6 +84,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") {
|
||||
SECTION("Calling hipMemcpyTo/FromSymbol - validate value in host memory") {
|
||||
HIP_CHECK(hipMemcpyToSymbol(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice));
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpyFromSymbol(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -99,6 +101,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") {
|
||||
hipMemcpyToSymbolAsync(HIP_SYMBOL(globalIn), A, SIZE, 0, hipMemcpyHostToDevice, stream));
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(
|
||||
hipMemcpyFromSymbolAsync(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost, stream));
|
||||
@@ -116,6 +119,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") {
|
||||
hipStreamPerThread));
|
||||
HIP_CHECK(hipStreamSynchronize(hipStreamPerThread));
|
||||
hipLaunchKernelGGL(Assign, dim3(1, 1, 1), dim3(NUM, 1, 1), 0, 0, Ad);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(B, Ad, SIZE, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpyFromSymbolAsync(C, HIP_SYMBOL(globalOut), SIZE, 0, hipMemcpyDeviceToHost,
|
||||
hipStreamPerThread));
|
||||
@@ -139,6 +143,7 @@ TEST_CASE("Unit_hipMemcpyToSymbolAsync_ToNFrom") {
|
||||
HIP_CHECK(hipGetSymbolAddress((void**)&symbolAddress, HIP_SYMBOL(globalConst)));
|
||||
HIP_CHECK(hipMalloc((void**)&checkOkD, sizeof(bool)));
|
||||
hipLaunchKernelGGL(checkAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, symbolAddress, checkOkD);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipFree(checkOkD));
|
||||
HIP_ASSERT(checkOk);
|
||||
@@ -171,6 +176,7 @@ TEST_CASE("Unit_hipGetSymbolAddressAndSize_Validation") {
|
||||
HIP_CHECK(hipMalloc(&checkOkD, sizeof(bool)));
|
||||
hipLaunchKernelGGL(checkGlobalConstAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0,
|
||||
symbolArrAddress, checkOkD);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipFree(checkOkD));
|
||||
HIP_ASSERT(checkOk);
|
||||
@@ -184,6 +190,7 @@ TEST_CASE("Unit_hipGetSymbolAddressAndSize_Validation") {
|
||||
HIP_CHECK(hipMalloc(&checkOkD, sizeof(bool)));
|
||||
hipLaunchKernelGGL(checkStaticConstVarAddress, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0,
|
||||
symbolVarAddress, checkOkD);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(&checkOk, checkOkD, sizeof(bool), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipFree(checkOkD));
|
||||
HIP_ASSERT(checkOk);
|
||||
|
||||
@@ -100,6 +100,7 @@ template <typename T, typename U> int dataTypesRun() {
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA,
|
||||
static_cast<const T*>(deviceB), WIDTH, HEIGHT);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(T), hipMemcpyDeviceToHost));
|
||||
@@ -148,7 +149,7 @@ template <typename T, typename U> int dataTypesRun2() {
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA,
|
||||
static_cast<const T*>(deviceB), WIDTH, HEIGHT);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(T), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -198,7 +199,7 @@ template <typename T, typename U> int dataTypesRun4() {
|
||||
dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA,
|
||||
static_cast<const T*>(deviceB), WIDTH, HEIGHT);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(T), hipMemcpyDeviceToHost));
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ TEST_CASE("Unit_mbcnt") {
|
||||
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(num_blocks), dim3(num_threads_per_block), 0, 0,
|
||||
device_mbcnt_lo, device_mbcnt_hi, device_lane_id);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
unsigned int* host_mbcnt_lo = (unsigned int*)malloc(buffer_size);
|
||||
unsigned int* host_mbcnt_hi = (unsigned int*)malloc(buffer_size);
|
||||
unsigned int* host_lane_id = (unsigned int*)malloc(buffer_size);
|
||||
|
||||
@@ -100,7 +100,7 @@ TEST_CASE("Unit_popc") {
|
||||
hipLaunchKernelGGL(HIP_kernel, dim3(WIDTH / THREADS_PER_BLOCK_X, HEIGHT / THREADS_PER_BLOCK_Y),
|
||||
dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), 0, 0, deviceA, deviceB,
|
||||
deviceC, deviceD, WIDTH, HEIGHT);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
HIP_CHECK(hipMemcpy(hostA, deviceA, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpy(hostC, deviceC, NUM * sizeof(unsigned int), hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -88,7 +88,7 @@ static void test_syncthreads_and(int blockSize) {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_syncthreads_and, 2, blockSize, 0, 0, syncTestD, allThreadsZeroD,
|
||||
allThreadsOneD, oneThreadZeroD, allThreadsMinusOneD);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
// Copy result from device to host
|
||||
HIP_CHECK(hipMemcpy(syncTestH, syncTestD, nBytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpy(allThreadsZeroH, allThreadsZeroD, nBytes, hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -95,7 +95,7 @@ void test_syncthreads_count(int blockSize) {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_syncthreads_count, 2, blockSize, 0, 0, syncTestD, allThreadsZeroD,
|
||||
allThreadsOneD, oddThreadsOneD, allThreadsMinusOneD, allThreadsIdD);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
// Copy result from device to host
|
||||
HIP_CHECK(hipMemcpy(syncTestH, syncTestD, nBytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpy(allThreadsZeroH, allThreadsZeroD, nBytes, hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -88,7 +88,7 @@ static void test_syncthreads_or(int blockSize) {
|
||||
// Launch Kernel
|
||||
hipLaunchKernelGGL(kernel_syncthreads_or, 2, blockSize, 0, 0, syncTestD, allThreadsZeroD,
|
||||
allThreadsOneD, oneThreadOneD, allThreadsMinusOneD);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
// Copy result from device to host
|
||||
HIP_CHECK(hipMemcpy(syncTestH, syncTestD, nBytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipMemcpy(allThreadsZeroH, allThreadsZeroD, nBytes, hipMemcpyDeviceToHost));
|
||||
|
||||
@@ -92,6 +92,7 @@ TEST_CASE("Unit_threadfence_system") {
|
||||
HIP_CHECK(hipSetDevice(next_id - 1));
|
||||
hipLaunchKernelGGL(gpu_round_robin, dim_grid, dim_block, 0, 0x0, next_id, num_dev, num_iter,
|
||||
data, flag);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentwithnoUnsafeflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_Coherentwithoutflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentwithUnsafeflag", "",
|
||||
hipLaunchKernelGGL(AtomicCheck<TestType>, dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_NonCoherentnounsafeatomicsflag", "",
|
||||
dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_NonCoherentwithoutflag", "",
|
||||
dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -72,6 +72,7 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_NonCoherentwithunsafeatomicsflag", "",
|
||||
dim3(1), dim3(1),
|
||||
0, 0, A_d,
|
||||
result_d);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
bool testResult;
|
||||
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
|
||||
|
||||
@@ -224,6 +224,7 @@ template <typename V> bool run_CheckSharedVectorType() {
|
||||
if (hipMalloc(&ptr, sizeof(bool)) != HIP_SUCCESS) return false;
|
||||
unique_ptr<bool, decltype(hipFree)*> correct{ptr, hipFree};
|
||||
hipLaunchKernelGGL((CheckSharedVectorType<V>), dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, correct.get());
|
||||
HIP_CHECK(hipGetLastError());
|
||||
bool passed = true;
|
||||
if (hipMemcpyDtoH(&passed, correct.get(), sizeof(bool)) != HIP_SUCCESS) {
|
||||
return false;
|
||||
@@ -252,7 +253,7 @@ TEST_CASE("Unit_vectorTypes_CompileTest") {
|
||||
|
||||
unique_ptr<bool, decltype(hipFree)*> correct{ptr, hipFree};
|
||||
hipLaunchKernelGGL(CheckVectorTypes, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, correct.get());
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
bool passed = true;
|
||||
res = hipMemcpyDtoH(&passed, correct.get(), sizeof(bool));
|
||||
REQUIRE(res == hipSuccess);
|
||||
|
||||
@@ -7,6 +7,7 @@ set(TEST_SRC
|
||||
Unit_hipEventIpc.cc
|
||||
hipEventDestroy.cc
|
||||
hipEventCreateWithFlags.cc
|
||||
hipEventSynchronize.cc
|
||||
)
|
||||
|
||||
# The test used wait mechanism and doesnt play well with all arch of nvidia
|
||||
|
||||
@@ -80,6 +80,7 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_
|
||||
HIP_CHECK(hipEventRecord(start, stream));
|
||||
hipLaunchKernelGGL(HipTest::addCountReverse, dim3(blocks), dim3(threadsPerBlock), 0, stream,
|
||||
static_cast<const int*>(C_d), C_h, numElements, count);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipEventRecord(stop, stream));
|
||||
|
||||
if (waitStart) {
|
||||
@@ -111,10 +112,11 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_
|
||||
REQUIRE(false);
|
||||
}
|
||||
|
||||
if (e == hipSuccess) assert(t == 0.0f);
|
||||
if (e == hipSuccess) HIP_ASSERT(t == 0.0f);
|
||||
|
||||
// stop usually ready unless we skipped the synchronization (syncNone)
|
||||
HIP_ASSERT(hipEventElapsedTime(&t, stop, stop) == expectedStopError);
|
||||
e = hipEventElapsedTime(&t, stop, stop);
|
||||
HIP_ASSERT(e == expectedStopError);
|
||||
if (e == hipSuccess) assert(t == 0.0f);
|
||||
|
||||
e = hipEventElapsedTime(&t, start, stop);
|
||||
@@ -136,7 +138,7 @@ void test(unsigned testMask, int* C_d, int* C_h, int64_t numElements, hipStream_
|
||||
HIP_ASSERT(hipEventElapsedTime(&t, start, neverCreated) == hipErrorInvalidHandle);
|
||||
|
||||
HIP_ASSERT(hipEventElapsedTime(&t, neverRecorded, stop) == hipErrorInvalidHandle);
|
||||
HIP_ASSERT(hipEventElapsedTime(&t, start, neverRecorded) == hipErrorInvalidHandle);
|
||||
HIP_ASSERT(hipGetLastError() == hipErrorInvalidHandle);
|
||||
}
|
||||
|
||||
HIP_CHECK(hipEventDestroy(neverRecorded));
|
||||
|
||||
@@ -19,8 +19,19 @@ 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.
|
||||
*/
|
||||
/*
|
||||
Testcase Scenarios :
|
||||
Unit_hipEventElapsedTime_NullCheck - Test unsuccessful hipEventElapsedTime when either event passed as nullptr
|
||||
Unit_hipEventElapsedTime_DisableTiming - Test unsuccessful hipEventElapsedTime when events are created with hipEventDisableTiming flag
|
||||
Unit_hipEventElapsedTime_DifferentDevices - Test unsuccessful hipEventElapsedTime when events are recorded on different devices
|
||||
Unit_hipEventElapsedTime_NotReady_Negative - Test unsuccessful hipEventElapsedTime when an event has not been completed
|
||||
Unit_hipEventElapsedTime - Test time elapsed between two recorded events with hipEventElapsedTime api
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
#include <hip_test_checkers.hh>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE("Unit_hipEventElapsedTime_NullCheck") {
|
||||
@@ -51,9 +62,7 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") {
|
||||
// create event on dev=0
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
hipEvent_t start;
|
||||
hipEvent_t start1;
|
||||
HIP_CHECK(hipEventCreate(&start));
|
||||
HIP_CHECK(hipEventCreate(&start1));
|
||||
|
||||
HIP_CHECK(hipEventRecord(start, nullptr));
|
||||
HIP_CHECK(hipEventSynchronize(start));
|
||||
@@ -63,9 +72,6 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") {
|
||||
hipEvent_t stop;
|
||||
HIP_CHECK(hipEventCreate(&stop));
|
||||
|
||||
// start1 on device 0 but null stream on device 1
|
||||
HIP_ASSERT(hipEventRecord(start1, nullptr) == hipErrorInvalidHandle);
|
||||
|
||||
HIP_CHECK(hipEventRecord(stop, nullptr));
|
||||
HIP_CHECK(hipEventSynchronize(stop));
|
||||
|
||||
@@ -74,11 +80,37 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") {
|
||||
HIP_ASSERT(hipEventElapsedTime(&tElapsed,start,stop) == hipErrorInvalidHandle);
|
||||
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
HIP_CHECK(hipEventDestroy(start1));
|
||||
HIP_CHECK(hipEventDestroy(stop));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if HT_AMD /* Disabled because frequency based wait is timing out on nvidia platforms */
|
||||
TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") {
|
||||
hipEvent_t start;
|
||||
HIP_CHECK(hipEventCreate(&start));
|
||||
|
||||
hipEvent_t stop;
|
||||
HIP_CHECK(hipEventCreate(&stop));
|
||||
|
||||
// Record start event
|
||||
HIP_CHECK(hipEventRecord(start, nullptr));
|
||||
|
||||
HipTest::runKernelForDuration(std::chrono::milliseconds(1000));
|
||||
|
||||
// Record stop event
|
||||
HIP_CHECK(hipEventRecord(stop, nullptr));
|
||||
|
||||
// stop event has not been completed
|
||||
float tElapsed = 1.0f;
|
||||
HIP_CHECK_ERROR(hipEventQuery(stop), hipErrorNotReady);
|
||||
HIP_ASSERT(hipEventElapsedTime(&tElapsed,start,stop) == hipErrorNotReady);
|
||||
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
HIP_CHECK(hipEventDestroy(stop));
|
||||
}
|
||||
#endif // HT_AMD
|
||||
|
||||
TEST_CASE("Unit_hipEventElapsedTime") {
|
||||
hipEvent_t start;
|
||||
HIP_CHECK(hipEventCreate(&start));
|
||||
|
||||
@@ -65,7 +65,7 @@ TEST_CASE("Unit_hipEventIpc") {
|
||||
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0,
|
||||
static_cast<const float*>(A_d), static_cast<const float*>(B_d), C_d, N);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
HIP_CHECK(hipEventRecord(stop, NULL));
|
||||
HIP_CHECK(hipEventSynchronize(stop));
|
||||
|
||||
@@ -19,8 +19,12 @@ 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.
|
||||
*/
|
||||
|
||||
// Test hipEventRecord serialization behavior.
|
||||
/*
|
||||
Testcase Scenarios :
|
||||
Unit_hipEventRecord- Test hipEventRecord serialization behavior
|
||||
Unit_hipEventRecord_Negative - Test unsuccessful hipEventRecord when event is passed as nullptr
|
||||
- Test unsuccessful hipEventRecord when event is created/recorded on different devices
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
@@ -84,7 +88,7 @@ TEST_CASE("Unit_hipEventRecord") {
|
||||
HipTest::launchKernel<float>(HipTest::vectorADD<float>, blocks, 1, 0, 0,
|
||||
static_cast<const float*>(A_d), static_cast<const float*>(B_d),
|
||||
C_d, N);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipEventRecord(stop, NULL));
|
||||
HIP_CHECK(hipEventSynchronize(stop));
|
||||
long long hostStop = HipTest::get_time();
|
||||
@@ -117,4 +121,21 @@ TEST_CASE("Unit_hipEventRecord_Negative") {
|
||||
SECTION("Nullptr event") {
|
||||
HIP_CHECK_ERROR(hipEventRecord(nullptr, nullptr), hipErrorInvalidResourceHandle);
|
||||
}
|
||||
|
||||
SECTION("Different devices") {
|
||||
int devCount = 0;
|
||||
HIP_CHECK(hipGetDeviceCount(&devCount));
|
||||
if (devCount > 1) {
|
||||
// create event on dev=0
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
hipEvent_t start;
|
||||
HIP_CHECK(hipEventCreate(&start));
|
||||
|
||||
// start on device 0 but null stream on device 1
|
||||
HIP_CHECK(hipSetDevice(1));
|
||||
HIP_CHECK_ERROR(hipEventRecord(start, nullptr), hipErrorInvalidHandle)
|
||||
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
Copyright (c) 2022 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.
|
||||
*/
|
||||
/*
|
||||
Testcase Scenarios :
|
||||
Unit_hipEventSynchronize_Default_Positive- Test synchronization of an event that is completed after a simple kernel launch (on null/created stream)
|
||||
Unit_hipEventSynchronize_NoEventRecord_Positive - Test synchronization of an event that has not been recorded
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
#include <kernels.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
|
||||
void testSynchronize(hipStream_t stream) {
|
||||
|
||||
constexpr size_t N = 1024;
|
||||
|
||||
constexpr int blocks = 1024;
|
||||
|
||||
constexpr size_t Nbytes = N * sizeof(float);
|
||||
|
||||
float *A_h, *B_h, *C_h;
|
||||
float *A_d, *B_d, *C_d;
|
||||
HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N);
|
||||
|
||||
hipEvent_t end_event;
|
||||
HIP_CHECK(hipEventCreate(&end_event));
|
||||
|
||||
HIP_CHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
HipTest::launchKernel<float>(HipTest::vectorADD<float>, blocks, 1, 0, stream,
|
||||
static_cast<const float*>(A_d), static_cast<const float*>(B_d),
|
||||
C_d, N);
|
||||
|
||||
if ( stream != nullptr )
|
||||
{
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
}
|
||||
|
||||
// Record the end_event
|
||||
HIP_CHECK(hipEventRecord(end_event, nullptr));
|
||||
// Wait for the end_event to complete
|
||||
HIP_CHECK(hipEventSynchronize(end_event));
|
||||
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
HIP_CHECK(hipEventDestroy(end_event));
|
||||
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, N, true);
|
||||
HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false);
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipEventSynchronize_Default_Positive") {
|
||||
hipStream_t stream{nullptr};
|
||||
|
||||
SECTION("Kernel launched in null stream") {
|
||||
testSynchronize(stream);
|
||||
}
|
||||
|
||||
SECTION ("Kernel launched in created stream") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
testSynchronize(stream);
|
||||
HIP_CHECK(hipStreamDestroy(stream));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipEventSynchronize_NoEventRecord_Positive") {
|
||||
constexpr size_t N = 1024;
|
||||
|
||||
constexpr int blocks = 1024;
|
||||
|
||||
constexpr size_t Nbytes = N * sizeof(float);
|
||||
|
||||
float *A_h, *B_h, *C_h;
|
||||
float *A_d, *B_d, *C_d;
|
||||
HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N);
|
||||
|
||||
hipEvent_t dummy_event;
|
||||
HIP_CHECK(hipEventCreate(&dummy_event));
|
||||
|
||||
hipEvent_t end_event;
|
||||
HIP_CHECK(hipEventCreate(&end_event));
|
||||
|
||||
HIP_CHECK(hipMemcpy(A_d, A_h, Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipMemcpy(B_d, B_h, Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
HipTest::launchKernel<float>(HipTest::vectorADD<float>, blocks, 1, 0, 0,
|
||||
static_cast<const float*>(A_d), static_cast<const float*>(B_d),
|
||||
C_d, N);
|
||||
|
||||
// Record the end_event
|
||||
HIP_CHECK(hipEventRecord(end_event, NULL));
|
||||
|
||||
// When hipEventSynchronized is called on event that has not been recorded,
|
||||
// the function returns immediately
|
||||
HIP_CHECK(hipEventSynchronize(dummy_event));
|
||||
|
||||
// End event has not been completed
|
||||
HIP_CHECK_ERROR(hipEventQuery(end_event), hipErrorNotReady);
|
||||
// Wait for end_event to complete
|
||||
HIP_CHECK(hipEventSynchronize(end_event));
|
||||
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
HIP_CHECK(hipEventDestroy(dummy_event));
|
||||
HIP_CHECK(hipEventDestroy(end_event));
|
||||
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, N, true);
|
||||
HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false);
|
||||
}
|
||||
@@ -76,6 +76,8 @@ set(TEST_SRC
|
||||
hipGraphExecMemcpyNodeSetParamsToSymbol.cc
|
||||
hipGraphNodeGetDependentNodes.cc
|
||||
hipGraphNodeGetDependencies.cc
|
||||
hipGraphHostNodeGetParams.cc
|
||||
hipGraphExecChildGraphNodeSetParams.cc
|
||||
)
|
||||
|
||||
hip_add_exe_to_target(NAME GraphsTest
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
/*Copyright (c) 2022 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 WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS 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 INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
Testcase Scenarios of hipGraphExecChildGraphNodeSetParams API:
|
||||
|
||||
Functional Scenarios:
|
||||
1. Create child graph, Instantiate the graph and update the child graph
|
||||
using hipGraphExecChildGraphNodeSetParams API
|
||||
2. Create child graph with topology, Instantiate the graph
|
||||
and update the child graph
|
||||
using hipGraphExecChildGraphNodeSetParams API
|
||||
|
||||
Negative Scenarios:
|
||||
1. Pass nullptr to child graph
|
||||
2. Pass nullptr to graphnode
|
||||
3. Pass nullptr to graphExec
|
||||
4. Pass uninitialized graph node
|
||||
5. Pass orginial graph node instead of child graph node
|
||||
6. Change topology of child graph node
|
||||
**/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
#include <hip_test_kernels.hh>
|
||||
|
||||
|
||||
TEST_CASE("Unit_hipGraphExecChildGraphNodeSetParams_Negative") {
|
||||
constexpr size_t N = 1024;
|
||||
constexpr size_t Nbytes = N * sizeof(int);
|
||||
hipGraph_t graph, childgraph1, childgraph2;
|
||||
hipGraphExec_t graphExec;
|
||||
int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false);
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
std::vector<hipGraphNode_t> childdependencies;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph2, 0));
|
||||
hipGraphNode_t memcpyH2D_A, memcpyH2D_B, memcpyD2H_A,
|
||||
memcpyH2D_B_child, childGraphNode1;
|
||||
HIP_CHECK(hipMemcpy(C_d, C_h, Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
// Adding MemcpyNode to graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
// Adding memcpyNode to childgraph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, nullptr,
|
||||
0, B_d, A_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
|
||||
// Adding childnode to graph
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, childgraph1));
|
||||
|
||||
// Adding memcpynode to graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A, graph, nullptr,
|
||||
0, B_h, B_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, &childGraphNode1, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyD2H_A, 1));
|
||||
|
||||
// Adding memcpynode to new childgraph which is used to update the
|
||||
// childgraph node
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B_child, childgraph2, nullptr,
|
||||
0, B_d, C_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
|
||||
SECTION("Pass nullptr to graphExec") {
|
||||
REQUIRE(hipGraphExecChildGraphNodeSetParams(nullptr, childGraphNode1,
|
||||
childgraph2)
|
||||
== hipErrorInvalidValue);
|
||||
}
|
||||
SECTION("Pass nullptr to child graph node") {
|
||||
REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec, nullptr,
|
||||
childgraph2)
|
||||
== hipErrorInvalidValue);
|
||||
}
|
||||
SECTION("Pass nullptr to child graph") {
|
||||
REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec,
|
||||
childGraphNode1,
|
||||
nullptr)
|
||||
== hipErrorInvalidValue);
|
||||
}
|
||||
SECTION("Passing parent graph instead of child graph") {
|
||||
REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec,
|
||||
childGraphNode1, graph)
|
||||
!= hipSuccess);
|
||||
}
|
||||
SECTION("Updating the child graph topology") {
|
||||
hipGraphNode_t newnode;
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&newnode, childgraph2, nullptr,
|
||||
0, B_d, C_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph2, &memcpyH2D_B_child,
|
||||
&newnode, 1));
|
||||
|
||||
REQUIRE(hipGraphExecChildGraphNodeSetParams(graphExec, childGraphNode1,
|
||||
childgraph2)
|
||||
!= hipSuccess);
|
||||
}
|
||||
|
||||
HipTest::freeArrays<int>(A_d, B_d, C_d, A_h, B_h, C_h, false);
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(childgraph1));
|
||||
HIP_CHECK(hipGraphDestroy(childgraph2));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
}
|
||||
|
||||
/*
|
||||
This testcase verifies the following scenario
|
||||
Create graph, add child node to graph, Instantiate the graph
|
||||
and update the child graph node with a new graph
|
||||
using hipGraphExecChildGraphNodeSetParams API
|
||||
and execute it
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphExecChildGraphNodeSetParams_BasicFunc") {
|
||||
constexpr size_t N = 1024;
|
||||
constexpr size_t Nbytes = N * sizeof(int);
|
||||
hipGraph_t graph, childgraph1, childgraph2;
|
||||
hipGraphExec_t graphExec;
|
||||
int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false);
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
std::vector<hipGraphNode_t> childdependencies;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph2, 0));
|
||||
hipGraphNode_t memcpyH2D_A, memcpyH2D_B, memcpyD2H_A,
|
||||
memcpyH2D_B_child, childGraphNode1;
|
||||
HIP_CHECK(hipMemcpy(C_d, C_h, Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
// Adding MemcpyNode to graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
// Adding memcpyNode to childgraph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, nullptr,
|
||||
0, B_d, A_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
|
||||
// Adding childnode to graph
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, childgraph1));
|
||||
|
||||
// Adding memcpynode to graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A, graph, nullptr,
|
||||
0, B_h, B_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, &childGraphNode1, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyD2H_A, 1));
|
||||
|
||||
// Adding memcpynode to new childgraph which is used to update the
|
||||
// childgraph node
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B_child, childgraph2, nullptr,
|
||||
0, B_d, C_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
|
||||
// Update the childgraph node
|
||||
HIP_CHECK(hipGraphExecChildGraphNodeSetParams(graphExec, childGraphNode1,
|
||||
childgraph2));
|
||||
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
|
||||
// Verify graph execution result
|
||||
for (unsigned int i = 0; i < N; i++) {
|
||||
if (B_h[i] != C_h[i]) {
|
||||
WARN("Validation failed " << B_h[i] << "\t" << C_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
|
||||
HipTest::freeArrays<int>(A_d, B_d, C_d, A_h, B_h, C_h, false);
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(childgraph1));
|
||||
HIP_CHECK(hipGraphDestroy(childgraph2));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
}
|
||||
|
||||
/*
|
||||
This testcase verifies the following scenario
|
||||
Create graph, Create child graph with a topology and
|
||||
add child node to graph, Instantiate the graph
|
||||
and update the child graph node with a new graph
|
||||
using hipGraphExecChildGraphNodeSetParams API
|
||||
and execute it
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphExecChildGraphNodeSetParams_ChildTopology") {
|
||||
constexpr size_t N = 1024;
|
||||
constexpr size_t Nbytes = N * sizeof(int);
|
||||
constexpr auto blocksPerCU = 6; // to hide latency
|
||||
size_t NElem{N};
|
||||
constexpr auto threadsPerBlock = 256;
|
||||
hipGraph_t graph, childgraph1, childgraph2;
|
||||
hipGraphExec_t graphExec;
|
||||
hipKernelNodeParams kernelNodeParams{};
|
||||
hipGraphNode_t kernel_vecAdd;
|
||||
int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr};
|
||||
HipTest::initArrays(&A_d, &B_d, &C_d, &A_h, &B_h, &C_h, N, false);
|
||||
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N);
|
||||
std::vector<hipGraphNode_t> childdependencies, childdependencies1;
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
hipGraphNode_t memcpyH2D_A, memcpyH2D_B, memcpyH2D_C, childGraphNode1,
|
||||
memcpyD2H_A, memcpyD2D_AB;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph2, 0));
|
||||
|
||||
// Adding memcpy node to graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
// Adding memcpy node to child graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2D_AB, childgraph1, nullptr,
|
||||
0, B_d, A_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
childdependencies.push_back(memcpyD2D_AB);
|
||||
|
||||
// Adding memcpy node to child graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1,
|
||||
childdependencies.data(),
|
||||
childdependencies.size(), B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
// Adding memcpy node to child graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, childgraph1,
|
||||
childdependencies.data(),
|
||||
childdependencies.size(), C_d, C_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
childdependencies.clear();
|
||||
childdependencies.push_back(memcpyH2D_B);
|
||||
childdependencies.push_back(memcpyH2D_C);
|
||||
|
||||
void* kernelArgs2[] = {&B_d, &C_d, &A_d, reinterpret_cast<void *>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void *>(HipTest::vectorADD<int>);
|
||||
kernelNodeParams.gridDim = dim3(blocks);
|
||||
kernelNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kernelNodeParams.sharedMemBytes = 0;
|
||||
kernelNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs2);
|
||||
kernelNodeParams.extra = nullptr;
|
||||
|
||||
// Adding kernel node to child graph
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd, childgraph1,
|
||||
childdependencies.data(),
|
||||
childdependencies.size(),
|
||||
&kernelNodeParams));
|
||||
|
||||
// Adding child node to graph
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, childgraph1));
|
||||
|
||||
// Adding memcpy node to graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A, graph, nullptr,
|
||||
0, A_h, A_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A, &childGraphNode1, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyD2H_A, 1));
|
||||
|
||||
// Creating another child graph for updating parameters with the same topology
|
||||
// and passing the new child graph to hipGraphExecChildGraphNodeSetParams API
|
||||
hipGraphNode_t memcpyD2D_AB1, memcpyH2D_B1, memcpyH2D_C1, kernel_vecAdd1;
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2D_AB1, childgraph2, nullptr,
|
||||
0, B_d, A_d,
|
||||
Nbytes, hipMemcpyDeviceToDevice));
|
||||
childdependencies.clear();
|
||||
childdependencies.push_back(memcpyD2D_AB1);
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B1, childgraph2,
|
||||
childdependencies.data(),
|
||||
childdependencies.size(), B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C1, childgraph2,
|
||||
childdependencies.data(),
|
||||
childdependencies.size(), C_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
|
||||
childdependencies.clear();
|
||||
childdependencies.push_back(memcpyH2D_B1);
|
||||
childdependencies.push_back(memcpyH2D_C1);
|
||||
|
||||
void* kernelArgs21[] = {&B_d, &C_d, &A_d, reinterpret_cast<void *>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void *>(HipTest::vectorADD<int>);
|
||||
kernelNodeParams.gridDim = dim3(blocks);
|
||||
kernelNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kernelNodeParams.sharedMemBytes = 0;
|
||||
kernelNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs21);
|
||||
kernelNodeParams.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd1, childgraph2,
|
||||
childdependencies.data(),
|
||||
childdependencies.size(),
|
||||
&kernelNodeParams));
|
||||
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
|
||||
HIP_CHECK(hipGraphExecChildGraphNodeSetParams(graphExec,
|
||||
childGraphNode1, childgraph2));
|
||||
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
|
||||
// Verify child graph execution result
|
||||
HipTest::checkVectorADD(B_h, B_h, A_h, N);
|
||||
|
||||
HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false);
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(childgraph1));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
Copyright (c) 2022 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 WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS 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 INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
Testcase Scenarios of hipGraphHostNodeGetParams API:
|
||||
|
||||
Functional Scenarios:
|
||||
1) Create a graph, add Host node to graph with desired node params. Verify api fetches the node params
|
||||
which were mentioned while adding the host node.
|
||||
2) Set host node params with hipGraphHostNodeSetParams, now get the params and verify both are same.
|
||||
3) Create graph, Add Graphnodes and clones the graph. Add Hostnode to the cloned graph, update
|
||||
hostNode params using hipGraphHostNodeSetParams API now get the params and verify both are same
|
||||
|
||||
Negative Scenarios:
|
||||
|
||||
1) Pass pGraphNode as nullptr and verify api doesn’t crash, returns error code.
|
||||
2) Pass pNodeParams as nullptr and verify api doesn’t crash, returns error code.
|
||||
3) Pass unintialized graph node
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
|
||||
#define SIZE 1024
|
||||
|
||||
static void callbackfunc(void *A_h) {
|
||||
int *A = reinterpret_cast<int *>(A_h);
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
A[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static void callbackfunc_setparams(void *B_h) {
|
||||
int *B = reinterpret_cast<int *>(B_h);
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
B[i] = i * i;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This testcase verifies the negative scenarios of
|
||||
hipGraphHostNodeGetParams API
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphHostNodeGetParams_Negative") {
|
||||
constexpr size_t N = 1024;
|
||||
hipGraph_t graph;
|
||||
int *A_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *C_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, nullptr, &C_d,
|
||||
&A_h, nullptr, &C_h, N, false);
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
|
||||
hipGraphNode_t hostNode;
|
||||
hipHostNodeParams hostParams = {0, 0};
|
||||
hostParams.fn = callbackfunc;
|
||||
hostParams.userData = A_h;
|
||||
HIP_CHECK(hipGraphAddHostNode(&hostNode, graph,
|
||||
nullptr,
|
||||
0, &hostParams));
|
||||
hipHostNodeParams GethostParams;
|
||||
|
||||
SECTION("Passing nullptr to graph node") {
|
||||
REQUIRE(hipGraphHostNodeGetParams(nullptr, &GethostParams)
|
||||
== hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("Passing nullptr to hostParams") {
|
||||
REQUIRE(hipGraphHostNodeGetParams(hostNode, nullptr)
|
||||
== hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("Passing unintialized graphNode") {
|
||||
hipGraphNode_t unint_graphnode{nullptr};
|
||||
REQUIRE(hipGraphHostNodeGetParams(unint_graphnode, &GethostParams)
|
||||
== hipErrorInvalidValue);
|
||||
}
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
}
|
||||
/*
|
||||
This testcase verifies hipGraphHostNodeGetParams API in cloned graph
|
||||
Creates graph, Add graph nodes and clone the graph
|
||||
Add HostNode to the cloned graph, update hostNode using hipGraphHostNodeSetParams,
|
||||
then get the host node params using hipGraphHostNodeGetParams API and
|
||||
compare it.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphHostNodeGetParams_ClonedGraphwithHostNode") {
|
||||
constexpr size_t N = 1024;
|
||||
constexpr size_t Nbytes = N * sizeof(int);
|
||||
hipGraph_t graph;
|
||||
hipGraphExec_t graphExec;
|
||||
int *A_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *C_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, nullptr, &C_d,
|
||||
&A_h, nullptr, &C_h, N, false);
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
hipGraphNode_t memcpyH2D_A, memcpyH2D_C,
|
||||
memcpyD2H_AC;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr,
|
||||
0, C_d, C_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_AC, graph, nullptr,
|
||||
0, A_h, C_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A,
|
||||
&memcpyD2H_AC, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_C,
|
||||
&memcpyD2H_AC, 1));
|
||||
|
||||
hipGraph_t clonedgraph;
|
||||
HIP_CHECK(hipGraphClone(&clonedgraph, graph));
|
||||
|
||||
hipGraphNode_t hostNode;
|
||||
hipHostNodeParams hostParams = {0, 0};
|
||||
hostParams.fn = callbackfunc;
|
||||
hostParams.userData = A_h;
|
||||
HIP_CHECK(hipGraphAddHostNode(&hostNode, clonedgraph,
|
||||
nullptr,
|
||||
0, &hostParams));
|
||||
hipHostNodeParams sethostParams = {0, 0};
|
||||
sethostParams.fn = callbackfunc_setparams;
|
||||
sethostParams.userData = C_h;
|
||||
HIP_CHECK(hipGraphHostNodeSetParams(hostNode, &sethostParams));
|
||||
hipHostNodeParams gethostParams;
|
||||
HIP_CHECK(hipGraphHostNodeGetParams(hostNode, &gethostParams));
|
||||
REQUIRE(memcmp(&sethostParams, &gethostParams, sizeof(hipHostNodeParams))
|
||||
== 0);
|
||||
// Instantiate and launch the cloned graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedgraph, nullptr, nullptr, 0));
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
|
||||
// Verify execution result
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (C_h[i] != static_cast<int>(i * i)) {
|
||||
INFO("Validation failed i " << i << "C_h[i] "<< C_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
HIP_CHECK(hipGraphDestroy(clonedgraph));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HipTest::freeArrays<int>(A_d, nullptr, C_d, A_h, nullptr, C_h, false);
|
||||
}
|
||||
|
||||
/*
|
||||
This testcase verifies the following scenarios
|
||||
Create graph, Adds host node to the graph, updates it
|
||||
with hipGraphHostNodeSetParams and gets the host node
|
||||
params using hipGraphHostNodeGetParams API and validates
|
||||
it
|
||||
*/
|
||||
void hipGraphHostNodeGetParams_func(bool setparams) {
|
||||
constexpr size_t N = 1024;
|
||||
constexpr size_t Nbytes = N * sizeof(int);
|
||||
hipGraph_t graph;
|
||||
hipGraphExec_t graphExec;
|
||||
int *A_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *C_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, nullptr, &C_d,
|
||||
&A_h, nullptr, &C_h, N, false);
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
hipGraphNode_t memcpyH2D_A, memcpyD2H_AC, memcpyH2D_C;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr,
|
||||
0, C_d, C_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_AC, graph, nullptr,
|
||||
0, A_h, C_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
hipGraphNode_t hostNode;
|
||||
hipHostNodeParams hostParams = {0, 0};
|
||||
hostParams.fn = callbackfunc;
|
||||
hostParams.userData = A_h;
|
||||
HIP_CHECK(hipGraphAddHostNode(&hostNode, graph,
|
||||
nullptr,
|
||||
0, &hostParams));
|
||||
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_A,
|
||||
&memcpyD2H_AC, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_C,
|
||||
&memcpyD2H_AC, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyD2H_AC,
|
||||
&hostNode, 1));
|
||||
|
||||
if (setparams) {
|
||||
hipHostNodeParams sethostParams = {0, 0};
|
||||
sethostParams.fn = callbackfunc_setparams;
|
||||
sethostParams.userData = C_h;
|
||||
HIP_CHECK(hipGraphHostNodeSetParams(hostNode, &sethostParams));
|
||||
|
||||
hipHostNodeParams gethostParams;
|
||||
HIP_CHECK(hipGraphHostNodeGetParams(hostNode, &gethostParams));
|
||||
REQUIRE(memcmp(&sethostParams, &gethostParams, sizeof(hipHostNodeParams))
|
||||
== 0);
|
||||
} else {
|
||||
hipHostNodeParams gethostParams;
|
||||
HIP_CHECK(hipGraphHostNodeGetParams(hostNode, &gethostParams));
|
||||
REQUIRE(memcmp(&hostParams, &gethostParams, sizeof(hipHostNodeParams))
|
||||
== 0);
|
||||
}
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
|
||||
// Verify execution result
|
||||
|
||||
if (setparams) {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (C_h[i] != static_cast<int>(i * i)) {
|
||||
INFO("Validation failed i " << i << "C_h[i] "<< C_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (A_h[i] != static_cast<int>(i)) {
|
||||
INFO("Validation failed i " << i << "C_h[i] "<< C_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HipTest::freeArrays<int>(A_d, nullptr, C_d, A_h, nullptr, C_h, false);
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
}
|
||||
/*
|
||||
This testcase verifies hipGraphHostNodeGetParams API by
|
||||
adding host node to graph and gets the host params and
|
||||
validates it
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphHostNodeGetParams_BasicFunc") {
|
||||
hipGraphHostNodeGetParams_func(false);
|
||||
}
|
||||
|
||||
/*
|
||||
This testcase verifies hipGraphHostNodeGetParams API by
|
||||
adding host node to graph, updates host node params
|
||||
using hipGraphHostNodeSetParams and gets the host params
|
||||
validates it
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphHostNodeGetParams_SetParams") {
|
||||
hipGraphHostNodeGetParams_func(true);
|
||||
}
|
||||
@@ -1,3 +1,41 @@
|
||||
/*
|
||||
Copyright (c) 2022 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 WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS 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 INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
Testcase Scenarios of hipGraphMemcpyNodeSetParamsToSymbol API:
|
||||
Functional :
|
||||
1) Allocate global symbol memory, add the node to the graph.
|
||||
Set/Update the new values to the node. Make sure they are taking effect.
|
||||
2) Allocate const symbol memory, add the node to the graph.
|
||||
Set/Update the new values to the node. Make sure they are taking effect.
|
||||
Negative :
|
||||
1) Pass GraphNode as nullptr and check if api returns error.
|
||||
2) Pass symbol ptr as nullptr, api expected to return error code.
|
||||
3) Pass src ptr as nullptr, api expected to return error code.
|
||||
4) Pass count as zero, api expected to return error code.
|
||||
5) Pass count more than allocated size for source and destination ptr, api should return error code.
|
||||
6) Pass offset+count greater than allocated size, api expected to return error code.
|
||||
7) Pass same pointer as source ptr and symbol ptr, api expected to return error code.
|
||||
8) Pass both destination ptr and source ptr as 2 different symbol ptr, api expected to return error code.
|
||||
9) Copy from host ptr to device ptr but pass kind as different, api expected to return error code.
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
#include <limits>
|
||||
@@ -6,6 +44,17 @@
|
||||
__device__ int globalIn[SIZE], globalOut[SIZE];
|
||||
__device__ __constant__ int globalConst[SIZE];
|
||||
|
||||
__global__ void CpyToSymbolKernel(int* B_d) {
|
||||
for (int i = 0 ; i < SIZE; i++) {
|
||||
B_d[i] = globalIn[i];
|
||||
}
|
||||
}
|
||||
|
||||
__global__ void CpyToConstSymbolKernel(int* B_d) {
|
||||
for (int i = 0 ; i < SIZE; i++) {
|
||||
B_d[i] = globalConst[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* This testcase verifies negative scenarios of
|
||||
hipGraphMemcpyNodeSetParamsToSymbol API */
|
||||
@@ -33,7 +82,6 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Negative") {
|
||||
HIP_SYMBOL(globalIn),
|
||||
A_d, Nbytes, 0,
|
||||
hipMemcpyDeviceToDevice));
|
||||
|
||||
SECTION("Pass GraphNode as nullptr") {
|
||||
ret = hipGraphMemcpyNodeSetParamsToSymbol(nullptr,
|
||||
HIP_SYMBOL(globalIn),
|
||||
@@ -62,7 +110,6 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Negative") {
|
||||
hipMemcpyDeviceToDevice);
|
||||
REQUIRE(hipErrorInvalidValue == ret);
|
||||
}
|
||||
|
||||
SECTION("Pass count more than allocated size for source and dstn ptr") {
|
||||
ret = hipGraphMemcpyNodeSetParamsToSymbol(memcpyToSymbolNode,
|
||||
HIP_SYMBOL(globalIn),
|
||||
@@ -104,4 +151,114 @@ TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Negative") {
|
||||
|
||||
HipTest::freeArrays<int>(A_d, B_d, nullptr, A_h, B_h, nullptr, false);
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void hipGraphMemcpyNodeSetParamsToSymbol_GlobalMem(bool useConstDeviceVar) {
|
||||
constexpr size_t Nbytes = SIZE * sizeof(int);
|
||||
constexpr auto blocksPerCU = 6; // to hide latency
|
||||
constexpr auto threadsPerBlock = 256;
|
||||
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, SIZE);
|
||||
hipGraphNode_t memcpytosymbolkernel, memcpyD2H_B;
|
||||
hipKernelNodeParams kernelNodeParams{};
|
||||
int *A_d{nullptr}, *B_d{nullptr}, *C_d{nullptr};
|
||||
int *A_h{nullptr}, *B_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, &B_d, &C_d,
|
||||
&A_h, &B_h, nullptr, SIZE, false);
|
||||
|
||||
hipGraph_t graph;
|
||||
hipGraphExec_t graphExec;
|
||||
hipGraphNode_t memcpyToSymbolNode, memcpyH2D_A;
|
||||
std::vector<hipGraphNode_t> dependencies;
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
|
||||
// Adding MemcpyNode
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, 0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
dependencies.push_back(memcpyH2D_A);
|
||||
|
||||
if (useConstDeviceVar) {
|
||||
HIP_CHECK(hipGraphAddMemcpyNodeToSymbol(&memcpyToSymbolNode, graph,
|
||||
dependencies.data(),
|
||||
dependencies.size(),
|
||||
HIP_SYMBOL(globalConst),
|
||||
C_d, Nbytes, 0,
|
||||
hipMemcpyDeviceToDevice));
|
||||
} else {
|
||||
HIP_CHECK(hipGraphAddMemcpyNodeToSymbol(&memcpyToSymbolNode, graph,
|
||||
dependencies.data(),
|
||||
dependencies.size(),
|
||||
HIP_SYMBOL(globalIn),
|
||||
C_d, Nbytes, 0,
|
||||
hipMemcpyDeviceToDevice));
|
||||
}
|
||||
dependencies.clear();
|
||||
dependencies.push_back(memcpyToSymbolNode);
|
||||
|
||||
// Update the node with source pointer from C_d to A_d
|
||||
if (useConstDeviceVar) {
|
||||
HIP_CHECK(hipGraphMemcpyNodeSetParamsToSymbol(memcpyToSymbolNode,
|
||||
HIP_SYMBOL(globalConst), A_d,
|
||||
Nbytes, 0,
|
||||
hipMemcpyDeviceToDevice));
|
||||
} else {
|
||||
HIP_CHECK(hipGraphMemcpyNodeSetParamsToSymbol(memcpyToSymbolNode,
|
||||
HIP_SYMBOL(globalIn), A_d,
|
||||
Nbytes, 0,
|
||||
hipMemcpyDeviceToDevice));
|
||||
}
|
||||
|
||||
// Adding Kernel node
|
||||
void* kernelArgs1[] = {&B_d};
|
||||
if (useConstDeviceVar)
|
||||
kernelNodeParams.func = reinterpret_cast<void *>(CpyToConstSymbolKernel);
|
||||
else
|
||||
kernelNodeParams.func = reinterpret_cast<void *>(CpyToSymbolKernel);
|
||||
kernelNodeParams.gridDim = dim3(blocks);
|
||||
kernelNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kernelNodeParams.sharedMemBytes = 0;
|
||||
kernelNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs1);
|
||||
kernelNodeParams.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&memcpytosymbolkernel, graph,
|
||||
dependencies.data(), dependencies.size(),
|
||||
&kernelNodeParams));
|
||||
dependencies.clear();
|
||||
dependencies.push_back(memcpytosymbolkernel);
|
||||
|
||||
// Adding MemcpyNode
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_B, graph, dependencies.data(),
|
||||
dependencies.size(), B_h, B_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, 0));
|
||||
|
||||
// Validating the result
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
if (B_h[i] != A_h[i]) {
|
||||
WARN("Validation failed B_h[i] " << B_h[i] << "A_h[i] " << A_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
|
||||
HipTest::freeArrays<int>(A_d, B_d, C_d,
|
||||
A_h, B_h, nullptr, false);
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
}
|
||||
|
||||
/* Test verifies hipGraphMemcpyNodeSetParamsToSymbol API Functional scenario.
|
||||
1) Allocate global symbol memory, add node to the graph.
|
||||
Set/Update the new values to the node. Make sure they are taking effect.
|
||||
2) Allocate const symbol memory, add node to the graph.
|
||||
Set/Update the new values to the node. Make sure they are taking effect.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphMemcpyNodeSetParamsToSymbol_Functional") {
|
||||
SECTION("Check and update with Global Device Symbol Memory") {
|
||||
hipGraphMemcpyNodeSetParamsToSymbol_GlobalMem(false);
|
||||
}
|
||||
SECTION("Check and update with Constant Global Device Symbol Memory") {
|
||||
hipGraphMemcpyNodeSetParamsToSymbol_GlobalMem(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,11 +214,6 @@ TEST_CASE("Unit_hipArray3DCreate_Negative_NullArrayPtr") {
|
||||
|
||||
// Providing the description pointer as nullptr should return an error
|
||||
TEST_CASE("Unit_hipArray3DCreate_Negative_NullDescPtr") {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("EXSWCPHIPT-130");
|
||||
return;
|
||||
#endif
|
||||
|
||||
DriverContext ctx;
|
||||
hiparray array;
|
||||
HIP_CHECK_ERROR(hipArray3DCreate(&array, nullptr), hipErrorInvalidValue);
|
||||
|
||||
@@ -212,13 +212,6 @@ void testArrayAsTexture(hiparray array, const size_t width, const size_t height)
|
||||
// Test the happy path of the hipArrayCreate
|
||||
TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, short2, char, uchar2,
|
||||
char4, float, float2, float4) {
|
||||
#if HT_AMD
|
||||
if (std::is_same<uint, TestType>::value || std::is_same<ushort, TestType>::value ||
|
||||
std::is_same<uchar2, TestType>::value) {
|
||||
HipTest::HIP_SKIP_TEST("Probably EXSWCPHIPT-62");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
using vec_info = vector_info<TestType>;
|
||||
DriverContext ctx;
|
||||
|
||||
@@ -228,8 +221,6 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, sho
|
||||
desc.Width = 1024;
|
||||
desc.Height = GENERATE(0, 1024);
|
||||
|
||||
size_t initFree = getFreeMem();
|
||||
|
||||
// pointer to the array in device memory
|
||||
hiparray array{};
|
||||
|
||||
@@ -237,12 +228,6 @@ TEMPLATE_TEST_CASE("Unit_hipArrayCreate_happy", "", uint, int, int4, ushort, sho
|
||||
|
||||
testArrayAsTexture<TestType>(array, desc.Width, desc.Height);
|
||||
|
||||
size_t finalFree = getFreeMem();
|
||||
|
||||
const size_t allocSize = sizeof(TestType) * desc.Width * (desc.Height ? desc.Height : 1);
|
||||
// will be aligned to some size, so this is not exact
|
||||
REQUIRE(initFree - finalFree >= allocSize);
|
||||
|
||||
HIP_CHECK(hipArrayDestroy(array));
|
||||
}
|
||||
|
||||
@@ -322,10 +307,6 @@ TEST_CASE("Unit_hipArrayCreate_ZeroWidth") {
|
||||
|
||||
// HipArrayCreate will return an error when nullptr is used as the array argument
|
||||
TEST_CASE("Unit_hipArrayCreate_Nullptr") {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("EXSWCPHIPT-130");
|
||||
return;
|
||||
#endif
|
||||
DriverContext ctx;
|
||||
SECTION("Null array") {
|
||||
HIP_ARRAY_DESCRIPTOR desc;
|
||||
|
||||
@@ -101,7 +101,8 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_ReferenceFromKernelandhipMemset", "", i
|
||||
// Reference the registered device pointer Ad from inside the kernel:
|
||||
for (int i = 0; i < num_devices; i++) {
|
||||
HIP_CHECK(hipSetDevice(i));
|
||||
hipLaunchKernelGGL(Inc, dim3(LEN / 512), dim3(512), 0, 0, Ad[i]);
|
||||
hipLaunchKernelGGL(Inc, dim3(LEN / 32), dim3(32), 0, 0, Ad[i]);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
}
|
||||
REQUIRE(A[10] == 1 + static_cast<TestType>(num_devices));
|
||||
@@ -162,11 +163,6 @@ template <typename T> __global__ void fill_kernel(T* dataPtr, T value) {
|
||||
}
|
||||
|
||||
TEMPLATE_TEST_CASE("Unit_hipHostRegister_Flags", "", int, float, double) {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("EXSWCPHIPT-138");
|
||||
return;
|
||||
#else
|
||||
|
||||
size_t sizeBytes = 1 * sizeof(TestType);
|
||||
TestType* hostPtr = reinterpret_cast<TestType*>(malloc(sizeBytes));
|
||||
|
||||
@@ -193,7 +189,6 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_Flags", "", int, float, double) {
|
||||
}
|
||||
|
||||
free(hostPtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEMPLATE_TEST_CASE("Unit_hipHostRegister_Negative", "", int, float, double) {
|
||||
@@ -216,7 +211,7 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_Negative", "", int, float, double) {
|
||||
REQUIRE(devMemAvail > 0);
|
||||
REQUIRE(hostMemFree > 0);
|
||||
|
||||
size_t memFree = (std::min)(devMemFree, hostMemFree); // which is the limiter cpu or gpu
|
||||
size_t memFree = (std::max)(devMemFree, hostMemFree); // which is the limiter cpu or gpu
|
||||
|
||||
SECTION("hipHostRegister Negative Test - invalid memory size") {
|
||||
HIP_CHECK_ERROR(hipHostRegister(hostPtr, memFree, 0), hipErrorInvalidValue);
|
||||
|
||||
@@ -69,19 +69,11 @@ TEST_CASE("Unit_hipHostUnregister_NullPtr") {
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipHostUnregister_NotRegisteredPointer") {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("TODO-MATCH-ERRORCODE");
|
||||
return;
|
||||
#endif
|
||||
auto x = std::unique_ptr<int>(new int);
|
||||
HIP_CHECK_ERROR(hipHostUnregister(x.get()), hipErrorHostMemoryNotRegistered);
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipHostUnregister_AlreadyUnregisteredPointer") {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("TODO-MATCH-ERRORCODE");
|
||||
return;
|
||||
#endif
|
||||
if (!hipHostRegisterSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,11 +163,6 @@ TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_happy", "", char, uchar2, uint2, int4,
|
||||
|
||||
TEMPLATE_TEST_CASE("Unit_hipMalloc3DArray_MaxTexture", "", int, uint4, short, ushort2,
|
||||
unsigned char, float, float4) {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("EXSWCPHIPT-97");
|
||||
return;
|
||||
#endif
|
||||
|
||||
hipArray_t array;
|
||||
const hipChannelFormatDesc desc = hipCreateChannelDesc<TestType>();
|
||||
#if HT_AMD
|
||||
|
||||
@@ -385,15 +385,9 @@ void testArrayAsSurface(hipArray_t arrayPtr, const size_t width, const size_t he
|
||||
// Selection of types chosen to reduce compile times
|
||||
TEMPLATE_TEST_CASE("Unit_hipMallocArray_happy", "", uint, int, int4, ushort, short2, char, uchar2,
|
||||
char4, float, float2, float4) {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("EXSWCPHIPT-62");
|
||||
return;
|
||||
#endif
|
||||
|
||||
hipChannelFormatDesc desc = hipCreateChannelDesc<TestType>();
|
||||
|
||||
size_t init_free = getFreeMem();
|
||||
|
||||
// pointer to the array in device memory
|
||||
hipArray_t arrayPtr{};
|
||||
size_t width = 1024;
|
||||
@@ -426,12 +420,6 @@ TEMPLATE_TEST_CASE("Unit_hipMallocArray_happy", "", uint, int, int4, ushort, sho
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t final_free = getFreeMem();
|
||||
|
||||
const size_t alloc_size = getAllocSize<TestType>(width, height);
|
||||
// alloc will be chunked, so this is not exact
|
||||
REQUIRE(init_free - final_free >= alloc_size);
|
||||
|
||||
HIP_CHECK(hipFreeArray(arrayPtr));
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ static bool validateMemoryOnGPU(int gpu, bool concurOnOneGPU = false) {
|
||||
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0,
|
||||
static_cast<const int*>(A_d), static_cast<const int*>(B_d), C_d, N);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
if (!HipTest::checkVectorADD(A_h, B_h, C_h, N)) {
|
||||
@@ -219,7 +219,7 @@ static bool validateMemoryOnGpuMThread(int gpu, bool concurOnOneGPU = false) {
|
||||
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0,
|
||||
static_cast<const int*>(A_d), static_cast<const int*>(B_d), C_d, N);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIPCHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
if (!HipTest::checkVectorADD(A_h, B_h, C_h, N)) {
|
||||
|
||||
@@ -114,6 +114,7 @@ TEST_CASE("Unit_hipMallocManaged_Advanced") {
|
||||
HIP_CHECK(hipEventRecord(event0, 0));
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock), 0, 0,
|
||||
static_cast<const float*>(A), static_cast<const float*>(B), C, numElements);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipEventRecord(event1, 0));
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
float time = 0.0f;
|
||||
|
||||
@@ -29,36 +29,21 @@ THE SOFTWARE.
|
||||
#include <limits>
|
||||
#include <hip_test_checkers.hh>
|
||||
#include <hip_test_kernels.hh>
|
||||
#ifdef __HIP_PLATFORM_NVIDIA__
|
||||
#include "DriverContext.hh"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Test hipMalloc3D, hipMallocPitch and hipMemAllocPitch with multiple input values.
|
||||
* Checks that the memory has been allocated with the specified pitch and extent sizes.
|
||||
*/
|
||||
|
||||
struct MemoryInfo {
|
||||
size_t freeMem;
|
||||
size_t totalMem;
|
||||
};
|
||||
|
||||
inline static MemoryInfo createMemoryInfo() {
|
||||
MemoryInfo memoryInfo{};
|
||||
HIP_CHECK(hipMemGetInfo(&memoryInfo.freeMem, &memoryInfo.totalMem));
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
static void validateMemory(void* devPtr, hipExtent extent, size_t pitch,
|
||||
MemoryInfo memBeforeAllocation) {
|
||||
static void validateMemory(void* devPtr, hipExtent extent, size_t pitch) {
|
||||
INFO("Width: " << extent.width << " Height: " << extent.height << " Depth: " << extent.depth);
|
||||
|
||||
MemoryInfo memAfterAllocation{createMemoryInfo()};
|
||||
const size_t theoreticalAllocatedMemory{pitch * extent.height * extent.depth};
|
||||
const size_t allocatedMemory = memBeforeAllocation.freeMem - memAfterAllocation.freeMem;
|
||||
|
||||
if (theoreticalAllocatedMemory == 0) {
|
||||
REQUIRE(theoreticalAllocatedMemory == allocatedMemory);
|
||||
return; /* If there was no memory allocated then we don't need to do further checks. */
|
||||
} else {
|
||||
REQUIRE(theoreticalAllocatedMemory <= allocatedMemory);
|
||||
}
|
||||
|
||||
std::unique_ptr<char[]> hostPtr{new char[theoreticalAllocatedMemory]};
|
||||
@@ -149,40 +134,36 @@ TEST_CASE("Unit_hipMalloc3D_ValidatePitch") {
|
||||
hipPitchedPtr hipPitchedPtr;
|
||||
hipExtent validExtent{generateExtent(AllocationApi::hipMalloc3D)};
|
||||
|
||||
MemoryInfo memBeforeAllocation{createMemoryInfo()};
|
||||
HIP_CHECK(hipMalloc3D(&hipPitchedPtr, validExtent));
|
||||
validateMemory(hipPitchedPtr.ptr, validExtent, hipPitchedPtr.pitch, memBeforeAllocation);
|
||||
validateMemory(hipPitchedPtr.ptr, validExtent, hipPitchedPtr.pitch);
|
||||
HIP_CHECK(hipFree(hipPitchedPtr.ptr));
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipMemAllocPitch_ValidatePitch") {
|
||||
size_t pitch;
|
||||
size_t pitch = 0;
|
||||
hipDeviceptr_t ptr;
|
||||
hipExtent validExtent{generateExtent(AllocationApi::hipMemAllocPitch)};
|
||||
MemoryInfo memBeforeAllocation{createMemoryInfo()};
|
||||
unsigned int elementSizeBytes = GENERATE(4, 8, 16);
|
||||
|
||||
if (validExtent.width == 0 || validExtent.height == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//hipMemAllocPitch is driver API hence explicit init is required on NVidia plaform.
|
||||
#ifdef __HIP_PLATFORM_NVIDIA__
|
||||
DriverContext ctx;
|
||||
#endif
|
||||
HIP_CHECK(
|
||||
hipMemAllocPitch(&ptr, &pitch, validExtent.width, validExtent.height, elementSizeBytes));
|
||||
validateMemory(reinterpret_cast<void*>(ptr), validExtent, pitch, memBeforeAllocation);
|
||||
validateMemory(reinterpret_cast<void*>(ptr), validExtent, pitch);
|
||||
HIP_CHECK(hipFree(reinterpret_cast<void*>(ptr)));
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipMallocPitch_ValidatePitch") {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST("TODO-FIX-EXTENT-GENERATOR");
|
||||
return;
|
||||
#endif
|
||||
size_t pitch;
|
||||
size_t pitch = 0;
|
||||
void* ptr;
|
||||
hipExtent validExtent{generateExtent(AllocationApi::hipMemAllocPitch)};
|
||||
MemoryInfo memBeforeAllocation{createMemoryInfo()};
|
||||
HIP_CHECK(hipMallocPitch(&ptr, &pitch, validExtent.width, validExtent.height));
|
||||
validateMemory(ptr, validExtent, pitch, memBeforeAllocation);
|
||||
validateMemory(ptr, validExtent, pitch);
|
||||
HIP_CHECK(hipFree(ptr));
|
||||
}
|
||||
|
||||
@@ -223,7 +204,7 @@ TEST_CASE("Unit_hipMalloc3D_Negative") {
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipMallocPitch_Negative") {
|
||||
size_t pitch;
|
||||
size_t pitch = 0;
|
||||
void* ptr;
|
||||
constexpr size_t maxSizeT = std::numeric_limits<size_t>::max();
|
||||
|
||||
@@ -248,7 +229,7 @@ TEST_CASE("Unit_hipMallocPitch_Negative") {
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipMemAllocPitch_Negative") {
|
||||
size_t pitch;
|
||||
size_t pitch = 0;
|
||||
hipDeviceptr_t ptr{};
|
||||
unsigned int validElementSizeBytes{4};
|
||||
constexpr size_t maxSizeT = std::numeric_limits<size_t>::max();
|
||||
@@ -358,7 +339,7 @@ static void MemoryAllocDiffSizes(int gpu) {
|
||||
array_size.push_back(LARGECHUNK_NUMH);
|
||||
for (auto &sizes : array_size) {
|
||||
T* A_d[CHUNK_LOOP];
|
||||
size_t pitch_A;
|
||||
size_t pitch_A = 0;
|
||||
size_t width;
|
||||
if (sizes == SMALLCHUNK_NUMH) {
|
||||
width = SMALLCHUNK_NUMW * sizeof(T);
|
||||
@@ -391,7 +372,7 @@ static void threadFunc(int gpu) {
|
||||
#if 0 //TODO: Review, fix and re-enable test
|
||||
TEST_CASE("Unit_hipMallocPitch_Negative") {
|
||||
float* A_d;
|
||||
size_t pitch_A;
|
||||
size_t pitch_A = 0;
|
||||
size_t width{NUM_W * sizeof(float)};
|
||||
#if HT_NVIDIA
|
||||
SECTION("NullPtr to Pitched Ptr") {
|
||||
@@ -429,7 +410,7 @@ TEST_CASE("Unit_hipMallocPitch_Negative") {
|
||||
TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Basic",
|
||||
"[hipMallocPitch]", int, unsigned int, float) {
|
||||
TestType* A_d;
|
||||
size_t pitch_A;
|
||||
size_t pitch_A = 0;
|
||||
size_t width{NUM_W * sizeof(TestType)};
|
||||
REQUIRE(hipMallocPitch(reinterpret_cast<void**>(&A_d),
|
||||
&pitch_A, width, NUM_H) == hipSuccess);
|
||||
@@ -454,7 +435,7 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_Memcpy2D", ""
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
TestType *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, *A_d{nullptr},
|
||||
*B_d{nullptr};
|
||||
size_t pitch_A, pitch_B;
|
||||
size_t pitch_A = 0, pitch_B = 0;
|
||||
size_t width{NUM_W * sizeof(TestType)};
|
||||
|
||||
// Allocating memory
|
||||
@@ -536,7 +517,7 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_KernelLaunch", ""
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
TestType *A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, *A_d{nullptr},
|
||||
*B_d{nullptr};
|
||||
size_t pitch_A, pitch_B;
|
||||
size_t pitch_A = 0, pitch_B = 0;
|
||||
size_t width{NUM_W * sizeof(TestType)};
|
||||
|
||||
// Allocating memory
|
||||
@@ -555,6 +536,7 @@ TEMPLATE_TEST_CASE("Unit_hipMallocPitch_KernelLaunch", ""
|
||||
hipLaunchKernelGGL(copy_var<TestType>, dim3(1), dim3(1),
|
||||
0, 0, static_cast<TestType*>(A_d),
|
||||
static_cast<TestType*>(B_d), ROWS, pitch_A);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
|
||||
// hipMemcpy2D Device to Host
|
||||
|
||||
@@ -535,10 +535,6 @@ TEST_CASE("Unit_hipMemGetInfo_ParaMultiSmall") {
|
||||
|
||||
|
||||
TEST_CASE("Unit_hipMemGetInfo_Negative") {
|
||||
#if HT_AMD
|
||||
HipTest::HIP_SKIP_TEST(" EXSWCPHIPT-61");
|
||||
return;
|
||||
#endif
|
||||
size_t freeMemInit;
|
||||
size_t totalMemInit;
|
||||
HIP_CHECK(hipMemGetInfo(&freeMemInit, &totalMemInit));
|
||||
|
||||
@@ -162,7 +162,7 @@ TEST_CASE("Unit_hipMemPoolApi_BasicAlloc") {
|
||||
std::uint64_t res_after_sync = 0;
|
||||
HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &res_after_sync));
|
||||
// Sync must releaae memory to OS
|
||||
REQUIRE(res_after_sync < res_before_sync);
|
||||
REQUIRE(res_after_sync <= res_before_sync);
|
||||
|
||||
int value = 0;
|
||||
attr = hipMemPoolReuseFollowEventDependencies;
|
||||
@@ -189,7 +189,7 @@ TEST_CASE("Unit_hipMemPoolApi_BasicAlloc") {
|
||||
attr = hipMemPoolAttrReservedMemHigh;
|
||||
HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value64));
|
||||
// Must be bigger than current
|
||||
REQUIRE(value64 > res_after_sync);
|
||||
REQUIRE(value64 >= res_after_sync);
|
||||
|
||||
attr = hipMemPoolAttrUsedMemCurrent;
|
||||
HIP_CHECK(hipMemPoolGetAttribute(mem_pool, attr, &value64));
|
||||
|
||||
@@ -241,6 +241,7 @@ void memcpytest2(DeviceMemory<T>* dmem, HostMemory<T>* hmem,
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0,
|
||||
static_cast<const T*>(dmem->A_d()), static_cast<const T*>(dmem->B_d()),
|
||||
dmem->C_d(), numElements);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
if (useDeviceToDevice) {
|
||||
// Do an extra device-to-device copy here to mix things up:
|
||||
@@ -402,7 +403,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_KernelLaunch", "", int, float,
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0,
|
||||
static_cast<const TestType*>(A_d),
|
||||
static_cast<const TestType*>(B_d), C_d, NUM_ELM);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
@@ -567,7 +568,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_PinnedRegMemWithKernelLaunch",
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, 0, static_cast<const TestType*>(A_d),
|
||||
static_cast<const TestType*>(B_d), C_d, NUM_ELM);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
||||
|
||||
@@ -595,7 +596,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_PinnedRegMemWithKernelLaunch",
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, 0, static_cast<const TestType*>(X_d),
|
||||
static_cast<const TestType*>(Y_d), Z_d, NUM_ELM);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, Z_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
||||
|
||||
@@ -319,6 +319,7 @@ TEST_CASE("Unit_hipMemcpy_HalfMemCopy") {
|
||||
HIP_CHECK(hipMemcpyAsync(B_h, A_d,
|
||||
(NUM_ELM/2)*sizeof(float),
|
||||
hipMemcpyDeviceToHost, stream));
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HipTest::checkTest(A_h, B_h, NUM_ELM/2);
|
||||
}
|
||||
HipTest::freeArrays<float>(A_d, B_d, C_d, A_h, B_h, C_h, false);
|
||||
|
||||
@@ -50,6 +50,7 @@ void Thread_func(T *A_d, T *B_d, T* C_d, T* C_h, size_t Nbytes,
|
||||
hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks),
|
||||
dim3(threadsPerBlock), 0,
|
||||
mystream, A_d, C_d, N_ELMTS);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream));
|
||||
// The following two MemcpyAsync calls are for sole
|
||||
// purpose of loading stream with multiple async calls
|
||||
@@ -76,6 +77,7 @@ void Thread_func_MultiStream() {
|
||||
hipLaunchKernelGGL((HipTest::vector_square), dim3(blocks),
|
||||
dim3(threadsPerBlock), 0,
|
||||
mystream, A_d, C_d, N_ELMTS);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, mystream));
|
||||
// The following hipMemcpyAsync() is called only to
|
||||
// load stream with multiple Async calls
|
||||
@@ -121,7 +123,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_KernelLaunch", "", int, float,
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1), 0, 0,
|
||||
static_cast<const TestType*>(A_d),
|
||||
static_cast<const TestType*>(B_d), C_d, NUM_ELM);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost, stream));
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
HIP_CHECK(hipStreamDestroy(stream));
|
||||
@@ -348,7 +350,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_PinnedRegMemWithKernelLaunch",
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, 0, static_cast<const TestType*>(A_d),
|
||||
static_cast<const TestType*>(B_d), C_d, NUM_ELM);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
||||
|
||||
@@ -379,7 +381,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_PinnedRegMemWithKernelLaunch",
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, 0, static_cast<const TestType*>(X_d),
|
||||
static_cast<const TestType*>(Y_d), Z_d, NUM_ELM);
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpyAsync(C_h, Z_d, Nbytes,
|
||||
hipMemcpyDeviceToHost, gpu1Stream));
|
||||
HIP_CHECK(hipStreamSynchronize(gpu1Stream));
|
||||
|
||||
@@ -66,6 +66,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoD_Basic", "",
|
||||
dim3(1), 0, 0,
|
||||
static_cast<const TestType *>(A_d),
|
||||
static_cast<const TestType *>(B_d), C_d, NUM_ELM);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HipTest::checkVectorADD<TestType>(A_h, B_h, C_h, NUM_ELM);
|
||||
@@ -80,6 +81,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoD_Basic", "",
|
||||
dim3(1), 0, 0,
|
||||
static_cast<const TestType*>(X_d),
|
||||
static_cast<const TestType*>(Y_d), Z_d, NUM_ELM);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpyDtoH(C_h, (hipDeviceptr_t)Z_d, Nbytes));
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HipTest::checkVectorADD<TestType>(A_h, B_h, C_h, NUM_ELM);
|
||||
|
||||
@@ -68,6 +68,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoDAsync_Basic", "",
|
||||
dim3(1), 0, 0,
|
||||
static_cast<const TestType *>(A_d),
|
||||
static_cast<const TestType *>(B_d), C_d, NUM_ELM);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
HipTest::checkVectorADD<TestType>(A_h, B_h, C_h, NUM_ELM);
|
||||
@@ -84,6 +85,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyDtoDAsync_Basic", "",
|
||||
dim3(1), 0, 0,
|
||||
static_cast<const TestType*>(X_d),
|
||||
static_cast<const TestType*>(Y_d), Z_d, NUM_ELM);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpyDtoHAsync(C_h, (hipDeviceptr_t)Z_d, Nbytes, stream));
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
|
||||
@@ -127,6 +127,7 @@ TEST_CASE("Unit_hipMemcpyPeer_Basic") {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1),
|
||||
0, 0, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, numElements*sizeof(int));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, numElements*sizeof(int),
|
||||
hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD<int>(A_h, B_h, C_h, numElements);
|
||||
@@ -138,6 +139,7 @@ TEST_CASE("Unit_hipMemcpyPeer_Basic") {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1),
|
||||
0, 0, static_cast<const int*>(X_d),
|
||||
static_cast<const int*>(Y_d), Z_d, numElements*sizeof(int));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, Z_d, numElements*sizeof(int),
|
||||
hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD<int>(A_h, B_h, C_h, numElements);
|
||||
|
||||
@@ -143,6 +143,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Basic") {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1),
|
||||
0, 0, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, numElements*sizeof(int));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, numElements*sizeof(int),
|
||||
hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD<int>(A_h, B_h, C_h, numElements);
|
||||
@@ -166,6 +167,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Basic") {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1),
|
||||
0, 0, static_cast<const int*>(X_d),
|
||||
static_cast<const int*>(Y_d), Z_d, numElements*sizeof(int));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, Z_d, numElements*sizeof(int),
|
||||
hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD<int>(A_h, B_h, C_h, numElements);
|
||||
@@ -227,6 +229,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_StreamOnDiffDevice") {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1),
|
||||
0, 0, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, numElements*sizeof(int));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, numElements*sizeof(int),
|
||||
hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD<int>(A_h, B_h, C_h, numElements);
|
||||
@@ -240,6 +243,7 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_StreamOnDiffDevice") {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(1), dim3(1),
|
||||
0, 0, static_cast<const int*>(X_d),
|
||||
static_cast<const int*>(Y_d), Z_d, numElements*sizeof(int));
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(C_h, Z_d, numElements*sizeof(int),
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ void TestwithOnestream(void) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
HIP_CHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, N);
|
||||
@@ -136,6 +137,7 @@ void TestwithTwoStream(void) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NUM_STREAMS; ++i) {
|
||||
@@ -191,6 +193,7 @@ void TestDtoDonSameDevice(void) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NUM_STREAMS; ++i) {
|
||||
@@ -262,6 +265,7 @@ void TestOnMultiGPUwithOneStream(void) {
|
||||
dim3(threadsPerBlock), 0, stream[i],
|
||||
static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NumDevices; ++i) {
|
||||
@@ -298,6 +302,7 @@ void TestkindDtoH(void) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
HIP_CHECK(hipMemcpyWithStream(C_h, C_d, Nbytes,
|
||||
hipMemcpyDeviceToHost, stream));
|
||||
@@ -365,6 +370,7 @@ void TestkindDtoD(void) {
|
||||
dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NumDevices; ++i) {
|
||||
@@ -411,6 +417,7 @@ void TestkindDefault(void) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
HIP_CHECK(hipMemcpyWithStream(C_h, C_d, Nbytes, hipMemcpyDefault, stream));
|
||||
HipTest::checkVectorADD(A_h, B_h, C_h, N);
|
||||
@@ -472,6 +479,7 @@ void TestkindDefaultForDtoD(void) {
|
||||
dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NumDevices; ++i) {
|
||||
|
||||
@@ -167,6 +167,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestwithOnestream(bool &val_res) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIPCHECK(hipStreamSynchronize(stream));
|
||||
HIPCHECK(hipMemcpy(C_h, C_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
val_res = ValidateResult(A_h, B_h, C_h);
|
||||
@@ -203,6 +204,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestwithTwoStream(bool &val_res) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NoofStreams; ++i) {
|
||||
@@ -258,6 +260,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestDtoDonSameDevice(bool &val_res) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < NoofStreams; ++i) {
|
||||
@@ -329,6 +332,7 @@ void HipMemcpyWithStreamMultiThreadtests::
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < numDevices; ++i) {
|
||||
@@ -363,6 +367,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestkindDtoH(bool &val_res) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIPCHECK(hipStreamSynchronize(stream));
|
||||
HIPCHECK(hipMemcpyWithStream(C_h, C_d, Nbytes,
|
||||
hipMemcpyDeviceToHost, stream));
|
||||
@@ -434,6 +439,7 @@ void HipMemcpyWithStreamMultiThreadtests::TestkindDtoD(bool &val_res) {
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < numDevices; ++i) {
|
||||
@@ -481,6 +487,7 @@ void HipMemcpyWithStreamMultiThreadtests::
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream, static_cast<const int*>(A_d),
|
||||
static_cast<const int*>(B_d), C_d, N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIPCHECK(hipStreamSynchronize(stream));
|
||||
HIPCHECK(hipMemcpyWithStream(C_h, C_d, Nbytes, hipMemcpyDefault, stream));
|
||||
val_res = ValidateResult(A_h, B_h, C_h);
|
||||
@@ -544,6 +551,7 @@ void HipMemcpyWithStreamMultiThreadtests::
|
||||
hipLaunchKernelGGL(HipTest::vectorADD, dim3(blocks), dim3(threadsPerBlock),
|
||||
0, stream[i], static_cast<const int*>(A_d[i]),
|
||||
static_cast<const int*>(B_d[i]), C_d[i], N);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
|
||||
for (int i=0; i < numDevices; ++i) {
|
||||
|
||||
@@ -53,6 +53,7 @@ TEST_CASE("Unit_hipHostMalloc_CoherentAccess") {
|
||||
std::cout << clkRate << std::endl;
|
||||
hipLaunchKernelGGL(HIP_KERNEL_NAME(Kernel), dim3(1), dim3(blocks),
|
||||
0, 0, hostRes, clkRate);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
int eleCounter = 0;
|
||||
while (eleCounter < blocks) {
|
||||
// blocks until the value changes
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/* Defines */
|
||||
#define NUM_THREADS 1000
|
||||
#define ITER 100
|
||||
#define ITER 10
|
||||
#define NUM_H 256
|
||||
#define NUM_W 256
|
||||
|
||||
@@ -105,6 +105,7 @@ TEST_CASE("Unit_hipMemset2DAsync_WithKernel") {
|
||||
for (size_t k = 0; k < ITER; k++) {
|
||||
hipLaunchKernelGGL(HipTest::vector_square, dim3(blocks),
|
||||
dim3(threadsPerBlock), 0, hipStreamPerThread, B_d, C_d, elements);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamSynchronize(hipStreamPerThread));
|
||||
HIP_CHECK(hipMemset2DAsync(C_d, pitch_C, memsetval, NUM_W, NUM_H,
|
||||
hipStreamPerThread));
|
||||
|
||||
برخی از فایل ها نشان داده نشدند زیرا تعداد زیادی فایل در این تفاوت تغییر کرده اند نمایش بیشتر
مرجع در شماره جدید
Block a user