Adjust clang format to the new versions, revert broken macro layout (#714)

This commit is contained in:
Danylo Lytovchenko
2025-08-22 17:23:22 +02:00
committed by GitHub
orang tua ed877433f3
melakukan 2ff2316227
189 mengubah file dengan 1906 tambahan dan 2418 penghapusan
@@ -1915,13 +1915,12 @@ __BF16_DEVICE_STATIC__ __hip_bfloat16 unsafeAtomicAdd(__hip_bfloat16* address,
static_assert(sizeof(unsigned short int) == sizeof(__hip_bfloat16_raw));
unsigned short int* address_as_short = reinterpret_cast<unsigned short int*>(address);
// Align to 4 bytes
unsigned int* aligned_addr =
__builtin_bit_cast(unsigned int*,
__builtin_bit_cast(unsigned long long int, address_as_short) &
(unsigned long long int)(~0x3));
unsigned int* aligned_addr = __builtin_bit_cast(
unsigned int*, __builtin_bit_cast(unsigned long long int, address_as_short) &
(unsigned long long int)(~0x3));
bool is_lower = __builtin_bit_cast(unsigned long long int, aligned_addr) ==
__builtin_bit_cast(unsigned long long int, address);
__builtin_bit_cast(unsigned long long int, address);
__hip_bfloat162 fval;
if (is_lower)
@@ -375,8 +375,7 @@ class coalesced_group : public thread_group {
friend __CG_QUALIFIER__ coalesced_group tiled_partition(const coalesced_group& parent,
unsigned int tile_size);
friend __CG_QUALIFIER__ coalesced_group binary_partition(const coalesced_group& cgrp, bool pred);
template <unsigned int fsize, class fparent>
friend __CG_QUALIFIER__ coalesced_group
template <unsigned int fsize, class fparent> friend __CG_QUALIFIER__ coalesced_group
binary_partition(const thread_block_tile<fsize, fparent>& tgrp, bool pred);
__CG_QUALIFIER__ coalesced_group new_tiled_group(unsigned int tile_size) const {
@@ -393,8 +392,8 @@ class coalesced_group : public thread_group {
unsigned int masklength =
min(static_cast<unsigned int>(num_threads()) - base_offset, tile_size);
lane_mask full_mask = (static_cast<int>(warpSize) == 32)
? static_cast<lane_mask>((1u << 32) - 1)
: static_cast<lane_mask>(-1ull);
? static_cast<lane_mask>((1u << 32) - 1)
: static_cast<lane_mask>(-1ull);
lane_mask member_mask = full_mask >> (warpSize - masklength);
member_mask <<= (__lane_id() & ~(tile_size - 1));
@@ -485,9 +484,9 @@ class coalesced_group : public thread_group {
srcRank = srcRank % static_cast<int>(num_threads());
int lane = (num_threads() == warpSize) ? srcRank
: (static_cast<int>(warpSize) == 64)
? __fns64(coalesced_info.member_mask, 0, (srcRank + 1))
: __fns32(coalesced_info.member_mask, 0, (srcRank + 1));
: (static_cast<int>(warpSize) == 64)
? __fns64(coalesced_info.member_mask, 0, (srcRank + 1))
: __fns32(coalesced_info.member_mask, 0, (srcRank + 1));
return __shfl(var, lane, warpSize);
}
@@ -835,8 +834,7 @@ template <unsigned int size> class thread_block_tile_base : public tile_base<siz
"Tile size is either not a power of 2 or greater than the wavefront size");
using tile_base<size>::numThreads;
template <unsigned int fsize, class fparent>
friend __CG_QUALIFIER__ coalesced_group
template <unsigned int fsize, class fparent> friend __CG_QUALIFIER__ coalesced_group
binary_partition(const thread_block_tile<fsize, fparent>& tgrp, bool pred);
#if !defined(HIP_DISABLE_WARP_SYNC_BUILTINS)
@@ -910,10 +908,10 @@ template <unsigned int tileSize, typename ParentCGTy> class parent_group_info {
* \note This type is implemented on Linux, under development
* on Microsoft Windows.
*/
template <unsigned int tileSize, class ParentCGTy>
class thread_block_tile_type : public thread_block_tile_base<tileSize>,
public tiled_group,
public parent_group_info<tileSize, ParentCGTy> {
template <unsigned int tileSize, class ParentCGTy> class thread_block_tile_type
: public thread_block_tile_base<tileSize>,
public tiled_group,
public parent_group_info<tileSize, ParentCGTy> {
_CG_STATIC_CONST_DECL_ unsigned int numThreads = tileSize;
typedef thread_block_tile_base<numThreads> tbtBase;
@@ -931,9 +929,8 @@ class thread_block_tile_type : public thread_block_tile_base<tileSize>,
};
// Partial template specialization
template <unsigned int tileSize>
class thread_block_tile_type<tileSize, void> : public thread_block_tile_base<tileSize>,
public tiled_group {
template <unsigned int tileSize> class thread_block_tile_type<tileSize, void>
: public thread_block_tile_base<tileSize>, public tiled_group {
_CG_STATIC_CONST_DECL_ unsigned int numThreads = tileSize;
typedef thread_block_tile_base<numThreads> tbtBase;
@@ -1013,11 +1010,10 @@ __CG_QUALIFIER__ coalesced_group tiled_partition(const coalesced_group& parent,
namespace impl {
template <unsigned int size, class ParentCGTy> class thread_block_tile_internal;
template <unsigned int size, class ParentCGTy>
class thread_block_tile_internal : public thread_block_tile_type<size, ParentCGTy> {
template <unsigned int size, class ParentCGTy> class thread_block_tile_internal
: public thread_block_tile_type<size, ParentCGTy> {
protected:
template <unsigned int tbtSize, class tbtParentT>
__CG_QUALIFIER__ thread_block_tile_internal(
template <unsigned int tbtSize, class tbtParentT> __CG_QUALIFIER__ thread_block_tile_internal(
const thread_block_tile_internal<tbtSize, tbtParentT>& g)
: thread_block_tile_type<size, ParentCGTy>(g.meta_group_rank(), g.meta_group_size()) {}
@@ -1034,8 +1030,8 @@ class thread_block_tile_internal : public thread_block_tile_type<size, ParentCGT
* \note This type is implemented on Linux, under development
* on Microsoft Windows.
*/
template <unsigned int size, class ParentCGTy>
class thread_block_tile : public impl::thread_block_tile_internal<size, ParentCGTy> {
template <unsigned int size, class ParentCGTy> class thread_block_tile
: public impl::thread_block_tile_internal<size, ParentCGTy> {
protected:
__CG_QUALIFIER__ thread_block_tile(const ParentCGTy& g)
: impl::thread_block_tile_internal<size, ParentCGTy>(g) {}
@@ -1171,8 +1167,8 @@ class thread_block_tile : public impl::thread_block_tile_internal<size, ParentCG
#endif
};
template <unsigned int size>
class thread_block_tile<size, void> : public impl::thread_block_tile_internal<size, void> {
template <unsigned int size> class thread_block_tile<size, void>
: public impl::thread_block_tile_internal<size, void> {
template <unsigned int, class ParentCGTy> friend class thread_block_tile;
protected:
@@ -1187,8 +1183,8 @@ template <unsigned int size, class ParentCGTy = void> class thread_block_tile;
namespace impl {
template <unsigned int size, class ParentCGTy> struct tiled_partition_internal;
template <unsigned int size>
struct tiled_partition_internal<size, thread_block> : public thread_block_tile<size, thread_block> {
template <unsigned int size> struct tiled_partition_internal<size, thread_block>
: public thread_block_tile<size, thread_block> {
__CG_QUALIFIER__ tiled_partition_internal(const thread_block& g)
: thread_block_tile<size, thread_block>(g) {}
};
@@ -82,8 +82,8 @@ namespace __hip_internal {
template <> struct is_floating_point<_Float16> : __hip_internal::true_type {};
} // namespace __hip_internal
template <bool cond, typename T = void>
using Enable_if_t = typename __hip_internal::enable_if<cond, T>::type;
template <bool cond, typename T = void> using Enable_if_t =
typename __hip_internal::enable_if<cond, T>::type;
// BEGIN STRUCT __HALF
struct __half {
@@ -649,7 +649,7 @@ inline __HOST_DEVICE__ bool __hgt(__half x, __half y) {
}
inline __HOST_DEVICE__ bool __hequ(__half x, __half y) {
return !(static_cast<__half_raw>(x).data < static_cast<__half_raw>(y).data) &&
!(static_cast<__half_raw>(x).data > static_cast<__half_raw>(y).data);
!(static_cast<__half_raw>(x).data > static_cast<__half_raw>(y).data);
}
inline __HOST_DEVICE__ bool __hneu(__half x, __half y) {
return !(static_cast<__half_raw>(x).data == static_cast<__half_raw>(y).data);
@@ -693,7 +693,7 @@ inline __HOST_DEVICE__ __half2 __hgt2(__half2 x, __half2 y) {
}
inline __HOST_DEVICE__ __half2 __hequ2(__half2 x, __half2 y) {
auto r = !(static_cast<__half2_raw>(x).data < static_cast<__half2_raw>(y).data) &&
!(static_cast<__half2_raw>(x).data > static_cast<__half2_raw>(y).data);
!(static_cast<__half2_raw>(x).data > static_cast<__half2_raw>(y).data);
return __builtin_convertvector(-r, _Float16_2);
}
inline __HOST_DEVICE__ __half2 __hneu2(__half2 x, __half2 y) {
@@ -911,13 +911,12 @@ inline __device__ __half unsafeAtomicAdd(__half* address, __half value) {
static_assert(sizeof(unsigned short int) == sizeof(__half_raw));
unsigned short int* address_as_short = reinterpret_cast<unsigned short int*>(address);
// Align to 4 bytes
unsigned int* aligned_addr =
__builtin_bit_cast(unsigned int*,
__builtin_bit_cast(unsigned long long int, address_as_short) &
(unsigned long long int)(~0x3));
unsigned int* aligned_addr = __builtin_bit_cast(
unsigned int*, __builtin_bit_cast(unsigned long long int, address_as_short) &
(unsigned long long int)(~0x3));
bool is_lower = __builtin_bit_cast(unsigned long long int, aligned_addr) ==
__builtin_bit_cast(unsigned long long int, address);
__builtin_bit_cast(unsigned long long int, address);
__half2 fval;
if (is_lower)
fval = __halves2half2(value, __float2half(0.0f));
@@ -327,8 +327,8 @@ where exponent==0 (actual exponent -14) and highest bit of mantissa is 1 are bf8
this case, the fp16 mantissa should be shift left by 1 */
act_exponent = exponent - bias + 1;
exponent_diff = f8_denormal_act_exponent -
act_exponent; // actual exponent is exponent-bias+1 as it is denormal
} else { // fp32/fp16 is normal with implicit 1
act_exponent; // actual exponent is exponent-bias+1 as it is denormal
} else { // fp32/fp16 is normal with implicit 1
act_exponent = exponent - bias;
if (act_exponent <= f8_denormal_act_exponent) {
/* This is the case where fp32/fp16 is normal but it is in f8 denormal range.
@@ -345,7 +345,7 @@ So for fp32/fp16, exponent -8 is the cut point to convert to fp8 nanoo */
}
bool midpoint = (mantissa & ((1ull << (mfmt - wm + exponent_diff)) - 1)) ==
(1ull << (mfmt - wm + exponent_diff - 1));
(1ull << (mfmt - wm + exponent_diff - 1));
/* This part is a bit tricky. The judgment of whether it is a tie needs to be done before we shift
right as shift right could rip off some residual part and make something not midpoint look like
midpoint. For example, the fp16 number 0x1002 (0 00100 0000000010), it is larger than midpoint, but
@@ -400,9 +400,9 @@ after shift right by 4 bits, it would look like midpoint.
// The conversion function is from rocblas
// https://github.com/ROCm/rocBLAS/blob/9b7f692abe3c54b88d1e77e045a7db7f1f188b69/library/include/internal/rocblas_hip_f8_impl.h#L220
// This has been modified to handle double types as well
template <typename T, bool is_fnuz>
__FP8_HOST_DEVICE_STATIC__ T cast_from_f8(__hip_fp8_storage_t x, int wm, int we,
bool clip = false) {
template <typename T, bool is_fnuz> __FP8_HOST_DEVICE_STATIC__ T cast_from_f8(__hip_fp8_storage_t x,
int wm, int we,
bool clip = false) {
#if defined(__clang__) and defined(__HIP__)
constexpr bool is_half = __hip_internal::is_same<T, _Float16>::value;
constexpr bool is_float = __hip_internal::is_same<T, float>::value;
@@ -576,14 +576,15 @@ static __device__ __hip_fp8_storage_t cast_to_f8_from_f32(float v, bool saturate
if (stochastic_rounding) {
ival = (interpret == __HIP_E4M3_FNUZ) || (interpret == __HIP_E4M3)
? __builtin_amdgcn_cvt_sr_fp8_f32(val.fval, rng, ival, 0)
: __builtin_amdgcn_cvt_sr_bf8_f32(val.fval, rng, ival, 0); // 0 pos
? __builtin_amdgcn_cvt_sr_fp8_f32(val.fval, rng, ival, 0)
: __builtin_amdgcn_cvt_sr_bf8_f32(val.fval, rng, ival, 0); // 0 pos
val.i32val = ival;
i8data = val.i8val[0]; // little endian
} else { // RNE CVT
ival = (interpret == __HIP_E4M3_FNUZ) || (interpret == __HIP_E4M3)
? __builtin_amdgcn_cvt_pk_fp8_f32(val.fval, val.fval, ival, false)
: __builtin_amdgcn_cvt_pk_bf8_f32(val.fval, val.fval, ival, false); // false -> WORD0
ival =
(interpret == __HIP_E4M3_FNUZ) || (interpret == __HIP_E4M3)
? __builtin_amdgcn_cvt_pk_fp8_f32(val.fval, val.fval, ival, false)
: __builtin_amdgcn_cvt_pk_bf8_f32(val.fval, val.fval, ival, false); // false -> WORD0
val.i32val = ival;
i8data = val.i8val[0];
}
@@ -628,8 +629,8 @@ cast_to_f8x2_from_f32x2(float2 v, bool saturate, __hip_fp8_interpretation_t inte
}
f2val.i32val[0] = (interpret == __HIP_E4M3_FNUZ) || (interpret == __HIP_E4M3)
? __builtin_amdgcn_cvt_pk_fp8_f32(v.x, v.y, 0, false)
: __builtin_amdgcn_cvt_pk_bf8_f32(v.x, v.y, 0, false);
? __builtin_amdgcn_cvt_pk_fp8_f32(v.x, v.y, 0, false)
: __builtin_amdgcn_cvt_pk_bf8_f32(v.x, v.y, 0, false);
return static_cast<__hip_fp8x2_storage_t>(f2val.i16val[0]);
}
@@ -643,8 +644,8 @@ static __device__ float cast_to_f32_from_f8(__hip_fp8_storage_t v,
val.i8val[0] = v;
float fval = (interpret == __HIP_E4M3_FNUZ) || (interpret == __HIP_E4M3)
? __builtin_amdgcn_cvt_f32_fp8(val.i32val, 0)
: __builtin_amdgcn_cvt_f32_bf8(val.i32val, 0);
? __builtin_amdgcn_cvt_f32_fp8(val.i32val, 0)
: __builtin_amdgcn_cvt_f32_bf8(val.i32val, 0);
return fval;
}
@@ -657,8 +658,8 @@ static __device__ float2 cast_to_f32x2_from_f8x2(__hip_fp8x2_storage_t v,
val.i16val[0] = v;
auto f2 = (interpret == __HIP_E4M3_FNUZ) || (interpret == __HIP_E4M3)
? __builtin_amdgcn_cvt_pk_f32_fp8(val.i32val, false)
: __builtin_amdgcn_cvt_pk_f32_bf8(val.i32val, false);
? __builtin_amdgcn_cvt_pk_f32_fp8(val.i32val, false)
: __builtin_amdgcn_cvt_pk_f32_bf8(val.i32val, false);
return float2{f2[0], f2[1]};
}
#endif // HIP_FP8_CVT_FAST_PATH
@@ -672,9 +673,9 @@ __FP8_HOST_DEVICE_STATIC__ bool hip_fp8_fnuz_is_nan(__hip_fp8_storage_t a) {
__FP8_HOST_DEVICE_STATIC__ bool hip_fp8_ocp_is_nan(__hip_fp8_storage_t a,
const __hip_fp8_interpretation_t type) {
return (type == __HIP_E4M3) ? ((a & 0x7f) == 0x7f)
: (type == __HIP_E5M2) ? ((a & 0x7f) > 0x7c)
: false;
return (type == __HIP_E4M3) ? ((a & 0x7f) == 0x7f)
: (type == __HIP_E5M2) ? ((a & 0x7f) > 0x7c)
: false;
}
__FP8_HOST_DEVICE_STATIC__ bool hip_fp8_ocp_is_inf(__hip_fp8_storage_t a,
@@ -334,13 +334,13 @@ __OCP_FP_HOST_DEVICE_STATIC__ float __amd_cvt_fp8_to_float_scale(
const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_f32_fp8(val, __amd_scale_to_float(scale), 0)
: __builtin_amdgcn_cvt_scalef32_f32_bf8(val, __amd_scale_to_float(scale), 0);
? __builtin_amdgcn_cvt_scalef32_f32_fp8(val, __amd_scale_to_float(scale), 0)
: __builtin_amdgcn_cvt_scalef32_f32_bf8(val, __amd_scale_to_float(scale), 0);
#else
using namespace fcbx;
return interpret == __AMD_OCP_E4M3
? to_float<float, Encoding::E4M3, true>(static_cast<uint32_t>(val), scale)
: to_float<float, Encoding::E5M2, true>(static_cast<uint32_t>(val), scale);
? to_float<float, Encoding::E4M3, true>(static_cast<uint32_t>(val), scale)
: to_float<float, Encoding::E5M2, true>(static_cast<uint32_t>(val), scale);
#endif
}
@@ -378,8 +378,8 @@ __amd_cvt_float_to_fp8_sr_scale(const float val, const __amd_fp8_interpretation_
} u{0};
using namespace fcbx;
u.ui32t = interpret == __AMD_OCP_E4M3
? from_float_sr<float, Encoding::E4M3, true>(val, seed, scale)
: from_float_sr<float, Encoding::E5M2, true>(val, seed, scale);
? from_float_sr<float, Encoding::E4M3, true>(val, seed, scale)
: from_float_sr<float, Encoding::E5M2, true>(val, seed, scale);
return u.fp8[0];
#endif
}
@@ -548,8 +548,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_floatx2_storage_t __amd_cvt_fp8x2_to_floatx2
const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_f32_fp8(val, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_f32_bf8(val, __amd_scale_to_float(scale), false);
? __builtin_amdgcn_cvt_scalef32_pk_f32_fp8(val, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_f32_bf8(val, __amd_scale_to_float(scale), false);
#else
using namespace fcbx;
__amd_floatx2_storage_t ret;
@@ -582,10 +582,10 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp8x2_storage_t __amd_cvt_floatx2_to_fp8x2_s
__amd_fp8x2_storage_t fp8x2[2];
} u{0};
u.shortx2 = interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_fp8_f32(u.shortx2, val[0], val[1],
__amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_f32(u.shortx2, val[0], val[1],
__amd_scale_to_float(scale), false);
? __builtin_amdgcn_cvt_scalef32_pk_fp8_f32(u.shortx2, val[0], val[1],
__amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_f32(u.shortx2, val[0], val[1],
__amd_scale_to_float(scale), false);
return u.fp8x2[0];
#else
using namespace fcbx;
@@ -679,8 +679,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp16x2_storage_t __amd_cvt_fp8x2_to_fp16x2_s
} u;
u.fp8x2[0] = val;
return interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_f16_fp8(u.ui32, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_f16_bf8(u.ui32, __amd_scale_to_float(scale), false);
? __builtin_amdgcn_cvt_scalef32_pk_f16_fp8(u.ui32, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_f16_bf8(u.ui32, __amd_scale_to_float(scale), false);
#else
using namespace fcbx;
__amd_fp16x2_storage_t ret;
@@ -787,8 +787,9 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_bf16x2_storage_t __amd_cvt_fp8x2_to_bf16x2_s
} u;
u.fp8x2[0] = in;
return interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_bf16_fp8(u.ui32, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf16_bf8(u.ui32, __amd_scale_to_float(scale), false);
? __builtin_amdgcn_cvt_scalef32_pk_bf16_fp8(u.ui32, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf16_bf8(u.ui32, __amd_scale_to_float(scale),
false);
#else
using namespace fcbx;
__amd_bf16x2_storage_t ret;
@@ -891,8 +892,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp16x32_storage_t __amd_cvt_fp6x32_to_fp16x3
#if HIP_ENABLE_GFX950_OCP_BUILTINS
// gfx950 expects scale to be in float
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_pk32_f16_fp6(in, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_pk32_f16_bf6(in, __amd_scale_to_float(scale));
? __builtin_amdgcn_cvt_scalef32_pk32_f16_fp6(in, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_pk32_f16_bf6(in, __amd_scale_to_float(scale));
#else
using namespace fcbx;
if (interpret == __AMD_OCP_E2M3) {
@@ -918,8 +919,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_bf16x32_storage_t __amd_cvt_fp6x32_to_bf16x3
const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_pk32_bf16_fp6(in, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_pk32_bf16_bf6(in, __amd_scale_to_float(scale));
? __builtin_amdgcn_cvt_scalef32_pk32_bf16_fp6(in, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_pk32_bf16_bf6(in, __amd_scale_to_float(scale));
#else
using namespace fcbx;
if (interpret == __AMD_OCP_E2M3) {
@@ -937,15 +938,15 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_floatx32_storage_t __amd_cvt_fp6x32_to_float
const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_pk32_f32_fp6(val, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_pk32_f32_bf6(val, __amd_scale_to_float(scale));
? __builtin_amdgcn_cvt_scalef32_pk32_f32_fp6(val, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_pk32_f32_bf6(val, __amd_scale_to_float(scale));
#else
using namespace fcbx;
return interpret == __AMD_OCP_E2M3
? fp6_cvt_packedx32<__amd_fp6x32_storage_t, __amd_floatx32_storage_t, float, Encoding::E2M3,
Encoding::IEEE754>(val, scale)
: fp6_cvt_packedx32<__amd_fp6x32_storage_t, __amd_floatx32_storage_t, float, Encoding::E3M2,
Encoding::IEEE754>(val, scale);
? fp6_cvt_packedx32<__amd_fp6x32_storage_t, __amd_floatx32_storage_t, float,
Encoding::E2M3, Encoding::IEEE754>(val, scale)
: fp6_cvt_packedx32<__amd_fp6x32_storage_t, __amd_floatx32_storage_t, float,
Encoding::E3M2, Encoding::IEEE754>(val, scale);
#endif
}
@@ -1200,9 +1201,10 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp8x2_storage_t __amd_cvt_fp16x2_to_fp8x2_sc
__amd_shortx2_storage_t shortx2;
__amd_fp8x2_storage_t fp8x2[2];
} u{0};
u.shortx2 = interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_fp8_f16(u.shortx2, in, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_f16(u.shortx2, in, __amd_scale_to_float(scale), false);
u.shortx2 = interpret == __AMD_OCP_E4M3 ? __builtin_amdgcn_cvt_scalef32_pk_fp8_f16(
u.shortx2, in, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_f16(
u.shortx2, in, __amd_scale_to_float(scale), false);
return u.fp8x2[0];
#else
static_assert(sizeof(__amd_fp8x2_storage_t[2]) == sizeof(uint32_t));
@@ -1241,10 +1243,10 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp8x2_storage_t __amd_cvt_bf16x2_to_fp8x2_sc
__amd_shortx2_storage_t shortx2;
__amd_fp8x2_storage_t fp8x2[2];
} u{0};
u.shortx2 = interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_fp8_bf16(u.shortx2, in, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_bf16(u.shortx2, in, __amd_scale_to_float(scale),
false);
u.shortx2 = interpret == __AMD_OCP_E4M3 ? __builtin_amdgcn_cvt_scalef32_pk_fp8_bf16(
u.shortx2, in, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_bf16(
u.shortx2, in, __amd_scale_to_float(scale), false);
return u.fp8x2[0];
#else
using namespace fcbx;
@@ -1429,9 +1431,10 @@ __amd_cvt_fp8_to_fp16_scale(const __amd_fp8_storage_t val,
const __amd_fp8_interpretation_t interpret, const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
__amd_fp16x2_storage_t ret;
ret = interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_f16_fp8(ret, val, __amd_scale_to_float(scale), 0, false)
: __builtin_amdgcn_cvt_scalef32_f16_bf8(ret, val, __amd_scale_to_float(scale), 0, false);
ret =
interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_f16_fp8(ret, val, __amd_scale_to_float(scale), 0, false)
: __builtin_amdgcn_cvt_scalef32_f16_bf8(ret, val, __amd_scale_to_float(scale), 0, false);
return ret[0];
#else
using namespace fcbx;
@@ -1463,9 +1466,10 @@ __amd_cvt_fp8_to_bf16_scale(const __amd_fp8_storage_t val,
unsigned int ui32;
} u{0};
u.fp8[0] = val;
auto ret = interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_bf16_fp8(u.ui32, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf16_bf8(u.ui32, __amd_scale_to_float(scale), false);
auto ret =
interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_bf16_fp8(u.ui32, __amd_scale_to_float(scale), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf16_bf8(u.ui32, __amd_scale_to_float(scale), false);
return ret[0];
#else
using namespace fcbx;
@@ -1491,8 +1495,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp6x32_storage_t __amd_cvt_floatx16_floatx16
const __amd_fp6_interpretation_t interpret, const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_2xpk16_fp6_f32(in1, in2, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_2xpk16_bf6_f32(in1, in2, __amd_scale_to_float(scale));
? __builtin_amdgcn_cvt_scalef32_2xpk16_fp6_f32(in1, in2, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_2xpk16_bf6_f32(in1, in2, __amd_scale_to_float(scale));
#else
__amd_floatx32_storage_t tmp;
for (size_t i = 0; i < 16; i++) {
@@ -1503,10 +1507,10 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp6x32_storage_t __amd_cvt_floatx16_floatx16
}
using namespace fcbx;
return interpret == __AMD_OCP_E2M3
? fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E2M3>(tmp, scale)
: fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E3M2>(tmp, scale);
? fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E2M3>(tmp, scale)
: fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E3M2>(tmp, scale);
#endif
}
@@ -1529,15 +1533,15 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp6x32_storage_t __amd_cvt_floatx32_to_fp6x3
in2 = {val[16], val[17], val[18], val[19], val[20], val[21], val[22], val[23],
val[24], val[25], val[26], val[27], val[28], val[29], val[30], val[31]};
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_2xpk16_fp6_f32(in1, in2, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_2xpk16_bf6_f32(in1, in2, __amd_scale_to_float(scale));
? __builtin_amdgcn_cvt_scalef32_2xpk16_fp6_f32(in1, in2, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_2xpk16_bf6_f32(in1, in2, __amd_scale_to_float(scale));
#else
using namespace fcbx;
return interpret == __AMD_OCP_E2M3
? fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E2M3>(val, scale)
: fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E3M2>(val, scale);
? fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E2M3>(val, scale)
: fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E3M2>(val, scale);
#endif
}
@@ -1555,16 +1559,17 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp6x32_storage_t __amd_cvt_floatx32_to_fp6x3
const unsigned int round, const __amd_scale_t scale) {
#if __has_builtin(__builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_f32) and \
__has_builtin(__builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_f32)
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_f32(val, round, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_f32(val, round, __amd_scale_to_float(scale));
return interpret == __AMD_OCP_E2M3 ? __builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_f32(
val, round, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_f32(
val, round, __amd_scale_to_float(scale));
#else
using namespace fcbx;
return interpret == __AMD_OCP_E2M3
? fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E2M3, true>(val, scale, round)
: fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E3M2, true>(val, scale, round);
? fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E2M3, true>(val, scale, round)
: fp6_cvt_packedx32<__amd_floatx32_storage_t, __amd_fp6x32_storage_t, float,
Encoding::IEEE754, Encoding::E3M2, true>(val, scale, round);
#endif
}
@@ -1638,16 +1643,17 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp6x32_storage_t __amd_cvt_fp16x32_to_fp6x32
const unsigned int round, const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_f16(in, round, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_f16(in, round, __amd_scale_to_float(scale));
? __builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_f16(in, round, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_f16(in, round,
__amd_scale_to_float(scale));
#else
return interpret == __AMD_OCP_E2M3
? fcbx::fp6_cvt_packedx32<__amd_fp16x32_storage_t, __amd_fp6x32_storage_t,
__amd_fp16_storage_t, fcbx::Encoding::E5M10, fcbx::Encoding::E2M3,
true>(in, scale, round)
: fcbx::fp6_cvt_packedx32<__amd_fp16x32_storage_t, __amd_fp6x32_storage_t,
__amd_fp16_storage_t, fcbx::Encoding::E5M10, fcbx::Encoding::E3M2,
true>(in, scale, round);
? fcbx::fp6_cvt_packedx32<__amd_fp16x32_storage_t, __amd_fp6x32_storage_t,
__amd_fp16_storage_t, fcbx::Encoding::E5M10,
fcbx::Encoding::E2M3, true>(in, scale, round)
: fcbx::fp6_cvt_packedx32<__amd_fp16x32_storage_t, __amd_fp6x32_storage_t,
__amd_fp16_storage_t, fcbx::Encoding::E5M10,
fcbx::Encoding::E3M2, true>(in, scale, round);
#endif
}
@@ -1655,17 +1661,18 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp6x32_storage_t __amd_cvt_bf16x32_to_fp6x32
const __amd_bf16x32_storage_t in, const __amd_fp6_interpretation_t interpret,
const unsigned int round, const __amd_scale_t scale) {
#if HIP_ENABLE_GFX950_OCP_BUILTINS
return interpret == __AMD_OCP_E2M3
? __builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_bf16(in, round, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_bf16(in, round, __amd_scale_to_float(scale));
return interpret == __AMD_OCP_E2M3 ? __builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_bf16(
in, round, __amd_scale_to_float(scale))
: __builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_bf16(
in, round, __amd_scale_to_float(scale));
#else
return interpret == __AMD_OCP_E2M3
? fcbx::fp6_cvt_packedx32<__amd_bf16x32_storage_t, __amd_fp6x32_storage_t,
__amd_bf16_storage_t, fcbx::Encoding::E8M7, fcbx::Encoding::E2M3,
true>(in, scale, round)
: fcbx::fp6_cvt_packedx32<__amd_bf16x32_storage_t, __amd_fp6x32_storage_t,
__amd_bf16_storage_t, fcbx::Encoding::E8M7, fcbx::Encoding::E3M2,
true>(in, scale, round);
? fcbx::fp6_cvt_packedx32<__amd_bf16x32_storage_t, __amd_fp6x32_storage_t,
__amd_bf16_storage_t, fcbx::Encoding::E8M7,
fcbx::Encoding::E2M3, true>(in, scale, round)
: fcbx::fp6_cvt_packedx32<__amd_bf16x32_storage_t, __amd_fp6x32_storage_t,
__amd_bf16_storage_t, fcbx::Encoding::E8M7,
fcbx::Encoding::E3M2, true>(in, scale, round);
#endif
}
@@ -2542,8 +2549,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp16x2_storage_t __amd_cvt_fp8x2_to_fp16x2(
} u;
u.fp8x2[0] = val;
return interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_f16_fp8(u.ui32, __amd_scale_to_float(0), false)
: __builtin_amdgcn_cvt_scalef32_pk_f16_bf8(u.ui32, __amd_scale_to_float(0), false);
? __builtin_amdgcn_cvt_scalef32_pk_f16_fp8(u.ui32, __amd_scale_to_float(0), false)
: __builtin_amdgcn_cvt_scalef32_pk_f16_bf8(u.ui32, __amd_scale_to_float(0), false);
#else
using namespace fcbx;
__amd_fp16x2_storage_t ret;
@@ -2573,9 +2580,10 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp8x2_storage_t __amd_cvt_fp16x2_to_fp8x2(
__amd_shortx2_storage_t shortx2;
__amd_fp8x2_storage_t fp8x2[2];
} u{0};
u.shortx2 = interpret == __AMD_OCP_E4M3
? __builtin_amdgcn_cvt_scalef32_pk_fp8_f16(u.shortx2, val, __amd_scale_to_float(0), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_f16(u.shortx2, val, __amd_scale_to_float(0), false);
u.shortx2 = interpret == __AMD_OCP_E4M3 ? __builtin_amdgcn_cvt_scalef32_pk_fp8_f16(
u.shortx2, val, __amd_scale_to_float(0), false)
: __builtin_amdgcn_cvt_scalef32_pk_bf8_f16(
u.shortx2, val, __amd_scale_to_float(0), false);
return u.fp8x2[0];
#else
using namespace fcbx;
@@ -2783,8 +2791,8 @@ __OCP_FP_HOST_DEVICE_STATIC__ __amd_fp8_storage_t __amd_cvt_fp16_to_fp8_sr(
#else
using namespace fcbx;
return interpret == __AMD_OCP_E4M3
? from_float_sr<__amd_fp16_storage_t, Encoding::E4M3, true>(val, sr, 0)
: from_float_sr<__amd_fp16_storage_t, Encoding::E5M2, true>(val, sr, 0);
? from_float_sr<__amd_fp16_storage_t, Encoding::E4M3, true>(val, sr, 0)
: from_float_sr<__amd_fp16_storage_t, Encoding::E5M2, true>(val, sr, 0);
#endif
}
@@ -719,8 +719,8 @@ struct __hipext_ocp_fp6x32_e2m3 {
}
#endif
__OCP_FP_HOST_DEVICE__ __hipext_ocp_fp6x32_e2m3(const __amd_fp16x32_storage_t in,
const __amd_scale_t scale)
__OCP_FP_HOST_DEVICE__
__hipext_ocp_fp6x32_e2m3(const __amd_fp16x32_storage_t in, const __amd_scale_t scale)
#if HIP_ENABLE_GFX950_OCP_BUILTINS
: __x(__builtin_amdgcn_cvt_scalef32_pk32_fp6_f16(in, __amd_scale_to_float(scale))){}
#else
@@ -742,8 +742,8 @@ struct __hipext_ocp_fp6x32_e2m3 {
}
#endif
__OCP_FP_HOST_DEVICE__
__hipext_ocp_fp6x32_e2m3(const __amd_bf16x32_storage_t in, const __amd_scale_t scale)
__OCP_FP_HOST_DEVICE__ __hipext_ocp_fp6x32_e2m3(const __amd_bf16x32_storage_t in,
const __amd_scale_t scale)
#if HIP_ENABLE_GFX950_OCP_BUILTINS
: __x(__builtin_amdgcn_cvt_scalef32_pk32_fp6_bf16(in, __amd_scale_to_float(scale))){}
#else
@@ -832,8 +832,8 @@ struct __hipext_ocp_fp6x32_e3m2 {
}
#endif
__OCP_FP_HOST_DEVICE__ __hipext_ocp_fp6x32_e3m2(const __amd_fp16x32_storage_t in,
const __amd_scale_t scale)
__OCP_FP_HOST_DEVICE__
__hipext_ocp_fp6x32_e3m2(const __amd_fp16x32_storage_t in, const __amd_scale_t scale)
#if HIP_ENABLE_GFX950_OCP_BUILTINS
: __x(__builtin_amdgcn_cvt_scalef32_pk32_bf6_f16(in, __amd_scale_to_float(scale))){}
#else
@@ -855,8 +855,8 @@ struct __hipext_ocp_fp6x32_e3m2 {
}
#endif
__OCP_FP_HOST_DEVICE__ __hipext_ocp_fp6x32_e3m2(const __amd_bf16x32_storage_t in,
const __amd_scale_t scale)
__OCP_FP_HOST_DEVICE__
__hipext_ocp_fp6x32_e3m2(const __amd_bf16x32_storage_t in, const __amd_scale_t scale)
#if HIP_ENABLE_GFX950_OCP_BUILTINS
: __x(__builtin_amdgcn_cvt_scalef32_pk32_bf6_bf16(in, __amd_scale_to_float(scale))){}
#else
@@ -793,11 +793,11 @@ __OCP_FP_HOST_DEVICE_STATIC__ OutType fp6_cvt_packedx32(InType in, int8_t scale
uint32_t seed = 0) {
// This is tightly coupled with the definitions of the amd_ocp_types
constexpr bool in_float = std::is_same<InType, __amd_floatx32_storage_t>::value ||
std::is_same<InType, __amd_fp16x32_storage_t>::value ||
std::is_same<InType, __amd_bf16x32_storage_t>::value;
std::is_same<InType, __amd_fp16x32_storage_t>::value ||
std::is_same<InType, __amd_bf16x32_storage_t>::value;
constexpr bool out_float = std::is_same<OutType, __amd_floatx32_storage_t>::value ||
std::is_same<OutType, __amd_fp16x32_storage_t>::value ||
std::is_same<OutType, __amd_bf16x32_storage_t>::value;
std::is_same<OutType, __amd_fp16x32_storage_t>::value ||
std::is_same<OutType, __amd_bf16x32_storage_t>::value;
using other_type = std::conditional<in_float, OutType, InType>::type;
struct fp6x32_packed {
@@ -314,9 +314,8 @@ __device__ inline double unsafeAtomicMin(double* addr, double val) {
* @return Original value contained in \p addr.
*/
__device__ inline float safeAtomicAdd(float* addr, float value) {
#if defined(__gfx908__) || \
((defined(__gfx90a__) || defined(__gfx942__) || defined(__gfx950__)) && \
!__has_builtin(__hip_atomic_fetch_add))
#if defined(__gfx908__) || ((defined(__gfx90a__) || defined(__gfx942__) || defined(__gfx950__)) && \
!__has_builtin(__hip_atomic_fetch_add))
// On gfx908, we can generate unsafe FP32 atomic add that does not follow all
// IEEE rules when -munsafe-fp-atomics is passed. Do a CAS loop emulation instead.
// On gfx90a, gfx942 and gfx950 if we do not have the __hip_atomic_fetch_add builtin, we
@@ -59,9 +59,9 @@ template <typename T, unsigned int n> struct HIP_vector_base;
template <typename T, unsigned int rank> struct HIP_vector_type;
namespace hip_impl {
template <typename T, unsigned int n>
__attribute__((always_inline)) __HOST_DEVICE__ typename HIP_vector_base<T, n>::Native_vec_*
get_native_pointer(HIP_vector_base<T, n>& base_vec) {
template <typename T, unsigned int n> __attribute__((always_inline)) __HOST_DEVICE__
typename HIP_vector_base<T, n>::Native_vec_*
get_native_pointer(HIP_vector_base<T, n>& base_vec) {
static_assert(sizeof(base_vec) == sizeof(typename HIP_vector_base<T, n>::Native_vec_));
static_assert(__hip_internal::alignment_of<HIP_vector_base<T, n>>::value ==
__hip_internal::alignment_of<typename HIP_vector_base<T, n>::Native_vec_>::value);
@@ -78,9 +78,9 @@ get_native_pointer(const HIP_vector_base<T, n>& base_vec) {
};
} // Namespace hip_impl.
template <typename T, unsigned int n>
__attribute__((always_inline)) __HOST_DEVICE__ typename HIP_vector_base<T, n>::Native_vec_&
get_native_vector(HIP_vector_base<T, n>& base_vec) {
template <typename T, unsigned int n> __attribute__((always_inline)) __HOST_DEVICE__
typename HIP_vector_base<T, n>::Native_vec_&
get_native_vector(HIP_vector_base<T, n>& base_vec) {
return *hip_impl::get_native_pointer(base_vec);
};
@@ -308,9 +308,8 @@ template <typename T, unsigned int rank> struct HIP_vector_type : public HIP_vec
__HOST_DEVICE__
HIP_vector_type() = default;
template <typename U,
typename __hip_internal::enable_if<__hip_internal::is_convertible<U, T>::value>::type* =
nullptr>
template <typename U, typename __hip_internal::enable_if<
__hip_internal::is_convertible<U, T>::value>::type* = nullptr>
__HOST_DEVICE__ explicit constexpr HIP_vector_type(U x_) noexcept
: HIP_vector_base<T, rank>{static_cast<T>(x_)} {}
template < // TODO: constrain based on type as well.
@@ -368,9 +367,8 @@ template <typename T, unsigned int rank> struct HIP_vector_type : public HIP_vec
#endif
return *this;
}
template <
typename U,
typename __hip_internal::enable_if<__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
template <typename U, typename __hip_internal::enable_if<
__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
__HOST_DEVICE__ HIP_vector_type& operator+=(U x) noexcept {
return *this += make_vector_type<T, rank>(x);
}
@@ -383,9 +381,8 @@ template <typename T, unsigned int rank> struct HIP_vector_type : public HIP_vec
#endif
return *this;
}
template <
typename U,
typename __hip_internal::enable_if<__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
template <typename U, typename __hip_internal::enable_if<
__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
__HOST_DEVICE__ HIP_vector_type& operator-=(U x) noexcept {
return *this -= make_vector_type<T, rank>(x);
}
@@ -404,9 +401,8 @@ template <typename T, unsigned int rank> struct HIP_vector_type : public HIP_vec
return HIP_vector_type{x} *= y;
}
template <
typename U,
typename __hip_internal::enable_if<__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
template <typename U, typename __hip_internal::enable_if<
__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
__HOST_DEVICE__ HIP_vector_type& operator*=(U x) noexcept {
return *this *= make_vector_type<T, rank>(x);
}
@@ -424,9 +420,8 @@ template <typename T, unsigned int rank> struct HIP_vector_type : public HIP_vec
#endif
return *this;
}
template <
typename U,
typename __hip_internal::enable_if<__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
template <typename U, typename __hip_internal::enable_if<
__hip_internal::is_convertible<U, T>{}>::type* = nullptr>
__HOST_DEVICE__ HIP_vector_type& operator/=(U x) noexcept {
return *this /= make_vector_type<T, rank>(x);
}
@@ -576,8 +571,7 @@ __HOST_DEVICE__ inline constexpr HIP_vector_type<T, n> operator/(
return make_vector_type<T, n>(x) /= y;
}
template <typename T, unsigned int n>
__HOST_DEVICE__ inline
template <typename T, unsigned int n> __HOST_DEVICE__ inline
#if __cplusplus >= 201402L && !defined(__HIPCC_RTC__)
constexpr
#endif
@@ -109,9 +109,8 @@ static __HOST_DEVICE__ __forceinline__ int __hipGetPixelAddr(int x, int format,
* \param x [in] The coordinate where the value will be read out.
* \param boundaryMode [in] The boundary mode is currently ignored.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf1Dread(T* data, hipSurfaceObject_t surfObj, int x,
int boundaryMode = hipBoundaryModeZero) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT;
@@ -128,9 +127,8 @@ static __device__ __hip_img_chk__ void surf1Dread(T* data, hipSurfaceObject_t su
* \param surfObj [in] The surface descriptor.
* \param x [in] The coordinate where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf1Dwrite(T data, hipSurfaceObject_t surfObj, int x) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
x = __hipGetPixelAddr(x, __ockl_image_channel_data_type_1D(i), __ockl_image_channel_order_1D(i));
@@ -147,9 +145,8 @@ static __device__ __hip_img_chk__ void surf1Dwrite(T data, hipSurfaceObject_t su
* \param x [in] The x coordinate where the value will be read out.
* \param y [in] The y coordinate where the value will be read out.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf2Dread(T* data, hipSurfaceObject_t surfObj, int x,
int y) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -168,9 +165,8 @@ static __device__ __hip_img_chk__ void surf2Dread(T* data, hipSurfaceObject_t su
* \param x [in] The x coordinate where the data will be written.
* \param y [in] The y coordinate where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf2Dwrite(T data, hipSurfaceObject_t surfObj, int x,
int y) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -190,9 +186,8 @@ static __device__ __hip_img_chk__ void surf2Dwrite(T data, hipSurfaceObject_t su
* \param y [in] The y coordinate where the value will be read out.
* \param z [in] The z coordinate where the value will be read out.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf3Dread(T* data, hipSurfaceObject_t surfObj, int x, int y,
int z) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -212,9 +207,8 @@ static __device__ __hip_img_chk__ void surf3Dread(T* data, hipSurfaceObject_t su
* \param y [in] The y coordinate where the data will be written.
* \param z [in] The z coordinate where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf3Dwrite(T data, hipSurfaceObject_t surfObj, int x, int y,
int z) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -233,9 +227,8 @@ static __device__ __hip_img_chk__ void surf3Dwrite(T data, hipSurfaceObject_t su
* \param x [in] The coordinate where the value will be read out.
* \param layer [in] The layer index where the value will be read out.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf1DLayeredread(T* data, hipSurfaceObject_t surfObj, int x,
int layer) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -253,9 +246,8 @@ static __device__ __hip_img_chk__ void surf1DLayeredread(T* data, hipSurfaceObje
* \param x [in] The x coordinate where the data will be written.
* \param layer [in] The layer index where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf1DLayeredwrite(T data, hipSurfaceObject_t surfObj, int x,
int layer) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -274,9 +266,8 @@ static __device__ __hip_img_chk__ void surf1DLayeredwrite(T data, hipSurfaceObje
* \param y [in] The y coordinate where the value will be read out.
* \param layer [in] The layer index where the value will be read out.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf2DLayeredread(T* data, hipSurfaceObject_t surfObj, int x,
int y, int layer) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -296,9 +287,8 @@ static __device__ __hip_img_chk__ void surf2DLayeredread(T* data, hipSurfaceObje
* \param y [in] The y coordinate where the data will be written.
* \param layer [in] The layer index where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surf2DLayeredwrite(T data, hipSurfaceObject_t surfObj, int x,
int y, int layer) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -318,9 +308,8 @@ static __device__ __hip_img_chk__ void surf2DLayeredwrite(T data, hipSurfaceObje
* \param y [in] The y coordinate where the value will be read out.
* \param face [in] The face index where the value will be read out.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surfCubemapread(T* data, hipSurfaceObject_t surfObj, int x,
int y, int face) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -340,9 +329,8 @@ static __device__ __hip_img_chk__ void surfCubemapread(T* data, hipSurfaceObject
* \param y [in] The y coordinate where the data will be written.
* \param face [in] The face index where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surfCubemapwrite(T data, hipSurfaceObject_t surfObj, int x,
int y, int face) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -363,9 +351,8 @@ static __device__ __hip_img_chk__ void surfCubemapwrite(T data, hipSurfaceObject
* \param face [in] The face index where the value will be read out.
* \param layer [in] The layer index where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surfCubemapLayeredread(T* data, hipSurfaceObject_t surfObj,
int x, int y, int face, int layer) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -386,9 +373,8 @@ static __device__ __hip_img_chk__ void surfCubemapLayeredread(T* data, hipSurfac
* \param face [in] The face index where the data will be written.
* \param layer [in] The layer index where the data will be written.
*/
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void surfCubemapLayeredwrite(T* data, hipSurfaceObject_t surfObj,
int x, int y, int face, int layer) {
__HIP_SURFACE_OBJECT_PARAMETERS_INIT
@@ -443,7 +443,7 @@ __device__ inline T __reduce_op_sync(MaskT mask, T val, BinaryOp op, WfReduce wf
return backwardPermute(firstLane << 2, result);
else {
auto tmp = (static_cast<unsigned long long>(backwardPermute(firstLane << 2, result[1])) << 32) |
static_cast<unsigned int>(backwardPermute(firstLane << 2, result[0]));
static_cast<unsigned int>(backwardPermute(firstLane << 2, result[0]));
return *reinterpret_cast<T*>(&tmp);
}
}
@@ -130,12 +130,9 @@ inline hipError_t hipOccupancyMaxPotentialBlockSize(int* gridSize, int* blockSiz
blockSizeLimit);
}
template <class T>
inline hipError_t hipOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* blockSize,
T kernel,
size_t dynSharedMemPerBlk = 0,
int blockSizeLimit = 0,
unsigned int flags = 0) {
template <class T> inline hipError_t hipOccupancyMaxPotentialBlockSizeWithFlags(
int* gridSize, int* blockSize, T kernel, size_t dynSharedMemPerBlk = 0, int blockSizeLimit = 0,
unsigned int flags = 0) {
using namespace hip_impl;
hip_impl::hip_init();
@@ -51,11 +51,11 @@ namespace std { // TODO: these should be removed as soon as possible.
#if (__cplusplus < 201406L)
#if (__cplusplus < 201402L)
template <bool cond, typename T = void> using enable_if_t = typename enable_if<cond, T>::type;
template <bool cond, typename T, typename U>
using conditional_t = typename conditional<cond, T, U>::type;
template <bool cond, typename T, typename U> using conditional_t =
typename conditional<cond, T, U>::type;
template <typename T> using decay_t = typename decay<T>::type;
template <FunctionalProcedure F, typename... Ts>
using result_of_t = typename result_of<F(Ts...)>::type;
template <FunctionalProcedure F, typename... Ts> using result_of_t =
typename result_of<F(Ts...)>::type;
template <typename T> using remove_reference_t = typename remove_reference<T>::type;
#endif
#endif
@@ -67,8 +67,8 @@ template <typename...> using void_t_ = void;
#if HIP_HAS_INVOCABLE
template <typename, typename = void> struct is_callable_impl;
template <FunctionalProcedure F, typename... Ts>
struct is_callable_impl<F(Ts...)> : std::is_invocable<F, Ts...> {};
template <FunctionalProcedure F, typename... Ts> struct is_callable_impl<F(Ts...)>
: std::is_invocable<F, Ts...> {};
#elif HIP_HAS_RESULT_OF_SFINAE
template <typename, typename = void> struct is_callable_impl : std::false_type {};
@@ -76,11 +76,10 @@ template <FunctionalProcedure F, typename... Ts>
struct is_callable_impl<F(Ts...), void_t_<typename std::result_of<F(Ts...)>::type> >
: std::true_type {};
#else
template <class Base, class T, class Derived>
auto simple_invoke(T Base::* pmd, Derived&& ref) -> decltype(static_cast<Derived&&>(ref).*pmd);
template <class Base, class T, class Derived> auto simple_invoke(T Base::* pmd, Derived&& ref)
-> decltype(static_cast<Derived&&>(ref).*pmd);
template <class PMD, class Pointer>
auto simple_invoke(PMD&& pmd, Pointer&& ptr)
template <class PMD, class Pointer> auto simple_invoke(PMD&& pmd, Pointer&& ptr)
-> decltype((*static_cast<Pointer&&>(ptr)).*static_cast<PMD&&>(pmd));
template <class Base, class T, class Derived>
@@ -100,8 +99,8 @@ template <class Base, class T, class Derived, class... Args>
auto simple_invoke(T Base::* pmf, const std::reference_wrapper<Derived>& ref, Args&&... args)
-> decltype((ref.get().*pmf)(static_cast<Args&&>(args)...));
template <class F, class... Ts>
auto simple_invoke(F&& f, Ts&&... xs) -> decltype(f(static_cast<Ts&&>(xs)...));
template <class F, class... Ts> auto simple_invoke(F&& f, Ts&&... xs)
-> decltype(f(static_cast<Ts&&>(xs)...));
template <typename, typename = void> struct is_callable_impl : std::false_type {};
@@ -56,19 +56,19 @@ using lane_mask = unsigned long long int;
namespace cooperative_groups {
/* Global scope */
template <unsigned int size>
using is_power_of_2 = __hip_internal::integral_constant<bool, (size & (size - 1)) == 0>;
template <unsigned int size> using is_power_of_2 =
__hip_internal::integral_constant<bool, (size & (size - 1)) == 0>;
template <unsigned int size>
using is_valid_wavefront = __hip_internal::integral_constant<bool, size <= 64>;
template <unsigned int size> using is_valid_wavefront =
__hip_internal::integral_constant<bool, size <= 64>;
template <unsigned int size>
using is_valid_tile_size = __hip_internal::integral_constant<
bool, is_power_of_2<size>::value && is_valid_wavefront<size>::value>;
template <unsigned int size> using is_valid_tile_size =
__hip_internal::integral_constant<bool, is_power_of_2<size>::value &&
is_valid_wavefront<size>::value>;
template <typename T>
using is_valid_type = __hip_internal::integral_constant<
bool, __hip_internal::is_integral<T>::value || __hip_internal::is_floating_point<T>::value>;
template <typename T> using is_valid_type =
__hip_internal::integral_constant<bool, __hip_internal::is_integral<T>::value ||
__hip_internal::is_floating_point<T>::value>;
namespace internal {
@@ -8101,9 +8101,10 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
break;
// hipDeviceGetPCIBusId[('char*', 'pciBusId'), ('int', 'len'), ('int', 'device')]
case HIP_API_ID_hipDeviceGetPCIBusId:
data->args.hipDeviceGetPCIBusId.pciBusId = (data->args.hipDeviceGetPCIBusId.pciBusId)
? strdup(data->args.hipDeviceGetPCIBusId.pciBusId)
: NULL;
data->args.hipDeviceGetPCIBusId.pciBusId =
(data->args.hipDeviceGetPCIBusId.pciBusId)
? strdup(data->args.hipDeviceGetPCIBusId.pciBusId)
: NULL;
break;
// hipDeviceGetSharedMemConfig[('hipSharedMemConfig*', 'pConfig')]
case HIP_API_ID_hipDeviceGetSharedMemConfig:
@@ -8991,9 +8992,10 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
if (data->args.hipGraphInstantiate.pErrorNode)
data->args.hipGraphInstantiate.pErrorNode__val =
*(data->args.hipGraphInstantiate.pErrorNode);
data->args.hipGraphInstantiate.pLogBuffer = (data->args.hipGraphInstantiate.pLogBuffer)
? strdup(data->args.hipGraphInstantiate.pLogBuffer)
: NULL;
data->args.hipGraphInstantiate.pLogBuffer =
(data->args.hipGraphInstantiate.pLogBuffer)
? strdup(data->args.hipGraphInstantiate.pLogBuffer)
: NULL;
break;
// hipGraphInstantiateWithFlags[('hipGraphExec_t*', 'pGraphExec'), ('hipGraph_t', 'graph'),
// ('unsigned long long', 'flags')]
@@ -15959,9 +15961,8 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
oss, data->args.hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags.blockSize);
oss << ", dynSharedMemPerBlk=";
roctracer::hip_support::detail::operator<<(
oss,
data->args.hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags
.dynSharedMemPerBlk);
oss, data->args.hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags
.dynSharedMemPerBlk);
oss << ", flags=";
roctracer::hip_support::detail::operator<<(
oss, data->args.hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags.flags);
@@ -114,11 +114,11 @@ template <typename __T, typename __U> struct is_same : public false_type {};
template <typename __T> struct is_same<__T, __T> : public true_type {};
template <typename _Tp, bool = is_arithmetic<_Tp>::value> struct is_signed : public false_type {};
template <typename _Tp>
struct is_signed<_Tp, true> : public true_or_false_type<_Tp(-1) < _Tp(0)> {};
template <typename _Tp> struct is_signed<_Tp, true> : public true_or_false_type<_Tp(-1) < _Tp(0)> {
};
template <class T>
auto test_returnable(int) -> decltype(void(static_cast<T (*)()>(nullptr)), true_type{});
template <class T> auto test_returnable(int)
-> decltype(void(static_cast<T (*)()>(nullptr)), true_type{});
template <class> auto test_returnable(...) -> false_type;
template <class T> struct type_identity {
@@ -139,8 +139,7 @@ template <class T> struct add_rvalue_reference : decltype(try_add_rvalue_referen
template <typename T> typename add_rvalue_reference<T>::type declval() noexcept;
template <class From, class To>
auto test_implicitly_convertible(int)
template <class From, class To> auto test_implicitly_convertible(int)
-> decltype(void(declval<void (&)(To)>()(declval<From>())), true_type{});
template <class, class> auto test_implicitly_convertible(...) -> false_type;
@@ -160,12 +159,10 @@ template <class T> struct remove_cv<const volatile T> {
template <class T> struct is_void : public is_same<void, typename remove_cv<T>::type> {};
template <class From, class To>
struct is_convertible
: public integral_constant<bool,
(decltype(test_returnable<To>(0))::value &&
decltype(test_implicitly_convertible<From, To>(0))::value) ||
(is_void<From>::value && is_void<To>::value)> {};
template <class From, class To> struct is_convertible
: public integral_constant<bool, (decltype(test_returnable<To>(0))::value &&
decltype(test_implicitly_convertible<From, To>(0))::value) ||
(is_void<From>::value && is_void<To>::value)> {};
template <typename _CharT> struct char_traits;
template <typename _CharT, typename _Traits = char_traits<_CharT>> class basic_istream;
@@ -173,8 +170,8 @@ template <typename _CharT, typename _Traits = char_traits<_CharT>> class basic_o
typedef basic_istream<char> istream;
typedef basic_ostream<char> ostream;
template <typename _Tp>
struct is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> {};
template <typename _Tp> struct is_standard_layout
: public integral_constant<bool, __is_standard_layout(_Tp)> {};
template <typename _Tp> struct is_trivial : public integral_constant<bool, __is_trivial(_Tp)> {};
@@ -195,15 +192,15 @@ template <typename T, T... Ints> struct integer_sequence {
template <size_t... Ints> using index_sequence = integer_sequence<size_t, Ints...>;
template <size_t _hip_N, size_t... Ints>
struct make_index_sequence_impl : make_index_sequence_impl<_hip_N - 1, _hip_N - 1, Ints...> {};
template <size_t _hip_N, size_t... Ints> struct make_index_sequence_impl
: make_index_sequence_impl<_hip_N - 1, _hip_N - 1, Ints...> {};
template <size_t... Ints> struct make_index_sequence_impl<0, Ints...> {
using type = index_sequence<Ints...>;
};
template <size_t _hip_N>
using make_index_sequence = typename make_index_sequence_impl<_hip_N>::type;
template <size_t _hip_N> using make_index_sequence =
typename make_index_sequence_impl<_hip_N>::type;
template <size_t... Ints>
constexpr index_sequence<Ints...> make_index_sequence_value(index_sequence<Ints...>) {
@@ -61,9 +61,9 @@ template <typename C, typename D> RAII_guard<C, D> make_RAII_guard(const C& ctor
return RAII_guard<C, D>{ctor, std::move(dtor)};
}
template <FunctionalProcedure F, typename... Ts>
using is_new_grid_launch_t = typename std::conditional<is_callable<F(Ts...)>{}, New_grid_launch_tag,
Old_grid_launch_tag>::type;
template <FunctionalProcedure F, typename... Ts> using is_new_grid_launch_t =
typename std::conditional<is_callable<F(Ts...)>{}, New_grid_launch_tag,
Old_grid_launch_tag>::type;
} // namespace
// TODO: - dispatch rank should be derived from the domain dimensions passed
@@ -37,8 +37,8 @@ THE SOFTWARE.
(void)s;
template <typename T> struct __hip_is_tex_surf_scalar_channel_type {
static constexpr bool value = __hip_internal::is_same<T, char>::value ||
__hip_internal::is_same<T, unsigned char>::value ||
static constexpr bool value =
__hip_internal::is_same<T, char>::value || __hip_internal::is_same<T, unsigned char>::value ||
__hip_internal::is_same<T, short>::value ||
__hip_internal::is_same<T, unsigned short>::value || __hip_internal::is_same<T, int>::value ||
__hip_internal::is_same<T, unsigned int>::value || __hip_internal::is_same<T, float>::value;
@@ -51,12 +51,12 @@ template <typename T> struct __hip_is_tex_surf_channel_type {
template <typename T, unsigned int rank>
struct __hip_is_tex_surf_channel_type<HIP_vector_type<T, rank>> {
static constexpr bool value = __hip_is_tex_surf_scalar_channel_type<T>::value &&
((rank == 1) || (rank == 2) || (rank == 4));
((rank == 1) || (rank == 2) || (rank == 4));
};
template <typename T> struct __hip_is_tex_normalized_channel_type {
static constexpr bool value = __hip_internal::is_same<T, char>::value ||
__hip_internal::is_same<T, unsigned char>::value ||
static constexpr bool value =
__hip_internal::is_same<T, char>::value || __hip_internal::is_same<T, unsigned char>::value ||
__hip_internal::is_same<T, short>::value || __hip_internal::is_same<T, unsigned short>::value;
};
@@ -73,8 +73,7 @@ template <typename T, hipTextureReadMode readMode, typename Enable = void> struc
/*
* Map from device function return U to scalar texture type T
*/
template <typename T, typename U>
__forceinline__ __device__
template <typename T, typename U> __forceinline__ __device__
typename __hip_internal::enable_if<__hip_is_tex_surf_scalar_channel_type<T>::value,
const T>::type
__hipMapFrom(const U& u) {
@@ -96,8 +95,7 @@ __forceinline__ __device__
/*
* Map from device function return U to vector texture type T
*/
template <typename T, typename U>
__forceinline__ __device__ typename __hip_internal::enable_if<
template <typename T, typename U> __forceinline__ __device__ typename __hip_internal::enable_if<
__hip_is_tex_surf_scalar_channel_type<typename T::value_type>::value, const T>::type
__hipMapFrom(const U& u) {
if constexpr (sizeof(typename T::value_type) < sizeof(float)) {
@@ -118,8 +116,7 @@ __hipMapFrom(const U& u) {
/*
* Map from scalar texture type T to device function input U
*/
template <typename U, typename T>
__forceinline__ __device__
template <typename U, typename T> __forceinline__ __device__
typename __hip_internal::enable_if<__hip_is_tex_surf_scalar_channel_type<T>::value,
const U>::type
__hipMapTo(const T& t) {
@@ -143,8 +140,7 @@ __forceinline__ __device__
/*
* Map from vector texture type T to device function input U
*/
template <typename U, typename T>
__forceinline__ __device__ typename __hip_internal::enable_if<
template <typename U, typename T> __forceinline__ __device__ typename __hip_internal::enable_if<
__hip_is_tex_surf_scalar_channel_type<typename T::value_type>::value, const U>::type
__hipMapTo(const T& t) {
if constexpr (sizeof(typename T::value_type) < sizeof(float)) {
@@ -164,18 +160,16 @@ __hipMapTo(const T& t) {
}
}
template <typename T, hipTextureReadMode readMode>
using __hip_tex_ret_t = typename __hip_tex_ret<T, readMode, bool>::type;
template <typename T, hipTextureReadMode readMode> using __hip_tex_ret_t =
typename __hip_tex_ret<T, readMode, bool>::type;
template <typename T>
struct __hip_tex_ret<
template <typename T> struct __hip_tex_ret<
T, hipReadModeElementType,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value, bool>::type> {
using type = T;
};
template <typename T, unsigned int rank>
struct __hip_tex_ret<
template <typename T, unsigned int rank> struct __hip_tex_ret<
HIP_vector_type<T, rank>, hipReadModeElementType,
typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<HIP_vector_type<T, rank>>::value, bool>::type> {
@@ -189,8 +183,7 @@ struct __hip_tex_ret<T, hipReadModeNormalizedFloat,
using type = float;
};
template <typename T, unsigned int rank>
struct __hip_tex_ret<
template <typename T, unsigned int rank> struct __hip_tex_ret<
HIP_vector_type<T, rank>, hipReadModeNormalizedFloat,
typename __hip_internal::enable_if<
__hip_is_tex_normalized_channel_type<HIP_vector_type<T, rank>>::value, bool>::type> {
@@ -421,18 +414,16 @@ struct __hip_tex2dgather_ret {
static_assert(__hip_internal::is_same<Enable, void>::value, "Invalid channel type!");
};
template <typename T, hipTextureReadMode readMode>
using __hip_tex2dgather_ret_t = typename __hip_tex2dgather_ret<T, readMode, bool>::type;
template <typename T, hipTextureReadMode readMode> using __hip_tex2dgather_ret_t =
typename __hip_tex2dgather_ret<T, readMode, bool>::type;
template <typename T>
struct __hip_tex2dgather_ret<
template <typename T> struct __hip_tex2dgather_ret<
T, hipReadModeElementType,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value, bool>::type> {
using type = HIP_vector_type<T, 4>;
};
template <typename T, unsigned int rank>
struct __hip_tex2dgather_ret<
template <typename T, unsigned int rank> struct __hip_tex2dgather_ret<
HIP_vector_type<T, rank>, hipReadModeElementType,
typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<HIP_vector_type<T, rank>>::value, bool>::type> {
@@ -37,41 +37,36 @@ THE SOFTWARE.
unsigned int ADDRESS_SPACE_CONSTANT* s = i + HIP_SAMPLER_OBJECT_OFFSET_DWORD; \
(void)s;
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1Dfetch(hipTextureObject_t textureObject, int x) {
TEXTURE_OBJECT_PARAMETERS_INIT
auto tmp = __ockl_image_load_1Db(i, x);
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1Dfetch(T* ptr, hipTextureObject_t textureObject, int x) {
*ptr = tex1Dfetch<T>(textureObject, x);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1D(hipTextureObject_t textureObject, float x) {
TEXTURE_OBJECT_PARAMETERS_INIT
auto tmp = __ockl_image_sample_1D(i, s, x);
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1D(T* ptr, hipTextureObject_t textureObject, float x) {
*ptr = tex1D<T>(textureObject, x);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2D(hipTextureObject_t textureObject, float x, float y) {
TEXTURE_OBJECT_PARAMETERS_INIT
float2 coords{x, y};
@@ -79,17 +74,15 @@ static __device__ __hip_img_chk__ T tex2D(hipTextureObject_t textureObject, floa
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2D(T* ptr, hipTextureObject_t textureObject, float x,
float y) {
*ptr = tex2D<T>(textureObject, x, y);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex3D(hipTextureObject_t textureObject, float x, float y,
float z) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -98,17 +91,15 @@ static __device__ __hip_img_chk__ T tex3D(hipTextureObject_t textureObject, floa
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex3D(T* ptr, hipTextureObject_t textureObject, float x,
float y, float z) {
*ptr = tex3D<T>(textureObject, x, y, z);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1DLayered(hipTextureObject_t textureObject, float x,
int layer) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -117,17 +108,15 @@ static __device__ __hip_img_chk__ T tex1DLayered(hipTextureObject_t textureObjec
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1DLayered(T* ptr, hipTextureObject_t textureObject,
float x, int layer) {
*ptr = tex1DLayered<T>(textureObject, x, layer);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2DLayered(hipTextureObject_t textureObject, float x, float y,
int layer) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -136,17 +125,15 @@ static __device__ __hip_img_chk__ T tex2DLayered(hipTextureObject_t textureObjec
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2DLayered(T* ptr, hipTextureObject_t textureObject,
float x, float y, int layer) {
*ptr = tex1DLayered<T>(textureObject, x, y, layer);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T texCubemap(hipTextureObject_t textureObject, float x, float y,
float z) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -155,17 +142,15 @@ static __device__ __hip_img_chk__ T texCubemap(hipTextureObject_t textureObject,
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void texCubemap(T* ptr, hipTextureObject_t textureObject, float x,
float y, float z) {
*ptr = texCubemap<T>(textureObject, x, y, z);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T texCubemapLayered(hipTextureObject_t textureObject, float x,
float y, float z, int layer) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -174,17 +159,15 @@ static __device__ __hip_img_chk__ T texCubemapLayered(hipTextureObject_t texture
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void texCubemapLayered(T* ptr, hipTextureObject_t textureObject,
float x, float y, float z, int layer) {
*ptr = texCubemapLayered<T>(textureObject, x, y, z, layer);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2Dgather(hipTextureObject_t textureObject, float x, float y,
int comp = 0) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -214,17 +197,15 @@ static __device__ __hip_img_chk__ T tex2Dgather(hipTextureObject_t textureObject
return {};
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2Dgather(T* ptr, hipTextureObject_t textureObject,
float x, float y, int comp = 0) {
*ptr = texCubemapLayered<T>(textureObject, x, y, comp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1DLod(hipTextureObject_t textureObject, float x,
float level) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -232,17 +213,15 @@ static __device__ __hip_img_chk__ T tex1DLod(hipTextureObject_t textureObject, f
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1DLod(T* ptr, hipTextureObject_t textureObject, float x,
float level) {
*ptr = tex1DLod<T>(textureObject, x, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2DLod(hipTextureObject_t textureObject, float x, float y,
float level) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -251,17 +230,15 @@ static __device__ __hip_img_chk__ T tex2DLod(hipTextureObject_t textureObject, f
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2DLod(T* ptr, hipTextureObject_t textureObject, float x,
float y, float level) {
*ptr = tex2DLod<T>(textureObject, x, y, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex3DLod(hipTextureObject_t textureObject, float x, float y,
float z, float level) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -270,17 +247,15 @@ static __device__ __hip_img_chk__ T tex3DLod(hipTextureObject_t textureObject, f
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex3DLod(T* ptr, hipTextureObject_t textureObject, float x,
float y, float z, float level) {
*ptr = tex3DLod<T>(textureObject, x, y, z, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1DLayeredLod(hipTextureObject_t textureObject, float x,
int layer, float level) {
TEXTURE_OBJECT_PARAMETERS_INIT;
@@ -290,17 +265,15 @@ static __device__ __hip_img_chk__ T tex1DLayeredLod(hipTextureObject_t textureOb
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1DLayeredLod(T* ptr, hipTextureObject_t textureObject,
float x, int layer, float level) {
*ptr = tex1DLayeredLod<T>(textureObject, x, layer, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2DLayeredLod(hipTextureObject_t textureObject, float x,
float y, int layer, float level) {
TEXTURE_OBJECT_PARAMETERS_INIT;
@@ -310,17 +283,15 @@ static __device__ __hip_img_chk__ T tex2DLayeredLod(hipTextureObject_t textureOb
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2DLayeredLod(T* ptr, hipTextureObject_t textureObject,
float x, float y, int layer, float level) {
*ptr = tex2DLayeredLod<T>(textureObject, x, y, layer, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T texCubemapLod(hipTextureObject_t textureObject, float x,
float y, float z, float level) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -329,17 +300,15 @@ static __device__ __hip_img_chk__ T texCubemapLod(hipTextureObject_t textureObje
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void texCubemapLod(T* ptr, hipTextureObject_t textureObject,
float x, float y, float z, float level) {
*ptr = texCubemapLod<T>(textureObject, x, y, z, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T texCubemapGrad(hipTextureObject_t textureObject, float x,
float y, float z, float4 dPdx, float4 dPdy) {
TEXTURE_OBJECT_PARAMETERS_INIT;
@@ -355,18 +324,16 @@ static __device__ __hip_img_chk__ T texCubemapGrad(hipTextureObject_t textureObj
return {};
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void texCubemapGrad(T* ptr, hipTextureObject_t textureObject,
float x, float y, float z, float4 dPdx,
float4 dPdy) {
*ptr = texCubemapGrad<T>(textureObject, x, y, z, dPdx, dPdy);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T texCubemapLayeredLod(hipTextureObject_t textureObject, float x,
float y, float z, int layer, float level) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -375,9 +342,8 @@ static __device__ __hip_img_chk__ T texCubemapLayeredLod(hipTextureObject_t text
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void texCubemapLayeredLod(T* ptr,
hipTextureObject_t textureObject,
float x, float y, float z, int layer,
@@ -385,9 +351,8 @@ static __device__ __hip_img_chk__ void texCubemapLayeredLod(T* ptr,
*ptr = texCubemapLayeredLod<T>(textureObject, x, y, z, layer, level);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1DGrad(hipTextureObject_t textureObject, float x, float dPdx,
float dPdy) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -395,17 +360,15 @@ static __device__ __hip_img_chk__ T tex1DGrad(hipTextureObject_t textureObject,
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1DGrad(T* ptr, hipTextureObject_t textureObject, float x,
float dPdx, float dPdy) {
*ptr = tex1DGrad<T>(textureObject, x, dPdx, dPdy);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2DGrad(hipTextureObject_t textureObject, float x, float y,
float2 dPdx, float2 dPdy) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -415,17 +378,15 @@ static __device__ __hip_img_chk__ T tex2DGrad(hipTextureObject_t textureObject,
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2DGrad(T* ptr, hipTextureObject_t textureObject, float x,
float y, float2 dPdx, float2 dPdy) {
*ptr = tex2DGrad<T>(textureObject, x, y, dPdx, dPdy);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex3DGrad(hipTextureObject_t textureObject, float x, float y,
float z, float4 dPdx, float4 dPdy) {
TEXTURE_OBJECT_PARAMETERS_INIT;
@@ -438,17 +399,15 @@ static __device__ __hip_img_chk__ T tex3DGrad(hipTextureObject_t textureObject,
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex3DGrad(T* ptr, hipTextureObject_t textureObject, float x,
float y, float z, float4 dPdx, float4 dPdy) {
*ptr = tex3DGrad<T>(textureObject, x, y, z, dPdx, dPdy);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex1DLayeredGrad(hipTextureObject_t textureObject, float x,
int layer, float dPdx, float dPdy) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -457,18 +416,16 @@ static __device__ __hip_img_chk__ T tex1DLayeredGrad(hipTextureObject_t textureO
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex1DLayeredGrad(T* ptr, hipTextureObject_t textureObject,
float x, int layer, float dPdx,
float dPdy) {
*ptr = tex1DLayeredGrad<T>(textureObject, x, layer, dPdx, dPdy);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T tex2DLayeredGrad(hipTextureObject_t textureObject, float x,
float y, int layer, float2 dPdx, float2 dPdy) {
TEXTURE_OBJECT_PARAMETERS_INIT
@@ -478,18 +435,16 @@ static __device__ __hip_img_chk__ T tex2DLayeredGrad(hipTextureObject_t textureO
return __hipMapFrom<T>(tmp);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void tex2DLayeredGrad(T* ptr, hipTextureObject_t textureObject,
float x, float y, int layer, float2 dPdx,
float2 dPdy) {
*ptr = tex2DLayeredGrad<T>(textureObject, x, y, layer, dPdx, dPdy);
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ T texCubemapLayeredGrad(hipTextureObject_t textureObject, float x,
float y, float z, int layer, float4 dPdx,
float4 dPdy) {
@@ -507,9 +462,8 @@ static __device__ __hip_img_chk__ T texCubemapLayeredGrad(hipTextureObject_t tex
return {};
}
template <
typename T,
typename __hip_internal::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
template <typename T, typename __hip_internal::enable_if<
__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static __device__ __hip_img_chk__ void texCubemapLayeredGrad(T* ptr,
hipTextureObject_t textureObject,
float x, float y, float z, int layer,