Additional typo and extra space fix

이 커밋은 다음에 포함됨:
Peng Sun
2016-02-03 09:42:16 -06:00
16개의 변경된 파일235개의 추가작업 그리고 167개의 파일을 삭제
+2
파일 보기
@@ -66,6 +66,8 @@ if ($HIP_PLATFORM eq "hcc") {
$HIPCXXFLAGS .= " -I$HIP_PATH/include/hcc_detail/cuda";
$HIPLDFLAGS = "-hc -L$HCC_HOME/lib -Wl,--rpath=$HCC_HOME/lib -lc++ -ldl -lpthread -Wl,--whole-archive -lmcwamp -Wl,--no-whole-archive";
# Suppress linker warnings in case HCC distribution contains OpenCL/SPIR symbols
$HIPLDFLAGS .= " -Wl,--defsym=_binary_kernel_spir_end=0 -Wl,--defsym=_binary_kernel_spir_start=0 -Wl,--defsym=_binary_kernel_cl_start=0 -Wl,--defsym=_binary_kernel_cl_end=0";
$HIPLDFLAGS .= " -L$HSA_PATH/lib -lhsa-runtime64 -lhc_am";
# Add C++ libs for GCC.
$HIPLDFLAGS .= " -lstdc++";
+6 -6
파일 보기
@@ -325,7 +325,7 @@ while (@ARGV) {
$ft{'stream'} += s/\bcudaStreamCreate\b/hipStreamCreate/g;
$ft{'stream'} += s/\bcudaStreamCreateWithFlags\b/hipStreamCreateWithFlags/g;
$ft{'stream'} += s/\bcudaStreamDestroy\b/hipStreamDestroy/g;
$ft{'stream'} += s/\bcudaStreamWaitEvent\b/hipStreamWaitEven/g;
$ft{'stream'} += s/\bcudaStreamWaitEvent\b/hipStreamWaitEvent/g;
$ft{'stream'} += s/\bcudaStreamSynchronize\b/hipStreamSynchronize/g;
$ft{'stream'} += s/\bcudaStreamDefault\b/hipStreamDefault/g;
$ft{'stream'} += s/\bcudaStreamNonBlocking\b/hipStreamNonBlocking/g;
@@ -624,12 +624,12 @@ sub warnUnsupportedSpecialFunctions
"__ldg",
# Cross-lane and warp-vote instructions:
"__all",
"__any",
"__ballot",
#"__all",
#"__any",
#"__ballot",
"__popc",
"__clz",
#"__popc",
#"__clz",
"__shfl",
"__shfl_up",
+18 -18
파일 보기
@@ -8,11 +8,11 @@ HIP provides the following:
- Streams (hipStreamCreate(), etc.)---under development
- Events (hipEventRecord(), hipEventElapsedTime(), etc.)
- Kernel launching (hipLaunchKernel is a standard C/C++ function that replaces <<< >>>)
- Cuda-style kernel indexing
- CUDA-style kernel indexing
- Device-side math built-ins
- Error reporting (hipGetLastError(), hipGetErrorString())
The HIP documentation describes each API and its limitations, if any, compared with the equivalent Cuda API.
The HIP documentation describes each API and its limitations, if any, compared with the equivalent CUDA API.
### What is not supported?
#### Run-time features:
@@ -20,8 +20,8 @@ The HIP documentation describes each API and its limitations, if any, compared w
- Dynamic parallelism
- Managed memory
- Graphics interoperation with OpenGL or Direct3D
- Cuda array, mipmappedArray and pitched memory
- Cuda Driver API
- CUDA array, mipmappedArray and pitched memory
- CUDA Driver API
#### Kernel language features:
- Device-side dynamic memory allocations (malloc, free, new, delete)
@@ -34,35 +34,35 @@ The HIP documentation describes each API and its limitations, if any, compared w
Both AMD and Nvidia support OpenCL 1.2 on their devices, so developers can write portable code.
HIP offers several benefits over OpenCL:
- Developers can code in C++ as well as mix host and device C++ code in their source files. HIP C++ code can use templates, lambdas, classes and so on.
- The HIP API is less verbose than OpenCL and is familiar to Cuda developers.
- Because both Cuda and HIP are C++ languages, porting from Cuda to HIP is significantly easier than porting from Cuda to OpenCL.
- The HIP API is less verbose than OpenCL and is familiar to CUDA developers.
- Because both CUDA and HIP are C++ languages, porting from CUDA to HIP is significantly easier than porting from CUDA to OpenCL.
- HIP uses the best available development tools on each platform: on Nvidia GPUs, HIP code compiles using NVCC and can employ the nSight profiler and debugger (unlike OpenCL on Nvidia GPUs).
- HIP provides pointers and host-side pointer arithmetic.
- HIP provides device-level control over memory allocation and placement.
- HIP offers an offline compilation model.
### What hardware does HIP support?
- For AMD platforms, HIP runs on the same hardware that the HCC "hc" mode supports---specifically AMD Kaveri, Carrizo and Fiji. For Nvidia platforms, it should run on a device that uses the Cuda SDK 5.0 or newer. We have tested the Nvidia Titan and K40.
- For NVIDIA platform, HIP should run on an device which runs the CUDA SDK 5.0 or newer. We have tested nvidia Titan and K40.
- For AMD platforms, HIP runs on the same hardware that the HCC "hc" mode supports - specifically AMD Kaveri, Carrizo and Fiji.
- For Nvidia platforms, HIP should run on a device which runs the CUDA SDK 5.0 or newer. We have tested the Nvidia Titan and K40.
### Does Hipify automatically convert all source code?
Typically, Hipify can automatically convert almost all run-time code, and the coordinate indexing device code.
Most device code needs no additional conversion, since HIP and Cuda have similar names for math and built-in functions.
Most device code needs no additional conversion, since HIP and CUDA have similar names for math and built-in functions.
HIP currently requires manual addition of one more arguments to the kernel so that the host can communicate the execution configuration to the device.
Additional porting may be required to deal with architecture feature queries or with Cuda capabilities that HIP doesn’t support.
Additional porting may be required to deal with architecture feature queries or with CUDA capabilities that HIP doesn't support.
Developers should always expect to perform some platform-specific tuning and optimization.
### What is NVCC?
NVCC is Nvidia's compiler driver for compiling "Cuda C++" code into PTX or device code for Nvidia GPUs. It’s a closed-source binary product that comes with Cuda SDKs.
NVCC is Nvidia's compiler driver for compiling "CUDA C++" code into PTX or device code for Nvidia GPUs. It's a closed-source binary product that comes with CUDA SDKs.
### What is HCC?
HCC is AMD's compiler driver which compiles "heterogenous C++" code into HSAIL or GCN device code for AMD GPUs. HCC is an open-source compiler based on recent versions of CLANG/LLVM.
### Why use HIP rather than supporting Cuda run time directly?
### Why use HIP rather than supporting CUDA run time directly?
While HIP is a strong subset of the CUDA, it is a subset. The HIP layer allows that subset to be clearly defined and documented.
Developers who code to the HIP API can be assured there code will remain portable across NVIDIA and AMD platforms.
Developers who code to the HIP API can be assured there code will remain portable across Nvidia and AMD platforms.
### Can I develop HIP code on an NVIDIA CUDA platform?
### Can I develop HIP code on an Nvidia CUDA platform?
Yes! HIP's CUDA path only exposes the APIs and functionality that work on both NVCC and HCC back-ends.
"Extra" APIs, parameters, and features which exist in CUDA but not in HCC will typically result in compile-time or run-time errors.
Developers need to use the HIP API for most accelerator code, and bracket any CUDA-specific code with appropriate ifdefs.
@@ -70,12 +70,12 @@ Developers concerned about portability should of course run on both platforms, a
In some cases CUDA has a richer set of modes for some APIs, and some C++ capabilities such as virtual functions - see the HIP @API documentation for more details.
### Can I develop HIP code on an AMD HCC platform?
Yes! HIP's HCC path only exposes the APIs and functions that work on both NVCC and HCC back ends. "Extra" APIs, parameters and features that appear in HCC but not Cuda will typically cause compile- or run-time errors. Developers must use the HIP API for most accelerator code and bracket any HCC-specific code with appropriate ifdefs. Those concerned about portability should, of course, test their code on both platforms and should tune it for performance. Typically, HCC supports a more modern set of C++11/C++14/C++17 features, so HIP developers who want portability should be careful when using advanced C++ features on the hc path.
Yes! HIP's HCC path only exposes the APIs and functions that work on both NVCC and HCC back ends. "Extra" APIs, parameters and features that appear in HCC but not CUDA will typically cause compile- or run-time errors. Developers must use the HIP API for most accelerator code and bracket any HCC-specific code with appropriate ifdefs. Those concerned about portability should, of course, test their code on both platforms and should tune it for performance. Typically, HCC supports a more modern set of C++11/C++14/C++17 features, so HIP developers who want portability should be careful when using advanced C++ features on the hc path.
### Can a HIP binary run on both AMD and Nvidia platforms?
HIP is a source-portable language that can be compiled to run on either the HCC or NVCC platform. HIP tools don’t create a "fat binary" that can run on either platform, however.
HIP is a source-portable language that can be compiled to run on either the HCC or NVCC platform. HIP tools don't create a "fat binary" that can run on either platform, however.
### What's the difference between HIP and hc?
HIP is a portable C++ language that supports a strong subset of the Cuda run-time APIs and device-kernel language. It’s designed to simplify Cuda conversion to portable C++. HIP provides a C-compatible run-time API, C-compatible kernel-launch mechanism, C++ kernel language and pointer-based memory management.
HIP is a portable C++ language that supports a strong subset of the CUDA run-time APIs and device-kernel language. It's designed to simplify CUDA conversion to portable C++. HIP provides a C-compatible run-time API, C-compatible kernel-launch mechanism, C++ kernel language and pointer-based memory management.
A C++ dialect, hc is supported by the AMD HCC compiler. It provides C++ run time, C++ kernel-launch APIs (parallel_for_each), C++ kernel language, and several memory-management options, including pointers, arrays and array_view (with implicit data synchronization). It’s intended to be a leading indicator of the ISO C++ standard.
A C++ dialect, hc is supported by the AMD HCC compiler. It provides C++ run time, C++ kernel-launch APIs (parallel_for_each), C++ kernel language, and several memory-management options, including pointers, arrays and array_view (with implicit data synchronization). It's intended to be a leading indicator of the ISO C++ standard.
+61 -10
파일 보기
@@ -283,7 +283,6 @@ __device__ inline unsigned long long int atomicXor(unsigned long long int* addre
return (long long int)hc::atomic_fetch_xor((uint64_t*)address,(uint64_t)val);
}
#ifdef __HCC__
#include <hc.hpp>
// integer intrinsic function __poc __clz __ffs __brev
__device__ inline unsigned int __popc( unsigned int input)
@@ -346,7 +345,8 @@ __device__ inline int __all( int input)
__device__ inline int __any( int input)
{
return hc::__any( input);
if( hc::__any( input)!=0) return 1;
else return 0;
}
@@ -355,14 +355,53 @@ __device__ inline unsigned long long int __ballot( int input)
return hc::__ballot( input);
}
#endif
// warp shuffle functions
__device__ inline int __shfl(int input, int lane, int width)
{
return hc::__shfl(input,lane,width);
}
__device__ inline int __shfl_up(int input, unsigned int lane_delta, int width)
{
return hc::__shfl_up(input,lane_delta,width);
}
__device__ inline int __shfl_down(int input, unsigned int lane_delta, int width)
{
return hc::__shfl_down(input,lane_delta,width);
}
__device__ inline int __shfl_xor(int input, int lane_mask, int width)
{
return hc::__shfl_xor(input,lane_mask,width);
}
__device__ inline float __shfl(float input, int lane, int width)
{
return hc::__shfl(input,lane,width);
}
__device__ inline float __shfl_up(float input, unsigned int lane_delta, int width)
{
return hc::__shfl_up(input,lane_delta,width);
}
__device__ inline float __shfl_down(float input, unsigned int lane_delta, int width)
{
return hc::__shfl_down(input,lane_delta,width);
}
__device__ inline float __shfl_xor(float input, int lane_mask, int width)
{
return hc::__shfl_xor(input,lane_mask,width);
}
#ifdef __HCC_ACCELERATOR__
#include <hc_math.hpp>
// TODO: Choose whether default is precise math or fast math based on compilation flag.
#ifdef __HCC_ACCELERATOR__
using namespace hc::precise_math;
#endif
//TODO: Undo this once min/max functions are supported by hc
inline int min(int arg1, int arg2) __attribute((hc,cpu)) { \
@@ -372,12 +411,24 @@ inline int max(int arg1, int arg2) __attribute((hc,cpu)) { \
//TODO - add a couple fast math operations here, the set here will grow :
__device__ inline float __log2f(float x) {return hc::fast_math::log2(x); };
__device__ inline float __cosf(float x) {return hc::fast_math::cosf(x); };
__device__ inline float __expf(float x) {return hc::fast_math::expf(x); };
__device__ inline float __frsqrt_rn(float x) {return hc::fast_math::rsqrt(x); };
__device__ inline float __fsqrt_rd(float x) {return hc::fast_math::sqrt(x); };
__device__ inline float __fsqrt_rn(float x) {return hc::fast_math::sqrt(x); };
__device__ inline float __fsqrt_ru(float x) {return hc::fast_math::sqrt(x); };
__device__ inline float __fsqrt_rz(float x) {return hc::fast_math::sqrt(x); };
__device__ inline float __log10f(float x) {return hc::fast_math::log10f(x); };
__device__ inline float __log2f(float x) {return hc::fast_math::log2f(x); };
__device__ inline float __logf(float x) {return hc::fast_math::logf(x); };
__device__ inline float __powf(float base, float exponent) {return hc::fast_math::powf(base, exponent); };
#endif
__device__ inline void __sincosf(float x, float *s, float *c) {return hc::fast_math::sincosf(x, s, c); };
__device__ inline float __sinf(float x) {return hc::fast_math::sinf(x); };
__device__ inline float __tanf(float x) {return hc::fast_math::tanf(x); };
__device__ inline float __dsqrt_rd(double x) {return hc::fast_math::sqrt(x); };
__device__ inline float __dsqrt_rn(double x) {return hc::fast_math::sqrt(x); };
__device__ inline float __dsqrt_ru(double x) {return hc::fast_math::sqrt(x); };
__device__ inline float __dsqrt_rz(double x) {return hc::fast_math::sqrt(x); };
/**
* Kernel launching
+19 -2
파일 보기
@@ -75,6 +75,7 @@ macro (make_hip_executable exe cpp)
endif()
endmacro()
macro (make_test exe )
string (REPLACE " " "" smush_args ${ARGN})
set (testname ${exe}${smush_args}.tst)
@@ -87,6 +88,16 @@ macro (make_test exe )
endmacro()
macro (make_hipify_test sourceFile )
#string (REPLACE " " "" smush_args ${ARGN})
set (testname ${sourceFile}${smush_args}.tst)
add_test (NAME ${testname}
COMMAND ${HIP_PATH}/bin/hipify ${PROJECT_SOURCE_DIR}/${sourceFile} ${ARGN}
)
endmacro()
macro (make_test_matches exe match_string)
string (REPLACE " " "" smush_args ${ARGN})
set (testname ${exe}${smush_args}.tst)
@@ -103,6 +114,7 @@ endmacro()
#install (TARGETS hipMemset DESTINATION bin)
#install (TARGETS hipEventRecord DESTINATION bin)
make_hip_executable (hip_ballot hip_ballot.cpp)
make_hip_executable (hip_anyall hip_anyall.cpp)
make_hip_executable (hip_popc hip_popc.cpp)
make_hip_executable (hip_clz hip_clz.cpp)
@@ -115,9 +127,12 @@ make_hip_executable (hipLanguageExtensions hipLanguageExtensions.cpp)
make_hip_executable (hipGridLaunch hipGridLaunch.cpp)
make_hip_executable (hipHcc hipHcc.cpp)
make_hip_executable (hipSimpleAtomicsTest hipSimpleAtomicsTest.cpp)
make_hip_executable (hipMathFunctions hipMathFunctions.cpp hipSinglePrecisionMathHost.cpp hipDoublePrecisionMathHost.cpp hipSinglePrecisionMathDevice.cpp hipDoublePrecisionMathDevice.cpp)
target_link_libraries(hipMathFunctions m)
make_hip_executable (hipMathFunctionsHost hipMathFunctions.cpp hipSinglePrecisionMathHost.cpp hipDoublePrecisionMathHost.cpp)
make_hip_executable (hipMathFunctionsDevice hipMathFunctions.cpp hipSinglePrecisionMathDevice.cpp hipDoublePrecisionMathDevice.cpp)
make_hip_executable (hipIntrinsics hipMathFunctions.cpp hipSinglePrecisionIntrinsics.cpp hipDoublePrecisionIntrinsics.cpp hipIntegerIntrinsics.cpp)
target_link_libraries(hipMathFunctionsHost m)
make_test(hip_ballot " " )
make_test(hip_anyall " " )
make_test(hip_popc " " )
make_test(hip_brev " " )
@@ -133,3 +148,5 @@ make_test(hipGridLaunch " " )
make_test(hipMemcpy " " )
make_test(hipHcc " " )
make_hipify_test(specialFunc.cu )
+24 -24
파일 보기
@@ -27,34 +27,34 @@ THE SOFTWARE.
__device__ void double_precision_intrinsics()
{
__dadd_rd(0.0, 1.0);
__dadd_rn(0.0, 1.0);
__dadd_ru(0.0, 1.0);
__dadd_rz(0.0, 1.0);
__ddiv_rd(4.0, 2.0);
__ddiv_rn(4.0, 2.0);
__ddiv_ru(4.0, 2.0);
__ddiv_rz(4.0, 2.0);
__dmul_rd(1.0, 2.0);
__dmul_rn(1.0, 2.0);
__dmul_ru(1.0, 2.0);
__dmul_rz(1.0, 2.0);
__drcp_rd(2.0);
__drcp_rn(2.0);
__drcp_ru(2.0);
__drcp_rz(2.0);
//__dadd_rd(0.0, 1.0);
//__dadd_rn(0.0, 1.0);
//__dadd_ru(0.0, 1.0);
//__dadd_rz(0.0, 1.0);
//__ddiv_rd(0.0, 1.0);
//__ddiv_rn(0.0, 1.0);
//__ddiv_ru(0.0, 1.0);
//__ddiv_rz(0.0, 1.0);
//__dmul_rd(1.0, 2.0);
//__dmul_rn(1.0, 2.0);
//__dmul_ru(1.0, 2.0);
//__dmul_rz(1.0, 2.0);
//__drcp_rd(2.0);
//__drcp_rn(2.0);
//__drcp_ru(2.0);
//__drcp_rz(2.0);
__dsqrt_rd(4.0);
__dsqrt_rn(4.0);
__dsqrt_ru(4.0);
__dsqrt_rz(4.0);
__dsub_rd(2.0, 1.0);
__dsub_rn(2.0, 1.0);
__dsub_ru(2.0, 1.0);
__dsub_rz(2.0, 1.0);
__fma_rd(1.0, 2.0, 3.0);
__fma_rn(1.0, 2.0, 3.0);
__fma_ru(1.0, 2.0, 3.0);
__fma_rz(1.0, 2.0, 3.0);
//__dsub_rd(2.0, 1.0);
//__dsub_rn(2.0, 1.0);
//__dsub_ru(2.0, 1.0);
//__dsub_rz(2.0, 1.0);
//__fma_rd(1.0, 2.0, 3.0);
//__fma_rn(1.0, 2.0, 3.0);
//__fma_ru(1.0, 2.0, 3.0);
//__fma_rz(1.0, 2.0, 3.0);
}
__global__ void compileDoublePrecisionIntrinsics(hipLaunchParm lp, int ignored)
+13 -13
파일 보기
@@ -29,25 +29,25 @@ __device__ void integer_intrinsics()
{
__brev((unsigned int)10);
__brevll((unsigned long long)10);
__byte_perm((unsigned int)0, (unsigned int)0, 0);
//__byte_perm((unsigned int)0, (unsigned int)0, 0);
__clz((int)10);
__clzll((long long)10);
__ffs((int)10);
__ffsll((long long)10);
__hadd((int)1, (int)3);
__mul24((int)1, (int)2);
__mul64hi((long long)1, (long long)2);
__mulhi((int)1, (int)2);
//__hadd((int)1, (int)3);
//__mul24((int)1, (int)2);
//__mul64hi((long long)1, (long long)2);
//__mulhi((int)1, (int)2);
__popc((unsigned int)4);
__popcll((unsigned long long)4);
__rhadd((int)1, (int)2);
__sad((int)1, (int)2, 0);
__uhadd((unsigned int)1, (unsigned int)3);
__umul24((unsigned int)1, (unsigned int)2);
__umul64hi((unsigned long long)1, (unsigned long long)2);
__umulhi((unsigned int)1, (unsigned int)2);
__urhadd((unsigned int)1, (unsigned int)2);
__usad((unsigned int)1, (unsigned int)2, 0);
//__rhadd((int)1, (int)2);
//__sad((int)1, (int)2, 0);
//__uhadd((unsigned int)1, (unsigned int)3);
//__umul24((unsigned int)1, (unsigned int)2);
//__umul64hi((unsigned long long)1, (unsigned long long)2);
//__umulhi((unsigned int)1, (unsigned int)2);
//__urhadd((unsigned int)1, (unsigned int)2);
//__usad((unsigned int)1, (unsigned int)2, 0);
}
__global__ void compileIntegerIntrinsics(hipLaunchParm lp, int ignored)
+2 -2
파일 보기
@@ -190,7 +190,7 @@ int computeGold(int *gpuData, const int len)
return true;
}
__global__ void HIP_FUNCTION(testKernel,int *g_odata)
__global__ void testKernel(hipLaunchParm lp,int *g_odata)
{
// access thread id
const unsigned int tid = hipBlockDim_x * hipBlockIdx_x + hipThreadIdx_x;
@@ -236,7 +236,7 @@ __global__ void HIP_FUNCTION(testKernel,int *g_odata)
// Atomic XOR
atomicXor(&g_odata[10], tid);
}
HIP_FUNCTION_END
int main(int argc, char **argv)
{
+29 -28
파일 보기
@@ -30,48 +30,49 @@ __device__ void single_precision_intrinsics()
float fX, fY;
__cosf(0.0f);
__exp10f(0.0f);
//__exp10f(0.0f);
__expf(0.0f);
__fadd_rd(0.0f, 1.0f);
__fadd_rn(0.0f, 1.0f);
__fadd_ru(0.0f, 1.0f);
__fadd_rz(0.0f, 1.0f);
__fdiv_rd(4.0f, 2.0f);
__fdiv_rn(4.0f, 2.0f);
__fdiv_ru(4.0f, 2.0f);
__fdiv_rz(4.0f, 2.0f);
__fdividef(4.0f, 2.0f);
__fmaf_rd(1.0f, 2.0f, 3.0f);
__fmaf_rn(1.0f, 2.0f, 3.0f);
__fmaf_ru(1.0f, 2.0f, 3.0f);
__fmaf_rz(1.0f, 2.0f, 3.0f);
__fmul_rd(1.0f, 2.0f);
__fmul_rn(1.0f, 2.0f);
__fmul_ru(1.0f, 2.0f);
__fmul_rz(1.0f, 2.0f);
__frcp_rd(2.0f);
__frcp_rn(2.0f);
__frcp_ru(2.0f);
__frcp_rz(2.0f);
//__fadd_rd(0.0f, 1.0f);
//__fadd_rn(0.0f, 1.0f);
//__fadd_ru(0.0f, 1.0f);
//__fadd_rz(0.0f, 1.0f);
//__fdiv_rd(4.0f, 2.0f);
//__fdiv_rn(4.0f, 2.0f);
//__fdiv_ru(4.0f, 2.0f);
//__fdiv_rz(4.0f, 2.0f);
//__fdividef(4.0f, 2.0f);
//__fmaf_rd(1.0f, 2.0f, 3.0f);
//__fmaf_rn(1.0f, 2.0f, 3.0f);
//__fmaf_ru(1.0f, 2.0f, 3.0f);
//__fmaf_rz(1.0f, 2.0f, 3.0f);
//__fmul_rd(1.0f, 2.0f);
//__fmul_rn(1.0f, 2.0f);
//__fmul_ru(1.0f, 2.0f);
//__fmul_rz(1.0f, 2.0f);
//__frcp_rd(2.0f);
//__frcp_rn(2.0f);
//__frcp_ru(2.0f);
//__frcp_rz(2.0f);
__frsqrt_rn(4.0f);
__fsqrt_rd(4.0f);
__fsqrt_rn(4.0f);
__fsqrt_ru(4.0f);
__fsqrt_rz(4.0f);
__fsub_rd(2.0f, 1.0f);
__fsub_rn(2.0f, 1.0f);
__fsub_ru(2.0f, 1.0f);
__fsub_rz(2.0f, 1.0f);
//__fsub_rd(2.0f, 1.0f);
//__fsub_rn(2.0f, 1.0f);
//__fsub_ru(2.0f, 1.0f);
//__fsub_rz(2.0f, 1.0f);
__log10f(1.0f);
__log2f(1.0f);
__logf(1.0f);
__powf(1.0f, 0.0f);
__saturatef(0.1f);
__sincosf(0.0f, &fX, &fY);
//__saturatef(0.1f);
//__sincosf(0.0f, &fX, &fY);
__sinf(0.0f);
__tanf(0.0f);
}
__global__ void compileSinglePrecisionIntrinsics(hipLaunchParm lp, int ignored)
{
single_precision_intrinsics();
+2 -2
파일 보기
@@ -32,8 +32,8 @@ __global__ void
{
int tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x;
device_any[hipThreadIdx_x>>6] = __any(tid >77);
device_all[hipThreadIdx_x>>6] = __all(tid >77);
device_any[hipThreadIdx_x>>6] = __any(tid -77);
device_all[hipThreadIdx_x>>6] = __all(tid -77);
}
+48
파일 보기
@@ -0,0 +1,48 @@
#include <iostream>
#include <hip_runtime.h>
#define HIP_ASSERT(x) (assert((x)==hipSuccess))
__global__ void
gpu_ballot(hipLaunchParm lp, unsigned int* device_ballot, int Num_Warps_per_Block)
{
int tid = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x;
const unsigned int warp_num = hipThreadIdx_x >> 6;
atomicAdd(&device_ballot[warp_num+hipBlockIdx_x*Num_Warps_per_Block],__popcll(__ballot(tid - 245)));
}
int main(int argc, char *argv[])
{
unsigned int Num_Threads_per_Block = 512;
unsigned int Num_Blocks_per_Grid = 1;
unsigned int Num_Warps_per_Block = Num_Threads_per_Block/64;
unsigned int Num_Warps_per_Grid = (Num_Threads_per_Block*Num_Blocks_per_Grid)/64;
unsigned int* host_ballot = (unsigned int*)malloc(Num_Warps_per_Grid*sizeof(unsigned int));
unsigned int* device_ballot;
HIP_ASSERT(hipMalloc((void**)&device_ballot, Num_Warps_per_Grid*sizeof(unsigned int)));
for (int i=0; i<Num_Warps_per_Grid; i++) host_ballot[i] = 0;
HIP_ASSERT(hipMemcpy(device_ballot, host_ballot, Num_Warps_per_Grid*sizeof(unsigned int), hipMemcpyHostToDevice));
hipLaunchKernel(gpu_ballot, dim3(Num_Blocks_per_Grid),dim3(Num_Threads_per_Block),0,0, device_ballot,Num_Warps_per_Block);
HIP_ASSERT(hipMemcpy(host_ballot, device_ballot, Num_Warps_per_Grid*sizeof(unsigned int), hipMemcpyDeviceToHost));
for (int i=0; i<Num_Warps_per_Grid; i++) {
if ((host_ballot[i] == 0)||(host_ballot[i]/64 == 64)) std::cout << "Warp " << i << " IS convergent- Predicate true for " << host_ballot[i]/64 << " threads\n";
else std::cout << "Warp " << i << " IS divergent - Predicate true for " << host_ballot[i]/64<< " threads\n";
}
return EXIT_SUCCESS;
}
-15
파일 보기
@@ -79,21 +79,6 @@ HIP_kernel(hipLaunchParm lp,
#if 0
__kernel__ void HIP_kernel(unsigned int* a, unsigned int* b, unsigned long long int* c, unsigned long long int* d, int width, int height) {
int x = blockDimX * blockIdx.x + threadIdx.x;
int y = blockDimY * blockIdy.y + threadIdx.y;
int i = y * width + x;
if ( i < (width * height)) {
a[i] = __brev(b[i]);
c[i] = __brevll(d[i]);
}
}
#endif
using namespace std;
int main() {
-18
파일 보기
@@ -95,24 +95,6 @@ HIP_kernel(hipLaunchParm lp,
#if 0
__kernel__ void HIP_kernel(unsigned int* a, unsigned int* b,unsigned int* c, unsigned long long int* d,
unsigned int* e, int* f,unsigned int* g, long long int* h, int width, int height) {
int x = blockDimX * blockIdx.x + threadIdx.x;
int y = blockDimY * blockIdy.y + threadIdx.y;
int i = y * width + x;
if ( i < (width * height)) {
a[i] = __clz(b[i]);
c[i] = __clzll(d[i]);
e[i] = __clz(f[i]);
g[i] = __clzll(h[i]);
}
}
#endif
using namespace std;
int main() {
-16
파일 보기
@@ -73,22 +73,6 @@ HIP_kernel(hipLaunchParm lp,
#if 0
__kernel__ void HIP_kernel( unsigned int* a, unsigned int* b, unsigned int* c, unsigned long long int* d,
int width, int height) {
int x = blockDimX * blockIdx.x + threadIdx.x;
int y = blockDimY * blockIdy.y + threadIdx.y;
int i = y * width + x;
if ( i < (width * height)) {
a[i] = __ffs(b[i]);
c[i] = __ffsll(d[i]);
}
}
#endif
using namespace std;
-13
파일 보기
@@ -71,20 +71,7 @@ HIP_kernel(hipLaunchParm lp,
#if 0
__kernel__ void HIP_kernel(unsigned int* a, unsigned int* b, unsigned int* c, unsigned long long int* d, int width, int height) {
int x = blockDimX * blockIdx.x + threadIdx.x;
int y = blockDimY * blockIdy.y + threadIdx.y;
int i = y * width + x;
if ( i < (width * height)) {
a[i] = __popc(b[i]);
c[i] = __popcll(d[i]);
}
}
#endif
using namespace std;
+11
파일 보기
@@ -0,0 +1,11 @@
//Test to ensure hipify runs correctly.
// Hipify may report warnings for some missing/unsupported functions
void __global__
test_kernel(float *A)
{
int tid = blockIdx.x * blockDim.x + threadIdx.x;
float a = __ballot(tid < 16);
float b = __shfl(tid < 16);
}