resolve merge conflict
此提交包含在:
@@ -154,6 +154,20 @@ hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* block
|
||||
dynSharedMemPerBlk, blockSizeLimit);
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
inline
|
||||
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(uint32_t* numBlocks, F kernel,
|
||||
uint32_t blockSize, size_t dynSharedMemPerBlk) {
|
||||
|
||||
using namespace hip_impl;
|
||||
|
||||
hip_impl::hip_init();
|
||||
auto f = get_program_state().kernel_descriptor(reinterpret_cast<std::uintptr_t>(kernel),
|
||||
target_agent(0));
|
||||
|
||||
return hipOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, f, blockSize, dynSharedMemPerBlk);
|
||||
}
|
||||
|
||||
template <typename... Args, typename F = void (*)(Args...)>
|
||||
inline
|
||||
void hipLaunchKernelGGL(F kernel, const dim3& numBlocks, const dim3& dimBlocks,
|
||||
|
||||
@@ -2953,7 +2953,7 @@ hipError_t hipOccupancyMaxPotentialBlockSize(uint32_t* gridSize, uint32_t* block
|
||||
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
|
||||
*/
|
||||
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
int* numBlocks, const void* f, int blockSize, size_t dynSharedMemPerBlk);
|
||||
uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk);
|
||||
|
||||
/**
|
||||
* @brief Returns occupancy for a device function.
|
||||
@@ -2964,8 +2964,7 @@ hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
* @param [in] dynSharedMemPerBlk dynamic shared memory usage (in bytes) intended for each block
|
||||
* @param [in] flags Extra flags for occupancy calculation (currently ignored)
|
||||
*/
|
||||
hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
|
||||
int* numBlocks, const void* f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags __dparm(hipOccupancyDefault));
|
||||
uint32_t* numBlocks, hipFunction_t f, uint32_t blockSize, size_t dynSharedMemPerBlk, unsigned int flags __dparm(hipOccupancyDefault));
|
||||
|
||||
#if __HIP_VDI__ && !defined(__HCC__)
|
||||
/**
|
||||
@@ -3235,6 +3234,21 @@ hipError_t hipLaunchKernel(const void* function_address,
|
||||
} /* extern "c" */
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(__HCC__) && defined(__clang__) && defined(__HIP__)
|
||||
template <typename F>
|
||||
static hipError_t __host__ inline hipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
uint32_t* numBlocks, F func, uint32_t blockSize, size_t dynSharedMemPerBlk) {
|
||||
return ::hipOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, (hipFunction_t)func, blockSize,
|
||||
dynSharedMemPerBlk);
|
||||
}
|
||||
template <typename F>
|
||||
static hipError_t __host__ inline hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
|
||||
uint32_t* numBlocks, F func, uint32_t blockSize, size_t dynSharedMemPerBlk, unsigned int flags) {
|
||||
return ::hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
|
||||
numBlocks, (hipFunction_t)func, blockSize, dynSharedMemPerBlk, flags);
|
||||
}
|
||||
#endif // defined(__cplusplus) && !defined(__HCC__) && defined(__clang__) && defined(__HIP__)
|
||||
|
||||
#if USE_PROF_API
|
||||
#include <hip/hcc_detail/hip_prof_str.h>
|
||||
#endif
|
||||
@@ -3375,20 +3389,6 @@ hipError_t hipBindTextureToMipmappedArray(const texture<T, dim, readMode>& tex,
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
int* numBlocks, T f, int blockSize, size_t dynSharedMemPerBlk) {
|
||||
return hipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
numBlocks, reinterpret_cast<const void*>(f), blockSize, dynSharedMemPerBlk);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
|
||||
int* numBlocks, T f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags) {
|
||||
return hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
|
||||
numBlocks, reinterpret_cast<const void*>(f), blockSize, dynSharedMemPerBlk, flags);
|
||||
}
|
||||
|
||||
#if __HIP_VDI__ && !defined(__HCC__)
|
||||
template <class T>
|
||||
inline hipError_t hipLaunchCooperativeKernel(T f, dim3 gridDim, dim3 blockDim,
|
||||
|
||||
@@ -57,6 +57,7 @@ struct __HIP_TEXTURE_ATTRIB texture : public textureReference {
|
||||
texture(int norm = 0, enum hipTextureFilterMode fMode = hipFilterModePoint,
|
||||
enum hipTextureAddressMode aMode = hipAddressModeClamp) {
|
||||
normalized = norm;
|
||||
readMode = hipReadModeNormalizedFloat;
|
||||
filterMode = fMode;
|
||||
addressMode[0] = aMode;
|
||||
addressMode[1] = aMode;
|
||||
@@ -68,6 +69,7 @@ struct __HIP_TEXTURE_ATTRIB texture : public textureReference {
|
||||
texture(int norm, enum hipTextureFilterMode fMode, enum hipTextureAddressMode aMode,
|
||||
struct hipChannelFormatDesc desc) {
|
||||
normalized = norm;
|
||||
readMode = hipReadModeNormalizedFloat;
|
||||
filterMode = fMode;
|
||||
addressMode[0] = aMode;
|
||||
addressMode[1] = aMode;
|
||||
|
||||
@@ -34,11 +34,11 @@ THE SOFTWARE.
|
||||
|
||||
#include "hip/hcc_detail/host_defines.h"
|
||||
|
||||
#if !defined(_MSC_VER)|| __clang__
|
||||
#if !defined(_MSC_VER) || __clang__
|
||||
#if __has_attribute(ext_vector_type)
|
||||
#define __NATIVE_VECTOR__(n, ...) __attribute__((ext_vector_type(n)))
|
||||
#define __NATIVE_VECTOR__(n, T) T __attribute__((ext_vector_type(n)))
|
||||
#else
|
||||
#define __NATIVE_VECTOR__(n, ...) [n]
|
||||
#define __NATIVE_VECTOR__(n, T) T[n]
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@@ -49,16 +49,16 @@ THE SOFTWARE.
|
||||
namespace hip_impl {
|
||||
template<typename, typename, unsigned int> struct Scalar_accessor;
|
||||
} // Namespace hip_impl.
|
||||
|
||||
|
||||
namespace std {
|
||||
template<typename T, typename U, unsigned int n>
|
||||
struct is_integral<hip_impl::Scalar_accessor<T, U, n>>
|
||||
: is_integral<T> {};
|
||||
template<typename T, typename U, unsigned int n>
|
||||
struct is_floating_point<hip_impl::Scalar_accessor<T, U, n>>
|
||||
struct is_floating_point<hip_impl::Scalar_accessor<T, U, n>>
|
||||
: is_floating_point<T> {};
|
||||
} // Namespace std.
|
||||
|
||||
|
||||
namespace hip_impl {
|
||||
template<typename T, typename Vector, unsigned int idx>
|
||||
struct Scalar_accessor {
|
||||
@@ -146,7 +146,7 @@ THE SOFTWARE.
|
||||
|
||||
__host__ __device__
|
||||
Address operator&() const noexcept { return Address{this}; }
|
||||
|
||||
|
||||
__host__ __device__
|
||||
Scalar_accessor& operator=(const Scalar_accessor& x) noexcept {
|
||||
data[idx] = x.data[idx];
|
||||
@@ -284,13 +284,20 @@ THE SOFTWARE.
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
inline
|
||||
constexpr
|
||||
unsigned int next_pot(unsigned int x) {
|
||||
// Precondition: x > 1.
|
||||
return 1u << (32u - __builtin_clz(x - 1u));
|
||||
}
|
||||
} // Namespace hip_impl.
|
||||
|
||||
template<typename T, unsigned int n> struct HIP_vector_base;
|
||||
|
||||
template<typename T>
|
||||
struct HIP_vector_base<T, 1> {
|
||||
using Native_vec_ = T __NATIVE_VECTOR__(1, T);
|
||||
using Native_vec_ = __NATIVE_VECTOR__(1, T);
|
||||
|
||||
union {
|
||||
Native_vec_ data;
|
||||
@@ -304,7 +311,7 @@ THE SOFTWARE.
|
||||
};
|
||||
|
||||
using value_type = T;
|
||||
|
||||
|
||||
__host__ __device__
|
||||
HIP_vector_base& operator=(const HIP_vector_base& x) noexcept {
|
||||
#if __has_attribute(ext_vector_type)
|
||||
@@ -319,9 +326,13 @@ THE SOFTWARE.
|
||||
|
||||
template<typename T>
|
||||
struct HIP_vector_base<T, 2> {
|
||||
using Native_vec_ = T __NATIVE_VECTOR__(2, T);
|
||||
using Native_vec_ = __NATIVE_VECTOR__(2, T);
|
||||
|
||||
union {
|
||||
union
|
||||
#if !__has_attribute(ext_vector_type)
|
||||
alignas(hip_impl::next_pot(2 * sizeof(T)))
|
||||
#endif
|
||||
{
|
||||
Native_vec_ data;
|
||||
#if __HIP_CLANG_ONLY__
|
||||
struct {
|
||||
@@ -335,7 +346,7 @@ THE SOFTWARE.
|
||||
};
|
||||
|
||||
using value_type = T;
|
||||
|
||||
|
||||
__host__ __device__
|
||||
HIP_vector_base& operator=(const HIP_vector_base& x) noexcept {
|
||||
#if __has_attribute(ext_vector_type)
|
||||
@@ -507,9 +518,13 @@ THE SOFTWARE.
|
||||
|
||||
template<typename T>
|
||||
struct HIP_vector_base<T, 4> {
|
||||
using Native_vec_ = T __NATIVE_VECTOR__(4, T);
|
||||
using Native_vec_ = __NATIVE_VECTOR__(4, T);
|
||||
|
||||
union {
|
||||
union
|
||||
#if !__has_attribute(ext_vector_type)
|
||||
alignas(hip_impl::next_pot(4 * sizeof(T)))
|
||||
#endif
|
||||
{
|
||||
Native_vec_ data;
|
||||
#if __HIP_CLANG_ONLY__
|
||||
struct {
|
||||
@@ -527,7 +542,7 @@ THE SOFTWARE.
|
||||
};
|
||||
|
||||
using value_type = T;
|
||||
|
||||
|
||||
__host__ __device__
|
||||
HIP_vector_base& operator=(const HIP_vector_base& x) noexcept {
|
||||
#if __has_attribute(ext_vector_type)
|
||||
|
||||
@@ -157,32 +157,16 @@ union TData {
|
||||
|
||||
#define TEXTURE_RETURN_UINT_XYZW return make_uint4(texel.u.x, texel.u.y, texel.u.z, texel.u.w);
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT return (texFormatToSize[texRef.format] == 1)? texel.f.x : (float)texel.u.x/texFormatToSize[texRef.format];
|
||||
#define TEXTURE_RETURN_FLOAT return texel.f.x;
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT_X return (texFormatToSize[texRef.format] == 1)? make_float1(texel.f.x) : make_float1((float)texel.u.x/texFormatToSize[texRef.format]);
|
||||
#define TEXTURE_RETURN_FLOAT_X return make_float1(texel.f.x);
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT_XY return (texFormatToSize[texRef.format] == 1)? make_float2(texel.f.x, texel.f.y) : make_float2((float)texel.u.x/texFormatToSize[texRef.format], (float)texel.u.y/texFormatToSize[texRef.format]);
|
||||
#define TEXTURE_RETURN_FLOAT_XY return make_float2(texel.f.x, texel.f.y);
|
||||
|
||||
#define TEXTURE_RETURN_FLOAT_XYZW return (texFormatToSize[texRef.format] == 1)? make_float4(texel.f.x, texel.f.y, texel.f.z, texel.f.w) : make_float4((float)texel.u.x/texFormatToSize[texRef.format], (float)texel.u.y/texFormatToSize[texRef.format], (float)texel.u.z/texFormatToSize[texRef.format], (float)texel.u.w/texFormatToSize[texRef.format]) ;
|
||||
#define TEXTURE_RETURN_FLOAT_XYZW return make_float4(texel.f.x, texel.f.y, texel.f.z, texel.f.w);
|
||||
|
||||
extern "C" {
|
||||
|
||||
// this is really a sparse array with only valid values being the ones indexed by the enum hipArray_Format(e.g. texFormatToSize[HIP_AD_FORMAT_UNSIGNED_INT8] = UCHAR_MAX)
|
||||
__device__ __constant__ static int texFormatToSize[] = {
|
||||
1, /* HIP_AD_FORMAT_NOT_INITIALIZED */
|
||||
UCHAR_MAX, /* HIP_AD_FORMAT_UNSIGNED_INT8 */
|
||||
USHRT_MAX, /* HIP_AD_FORMAT_UNSIGNED_INT16 */
|
||||
1, /* HIP_AD_FORMAT_UNSIGNED_INT32 */
|
||||
1,1,1,1, /* Invalid values */
|
||||
SCHAR_MAX, /* HIP_AD_FORMAT_SIGNED_INT8 */
|
||||
SHRT_MAX, /* HIP_AD_FORMAT_SIGNED_INT16 */
|
||||
1, /* HIP_AD_FORMAT_SIGNED_INT32 */
|
||||
1,1,1,1,1, /* Invalid values */
|
||||
1, /* HIP_AD_FORMAT_HALF */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* Invalid values */
|
||||
1 /* HIP_AD_FORMAT_FLOAT */
|
||||
};
|
||||
|
||||
__device__
|
||||
__hip_float4_vector_value_type __ockl_image_sample_1D(
|
||||
unsigned int ADDRESS_SPACE_CONSTANT* i, unsigned int ADDRESS_SPACE_CONSTANT* s,
|
||||
|
||||
@@ -73,6 +73,7 @@ enum hipTextureReadMode { hipReadModeElementType = 0, hipReadModeNormalizedFloat
|
||||
*/
|
||||
typedef struct textureReference {
|
||||
int normalized;
|
||||
enum hipTextureReadMode readMode;// used only for driver API's
|
||||
enum hipTextureFilterMode filterMode;
|
||||
enum hipTextureAddressMode addressMode[3]; // Texture address mode for up to 3 dimensions
|
||||
struct hipChannelFormatDesc channelDesc;
|
||||
|
||||
新增問題並參考
封鎖使用者