Merge branch 'master' into move-memcpy
This commit is contained in:
Plik diff jest za duży
Load Diff
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hcc_detail/device_library_decls.h
|
||||
* @brief Contains declarations for types and functions in device library.
|
||||
*/
|
||||
|
||||
#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_DEVICE_LIBRARY_DECLS_H
|
||||
#define HIP_INCLUDE_HIP_HCC_DETAIL_DEVICE_LIBRARY_DECLS_H
|
||||
|
||||
#include "hip/hcc_detail/host_defines.h"
|
||||
|
||||
extern "C" __device__ __attribute__((const)) bool __ockl_wfany_i32(int);
|
||||
extern "C" __device__ __attribute__((const)) bool __ockl_wfall_i32(int);
|
||||
extern "C" __device__ uint __ockl_activelane_u32(void);
|
||||
|
||||
extern "C" __device__ __attribute__((const)) uint __ockl_mul24_u32(uint, uint);
|
||||
extern "C" __device__ __attribute__((const)) int __ockl_mul24_i32(int, int);
|
||||
extern "C" __device__ __attribute__((const)) uint __ockl_mul_hi_u32(uint, uint);
|
||||
extern "C" __device__ __attribute__((const)) int __ockl_mul_hi_i32(int, int);
|
||||
extern "C" __device__ __attribute__((const)) uint __ockl_sad_u32(uint, uint, uint);
|
||||
|
||||
extern "C" __device__ __attribute__((const)) float __ocml_floor_f32(float);
|
||||
extern "C" __device__ __attribute__((const)) float __ocml_rint_f32(float);
|
||||
extern "C" __device__ __attribute__((const)) float __ocml_ceil_f32(float);
|
||||
extern "C" __device__ __attribute__((const)) float __ocml_trunc_f32(float);
|
||||
|
||||
extern "C" __device__ __attribute__((const)) float __ocml_fmin_f32(float, float);
|
||||
extern "C" __device__ __attribute__((const)) float __ocml_fmax_f32(float, float);
|
||||
|
||||
// Introduce local address space
|
||||
#define __local __attribute__((address_space(3)))
|
||||
|
||||
#ifdef __HIP_DEVICE_COMPILE__
|
||||
__device__ inline static __local void* __to_local(unsigned x) { return (__local void*)x; }
|
||||
#endif //__HIP_DEVICE_COMPILE__
|
||||
|
||||
// __llvm_fence* functions from device-libs/irif/src/fence.ll
|
||||
extern "C" __device__ void __llvm_fence_acq_sg(void);
|
||||
extern "C" __device__ void __llvm_fence_acq_wg(void);
|
||||
extern "C" __device__ void __llvm_fence_acq_dev(void);
|
||||
extern "C" __device__ void __llvm_fence_acq_sys(void);
|
||||
|
||||
extern "C" __device__ void __llvm_fence_rel_sg(void);
|
||||
extern "C" __device__ void __llvm_fence_rel_wg(void);
|
||||
extern "C" __device__ void __llvm_fence_rel_dev(void);
|
||||
extern "C" __device__ void __llvm_fence_rel_sys(void);
|
||||
|
||||
extern "C" __device__ void __llvm_fence_ar_sg(void);
|
||||
extern "C" __device__ void __llvm_fence_ar_wg(void);
|
||||
extern "C" __device__ void __llvm_fence_ar_dev(void);
|
||||
extern "C" __device__ void __llvm_fence_ar_sys(void);
|
||||
|
||||
|
||||
extern "C" __device__ void __llvm_fence_sc_sg(void);
|
||||
extern "C" __device__ void __llvm_fence_sc_wg(void);
|
||||
extern "C" __device__ void __llvm_fence_sc_dev(void);
|
||||
extern "C" __device__ void __llvm_fence_sc_sys(void);
|
||||
|
||||
#endif
|
||||
@@ -23,54 +23,81 @@ THE SOFTWARE.
|
||||
#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_HIP_LDG_H
|
||||
#define HIP_INCLUDE_HIP_HCC_DETAIL_HIP_LDG_H
|
||||
|
||||
#if defined __HCC__
|
||||
#if __hcc_workweek__ >= 16164
|
||||
#if defined(__HCC_OR_HIP_CLANG__)
|
||||
#if __hcc_workweek__ >= 16164 || defined(__HIP_CLANG_ONLY__)
|
||||
#include "hip_vector_types.h"
|
||||
#include "host_defines.h"
|
||||
|
||||
__device__ char __ldg(const char*);
|
||||
__device__ char2 __ldg(const char2*);
|
||||
__device__ char4 __ldg(const char4*);
|
||||
__device__ signed char __ldg(const signed char*);
|
||||
__device__ unsigned char __ldg(const unsigned char*);
|
||||
__device__ inline static char __ldg(const char* ptr) { return *ptr; }
|
||||
|
||||
__device__ short __ldg(const short*);
|
||||
__device__ short2 __ldg(const short2*);
|
||||
__device__ short4 __ldg(const short4*);
|
||||
__device__ unsigned short __ldg(const unsigned short*);
|
||||
__device__ inline static char2 __ldg(const char2* ptr) { return *ptr; }
|
||||
|
||||
__device__ int __ldg(const int*);
|
||||
__device__ int2 __ldg(const int2*);
|
||||
__device__ int4 __ldg(const int4*);
|
||||
__device__ unsigned int __ldg(const unsigned int*);
|
||||
__device__ inline static char4 __ldg(const char4* ptr) { return *ptr; }
|
||||
|
||||
__device__ inline static signed char __ldg(const signed char* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static unsigned char __ldg(const unsigned char* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ long __ldg(const long*);
|
||||
__device__ unsigned long __ldg(const unsigned long*);
|
||||
__device__ inline static short __ldg(const short* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ long long __ldg(const long long*);
|
||||
__device__ longlong2 __ldg(const longlong2*);
|
||||
__device__ unsigned long long __ldg(const unsigned long long*);
|
||||
__device__ inline static short2 __ldg(const short2* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ uchar2 __ldg(const uchar2*);
|
||||
__device__ uchar4 __ldg(const uchar4*);
|
||||
__device__ inline static short4 __ldg(const short4* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ ushort2 __ldg(const ushort2*);
|
||||
__device__ inline static unsigned short __ldg(const unsigned short* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ uint2 __ldg(const uint2*);
|
||||
__device__ uint4 __ldg(const uint4*);
|
||||
|
||||
__device__ ulonglong2 __ldg(const ulonglong2*);
|
||||
__device__ inline static int __ldg(const int* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ float __ldg(const float*);
|
||||
__device__ float2 __ldg(const float2*);
|
||||
__device__ float4 __ldg(const float4*);
|
||||
__device__ inline static int2 __ldg(const int2* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ double __ldg(const double*);
|
||||
__device__ double2 __ldg(const double2*);
|
||||
__device__ inline static int4 __ldg(const int4* ptr) { return ptr[0]; }
|
||||
|
||||
#endif // __hcc_workweek__
|
||||
__device__ inline static unsigned int __ldg(const unsigned int* ptr) { return ptr[0]; }
|
||||
|
||||
#endif // __HCC__
|
||||
|
||||
__device__ inline static long __ldg(const long* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static unsigned long __ldg(const unsigned long* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static long long __ldg(const long long* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static longlong2 __ldg(const longlong2* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static unsigned long long __ldg(const unsigned long long* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static uchar2 __ldg(const uchar2* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static uchar4 __ldg(const uchar4* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static ushort2 __ldg(const ushort2* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static uint2 __ldg(const uint2* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static uint4 __ldg(const uint4* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static ulonglong2 __ldg(const ulonglong2* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static float __ldg(const float* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static float2 __ldg(const float2* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static float4 __ldg(const float4* ptr) { return ptr[0]; }
|
||||
|
||||
|
||||
__device__ inline static double __ldg(const double* ptr) { return ptr[0]; }
|
||||
|
||||
__device__ inline static double2 __ldg(const double2* ptr) { return ptr[0]; }
|
||||
|
||||
#endif // __hcc_workweek__ || defined(__HIP_CLANG_ONLY__)
|
||||
|
||||
#endif // defined(__HCC_OR_HIP_CLANG__)
|
||||
|
||||
#endif // HIP_LDG_H
|
||||
|
||||
@@ -110,9 +110,9 @@ extern int HIP_TRACE_API;
|
||||
#include <hip/hcc_detail/host_defines.h>
|
||||
#include <hip/hcc_detail/math_functions.h>
|
||||
#include <hip/hcc_detail/device_functions.h>
|
||||
#include <hip/hcc_detail/surface_functions.h>
|
||||
#if __HCC__
|
||||
#include <hip/hcc_detail/texture_functions.h>
|
||||
#include <hip/hcc_detail/surface_functions.h>
|
||||
#endif // __HCC__
|
||||
|
||||
// TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define.
|
||||
@@ -184,45 +184,11 @@ extern int HIP_TRACE_API;
|
||||
#define __HCC_C__
|
||||
#endif
|
||||
|
||||
// TODO - hipify-clang - change to use the function call.
|
||||
//#define warpSize hc::__wavesize()
|
||||
static constexpr int warpSize = 64;
|
||||
|
||||
#define clock_t long long int
|
||||
__device__ long long int clock64();
|
||||
__device__ clock_t clock();
|
||||
|
||||
// abort
|
||||
__device__ void abort();
|
||||
|
||||
// warp vote function __all __any __ballot
|
||||
__device__ int __all(int input);
|
||||
__device__ int __any(int input);
|
||||
__device__ unsigned long long int __ballot(int input);
|
||||
|
||||
#if __HIP_ARCH_GFX701__ == 0
|
||||
|
||||
// warp shuffle functions
|
||||
#ifdef __cplusplus
|
||||
__device__ int __shfl(int input, int lane, int width = warpSize);
|
||||
__device__ int __shfl_up(int input, unsigned int lane_delta, int width = warpSize);
|
||||
__device__ int __shfl_down(int input, unsigned int lane_delta, int width = warpSize);
|
||||
__device__ int __shfl_xor(int input, int lane_mask, int width = warpSize);
|
||||
__device__ float __shfl(float input, int lane, int width = warpSize);
|
||||
__device__ float __shfl_up(float input, unsigned int lane_delta, int width = warpSize);
|
||||
__device__ float __shfl_down(float input, unsigned int lane_delta, int width = warpSize);
|
||||
__device__ float __shfl_xor(float input, int lane_mask, int width = warpSize);
|
||||
#else
|
||||
__device__ int __shfl(int input, int lane, int width);
|
||||
__device__ int __shfl_up(int input, unsigned int lane_delta, int width);
|
||||
__device__ int __shfl_down(int input, unsigned int lane_delta, int width);
|
||||
__device__ int __shfl_xor(int input, int lane_mask, int width);
|
||||
__device__ float __shfl(float input, int lane, int width);
|
||||
__device__ float __shfl_up(float input, unsigned int lane_delta, int width);
|
||||
__device__ float __shfl_down(float input, unsigned int lane_delta, int width);
|
||||
__device__ float __shfl_xor(float input, int lane_mask, int width);
|
||||
#endif //__cplusplus
|
||||
|
||||
__device__ unsigned __hip_ds_bpermute(int index, unsigned src);
|
||||
__device__ float __hip_ds_bpermutef(int index, float src);
|
||||
__device__ unsigned __hip_ds_permute(int index, unsigned src);
|
||||
@@ -235,85 +201,15 @@ __device__ int __hip_move_dpp(int src, int dpp_ctrl, int row_mask, int bank_mask
|
||||
|
||||
#endif //__HIP_ARCH_GFX803__ == 1
|
||||
|
||||
__host__ __device__ int min(int arg1, int arg2);
|
||||
__host__ __device__ int max(int arg1, int arg2);
|
||||
__device__ inline static int min(int arg1, int arg2) {
|
||||
return (arg1 < arg2) ? arg1 : arg2;
|
||||
}
|
||||
__device__ inline static int max(int arg1, int arg2) {
|
||||
return (arg1 > arg2) ? arg1 : arg2;
|
||||
}
|
||||
|
||||
__device__ void* __get_dynamicgroupbaseptr();
|
||||
|
||||
|
||||
/**
|
||||
* CUDA 8 device function features
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Kernel launching
|
||||
*/
|
||||
|
||||
/**
|
||||
*-------------------------------------------------------------------------------------------------
|
||||
*-------------------------------------------------------------------------------------------------
|
||||
* @defgroup Fence Fence Functions
|
||||
* @{
|
||||
*
|
||||
*
|
||||
* @warning The HIP memory fence functions are currently not supported yet.
|
||||
* If any of those threadfence stubs are reached by the application, you should set "export
|
||||
*HSA_DISABLE_CACHE=1" to disable L1 and L2 caches.
|
||||
*
|
||||
*
|
||||
* On AMD platforms, the threadfence* routines are currently empty stubs.
|
||||
*/
|
||||
|
||||
extern __attribute__((const)) __device__ void __hip_hc_threadfence() __asm("__llvm_fence_sc_dev");
|
||||
extern __attribute__((const)) __device__ void __hip_hc_threadfence_block() __asm(
|
||||
"__llvm_fence_sc_wg");
|
||||
|
||||
|
||||
/**
|
||||
* @brief threadfence_block makes writes visible to threads running in same block.
|
||||
*
|
||||
* @Returns void
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @warning __threadfence_block is a stub and map to no-op.
|
||||
*/
|
||||
// __device__ void __threadfence_block(void);
|
||||
__device__ static inline void __threadfence_block(void) { return __hip_hc_threadfence_block(); }
|
||||
|
||||
/**
|
||||
* @brief threadfence makes wirtes visible to other threads running on same GPU.
|
||||
*
|
||||
* @Returns void
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @warning __threadfence is a stub and map to no-op, application should set "export
|
||||
* HSA_DISABLE_CACHE=1" to disable both L1 and L2 caches.
|
||||
*/
|
||||
// __device__ void __threadfence(void) __attribute__((deprecated("Provided for compile-time
|
||||
// compatibility, not yet functional")));
|
||||
__device__ static inline void __threadfence(void) { return __hip_hc_threadfence(); }
|
||||
|
||||
/**
|
||||
* @brief threadfence_system makes writes to pinned system memory visible on host CPU.
|
||||
*
|
||||
* @Returns void
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @warning __threadfence_system is a stub and map to no-op.
|
||||
*/
|
||||
//__device__ void __threadfence_system(void) __attribute__((deprecated("Provided with workaround
|
||||
//configuration, see hip_kernel_language.md for details")));
|
||||
__device__ void __threadfence_system(void);
|
||||
|
||||
// doxygen end Fence Fence
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
__host__ inline static int min(int arg1, int arg2) { return std::min(arg1, arg2); }
|
||||
__host__ inline static int max(int arg1, int arg2) { return std::max(arg1, arg2); }
|
||||
|
||||
#endif // __HCC_OR_HIP_CLANG__
|
||||
|
||||
@@ -424,17 +320,6 @@ extern void ihipPostLaunchKernel(const char* kernelName, hipStream_t stream, gri
|
||||
|
||||
#endif //__HCC_CPP__
|
||||
|
||||
/**
|
||||
* extern __shared__
|
||||
*/
|
||||
|
||||
// Macro to replace extern __shared__ declarations
|
||||
// to local variable definitions
|
||||
#define HIP_DYNAMIC_SHARED(type, var) type* var = (type*)__get_dynamicgroupbaseptr();
|
||||
|
||||
#define HIP_DYNAMIC_SHARED_ATTRIBUTE
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup HIP-ENV HIP Environment Variables
|
||||
* @{
|
||||
@@ -553,33 +438,6 @@ extern const __device__ __attribute__((weak)) __hip_builtin_gridDim_t gridDim;
|
||||
#define hipGridDim_y gridDim.y
|
||||
#define hipGridDim_z gridDim.z
|
||||
|
||||
#pragma push_macro("__DEVICE__")
|
||||
#define __DEVICE__ extern "C" __device__ __attribute__((always_inline)) \
|
||||
__attribute__((weak))
|
||||
|
||||
__DEVICE__ void __device_trap() __asm("llvm.trap");
|
||||
|
||||
__DEVICE__ void inline __assert_fail(const char * __assertion,
|
||||
const char *__file,
|
||||
unsigned int __line,
|
||||
const char *__function)
|
||||
{
|
||||
// Ignore all the args for now.
|
||||
__device_trap();
|
||||
}
|
||||
|
||||
extern "C" __device__ __attribute__((noduplicate)) void __syncthreads();
|
||||
extern "C" __device__ void *__amdgcn_get_dynamicgroupbaseptr();
|
||||
|
||||
// Macro to replace extern __shared__ declarations
|
||||
// to local variable definitions
|
||||
#define HIP_DYNAMIC_SHARED(type, var) \
|
||||
type* var = (type*)__amdgcn_get_dynamicgroupbaseptr();
|
||||
|
||||
#define HIP_DYNAMIC_SHARED_ATTRIBUTE
|
||||
|
||||
#pragma push_macro("__DEVICE__")
|
||||
|
||||
#include <hip/hcc_detail/math_functions.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2621,6 +2621,13 @@ hipError_t hipBindTextureToArray(struct texture<T, dim, readMode>& tex, hipArray
|
||||
return ihipBindTextureToArrayImpl(dim, readMode, array, desc, &tex);
|
||||
}
|
||||
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
inline static hipError_t hipBindTextureToArray(struct texture<T, dim, readMode> *tex,
|
||||
hipArray_const_t array,
|
||||
const struct hipChannelFormatDesc* desc) {
|
||||
return ihipBindTextureToArrayImpl(dim, readMode, array, *desc, tex);
|
||||
}
|
||||
|
||||
// C API
|
||||
hipError_t hipBindTextureToMipmappedArray(const textureReference* tex,
|
||||
hipMipmappedArray_const_t mipmappedArray,
|
||||
|
||||
Plik diff jest za duży
Load Diff
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hcc_detail/llvm_intrinsics.h
|
||||
* @brief Contains declarations for wrapper functions for llvm intrinsics
|
||||
* like llvm.amdgcn.s.barrier.
|
||||
*/
|
||||
|
||||
#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_LLVM_INTRINSICS_H
|
||||
#define HIP_INCLUDE_HIP_HCC_DETAIL_LLVM_INTRINSICS_H
|
||||
|
||||
#include "hip/hcc_detail/host_defines.h"
|
||||
|
||||
__device__
|
||||
__attribute__((convergent))
|
||||
ulong __llvm_amdgcn_icmp_i32(uint x, uint y, uint z) __asm("llvm.amdgcn.icmp.i32");
|
||||
|
||||
__device__
|
||||
unsigned __llvm_amdgcn_groupstaticsize() __asm("llvm.amdgcn.groupstaticsize");
|
||||
|
||||
__device__
|
||||
unsigned int __llvm_bitrev_b32(unsigned int src0) __asm("llvm.bitreverse.i32");
|
||||
|
||||
__device__
|
||||
uint64_t __llvm_bitrev_b64(uint64_t src0) __asm("llvm.bitreverse.i64");
|
||||
|
||||
extern
|
||||
__device__
|
||||
__attribute__((const))
|
||||
unsigned int __mbcnt_lo(unsigned int x, unsigned int y) __asm("llvm.amdgcn.mbcnt.lo");
|
||||
|
||||
extern
|
||||
__device__
|
||||
__attribute__((const))
|
||||
unsigned int __mbcnt_hi(unsigned int x, unsigned int y) __asm("llvm.amdgcn.mbcnt.hi");
|
||||
|
||||
__device__
|
||||
int __llvm_amdgcn_ds_bpermute(int index, int src) __asm("llvm.amdgcn.ds.bpermute");
|
||||
|
||||
__device__
|
||||
int __llvm_amdgcn_ds_permute(int index, int src) __asm("llvm.amdgcn.ds.permute");
|
||||
|
||||
__device__
|
||||
int __llvm_amdgcn_ds_swizzle(int index, int pattern) __asm("llvm.amdgcn.ds.swizzle");
|
||||
|
||||
__device__
|
||||
int __llvm_amdgcn_move_dpp(int src, int dpp_ctrl, int row_mask, int bank_mask,
|
||||
bool bound_ctrl) __asm("llvm.amdgcn.mov.dpp.i32");
|
||||
|
||||
#endif
|
||||
@@ -23,8 +23,6 @@ THE SOFTWARE.
|
||||
#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_SURFACE_FUNCTIONS_H
|
||||
#define HIP_INCLUDE_HIP_HCC_DETAIL_SURFACE_FUNCTIONS_H
|
||||
|
||||
#include <hc.hpp>
|
||||
#include <hc_short_vector.hpp>
|
||||
#include <hip/hcc_detail/hip_surface_types.h>
|
||||
|
||||
#define __SURFACE_FUNCTIONS_DECL__ static __inline__ __device__
|
||||
|
||||
@@ -110,47 +110,47 @@ union TData {
|
||||
|
||||
#define TEXTURE_RETURN_UNSIGNED return texel.u.x;
|
||||
|
||||
#define TEXTURE_RETURN_CHAR_X return char1(texel.i.x);
|
||||
#define TEXTURE_RETURN_CHAR_X return make_char1(texel.i.x);
|
||||
|
||||
#define TEXTURE_RETURN_UCHAR_X return uchar1(texel.u.x);
|
||||
#define TEXTURE_RETURN_UCHAR_X return make_uchar1(texel.u.x);
|
||||
|
||||
#define TEXTURE_RETURN_SHORT_X return short1(texel.i.x);
|
||||
#define TEXTURE_RETURN_SHORT_X return make_short1(texel.i.x);
|
||||
|
||||
#define TEXTURE_RETURN_USHORT_X return ushort1(texel.u.x);
|
||||
#define TEXTURE_RETURN_USHORT_X return make_ushort1(texel.u.x);
|
||||
|
||||
#define TEXTURE_RETURN_INT_X return int1(texel.i.x);
|
||||
#define TEXTURE_RETURN_INT_X return make_int1(texel.i.x);
|
||||
|
||||
#define TEXTURE_RETURN_UINT_X return uint1(texel.u.x);
|
||||
#define TEXTURE_RETURN_UINT_X return make_uint1(texel.u.x);
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT_X return float1(texel.f.x);
|
||||
#define TEXTURE_RETURN_FLOAT_X return make_float1(texel.f.x);
|
||||
|
||||
#define TEXTURE_RETURN_CHAR_XY return char2(texel.i.x, texel.i.y);
|
||||
#define TEXTURE_RETURN_CHAR_XY return make_char2(texel.i.x, texel.i.y);
|
||||
|
||||
#define TEXTURE_RETURN_UCHAR_XY return uchar2(texel.u.x, texel.u.y);
|
||||
#define TEXTURE_RETURN_UCHAR_XY return make_uchar2(texel.u.x, texel.u.y);
|
||||
|
||||
#define TEXTURE_RETURN_SHORT_XY return short2(texel.i.x, texel.i.y);
|
||||
#define TEXTURE_RETURN_SHORT_XY return make_short2(texel.i.x, texel.i.y);
|
||||
|
||||
#define TEXTURE_RETURN_USHORT_XY return ushort2(texel.u.x, texel.u.y);
|
||||
#define TEXTURE_RETURN_USHORT_XY return make_ushort2(texel.u.x, texel.u.y);
|
||||
|
||||
#define TEXTURE_RETURN_INT_XY return int2(texel.i.x, texel.i.y);
|
||||
#define TEXTURE_RETURN_INT_XY return make_int2(texel.i.x, texel.i.y);
|
||||
|
||||
#define TEXTURE_RETURN_UINT_XY return uint2(texel.u.x, texel.u.y);
|
||||
#define TEXTURE_RETURN_UINT_XY return make_uint2(texel.u.x, texel.u.y);
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT_XY return float2(texel.f.x, texel.f.y);
|
||||
#define TEXTURE_RETURN_FLOAT_XY return make_float2(texel.f.x, texel.f.y);
|
||||
|
||||
#define TEXTURE_RETURN_CHAR_XYZW return char4(texel.i.x, texel.i.y, texel.i.z, texel.i.w);
|
||||
#define TEXTURE_RETURN_CHAR_XYZW return make_char4(texel.i.x, texel.i.y, texel.i.z, texel.i.w);
|
||||
|
||||
#define TEXTURE_RETURN_UCHAR_XYZW return uchar4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
#define TEXTURE_RETURN_UCHAR_XYZW return make_uchar4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
|
||||
#define TEXTURE_RETURN_SHORT_XYZW return short4(texel.i.x, texel.i.y, texel.i.z, texel.i.w);
|
||||
#define TEXTURE_RETURN_SHORT_XYZW return make_short4(texel.i.x, texel.i.y, texel.i.z, texel.i.w);
|
||||
|
||||
#define TEXTURE_RETURN_USHORT_XYZW return ushort4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
#define TEXTURE_RETURN_USHORT_XYZW return make_ushort4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
|
||||
#define TEXTURE_RETURN_INT_XYZW return int4(texel.i.x, texel.i.y, texel.i.z, texel.i.w);
|
||||
#define TEXTURE_RETURN_INT_XYZW return make_int4(texel.i.x, texel.i.y, texel.i.z, texel.i.w);
|
||||
|
||||
#define TEXTURE_RETURN_UINT_XYZW return uint4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
#define TEXTURE_RETURN_UINT_XYZW return make_uint4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT_XYZW return float4(texel.f.x, texel.f.y, texel.f.z, texel.f.w);
|
||||
#define TEXTURE_RETURN_FLOAT_XYZW return make_float4(texel.f.x, texel.f.y, texel.f.z, texel.f.w);
|
||||
|
||||
extern "C" {
|
||||
hc::short_vector::float4::vector_value_type __ockl_image_sample_1D(unsigned int ADDRESS_SPACE_CONSTANT* i,
|
||||
|
||||
@@ -297,7 +297,7 @@ enum hipComputeMode {
|
||||
hipComputeModeDefault = 0,
|
||||
hipComputeModeExclusive = 1,
|
||||
hipComputeModeProhibited = 2,
|
||||
hipComputeModeExcusiveProcess = 3
|
||||
hipComputeModeExclusiveProcess = 3
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,6 +163,7 @@ typedef cudaSurfaceObject_t hipSurfaceObject_t;
|
||||
#define hipTextureType1D cudaTextureType1D
|
||||
#define hipTextureType1DLayered cudaTextureType1DLayered
|
||||
#define hipTextureType2D cudaTextureType2D
|
||||
#define hipTextureType2DLayered cudaTextureType2DLayered
|
||||
#define hipTextureType3D cudaTextureType3D
|
||||
#define hipDeviceMapHost cudaDeviceMapHost
|
||||
|
||||
@@ -1168,20 +1169,20 @@ inline static hipError_t hipOccupancyMaxPotentialBlockSize(int* minGridSize, int
|
||||
return hipCUDAErrorTohipError(cerror);
|
||||
}
|
||||
|
||||
template <class T, int dim, enum cudaTextureReadMode readMode>
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
inline static hipError_t hipBindTexture(size_t* offset, const struct texture<T, dim, readMode>& tex,
|
||||
const void* devPtr, size_t size = UINT_MAX) {
|
||||
return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, size));
|
||||
}
|
||||
|
||||
template <class T, int dim, enum cudaTextureReadMode readMode>
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
inline static hipError_t hipBindTexture(size_t* offset, struct texture<T, dim, readMode>& tex,
|
||||
const void* devPtr, const struct hipChannelFormatDesc& desc,
|
||||
size_t size = UINT_MAX) {
|
||||
return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size));
|
||||
}
|
||||
|
||||
template <class T, int dim, enum cudaTextureReadMode readMode>
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
inline static hipError_t hipUnbindTexture(struct texture<T, dim, readMode>* tex) {
|
||||
return hipCUDAErrorTohipError(cudaUnbindTexture(tex));
|
||||
}
|
||||
@@ -1198,7 +1199,14 @@ inline static hipError_t hipBindTextureToArray(struct texture<T, dim, readMode>&
|
||||
return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array, desc));
|
||||
}
|
||||
|
||||
template <class T, int dim, enum cudaTextureReadMode readMode>
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
inline static hipError_t hipBindTextureToArray(struct texture<T, dim, readMode> *tex,
|
||||
hipArray_const_t array,
|
||||
const struct hipChannelFormatDesc* desc) {
|
||||
return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array, desc));
|
||||
}
|
||||
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
inline static hipError_t hipBindTextureToArray(struct texture<T, dim, readMode>& tex,
|
||||
hipArray_const_t array) {
|
||||
return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array));
|
||||
@@ -1239,6 +1247,16 @@ inline static hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDe
|
||||
hipTextureObject_t textureObject) {
|
||||
return hipCUDAErrorTohipError(cudaGetTextureObjectResourceDesc( pResDesc, textureObject));
|
||||
}
|
||||
|
||||
inline static hipError_t hipGetTextureAlignmentOffset(size_t* offset, const textureReference* texref)
|
||||
{
|
||||
return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
|
||||
}
|
||||
|
||||
inline static hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array)
|
||||
{
|
||||
return hipCUDAErrorTohipError(cudaGetChannelDesc(desc,array));
|
||||
}
|
||||
#endif //__CUDACC__
|
||||
|
||||
#endif // HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_RUNTIME_API_H
|
||||
|
||||
Reference in New Issue
Block a user