resolve conflicts of doc_update
Este cometimento está contido em:
@@ -66,8 +66,8 @@ THE SOFTWARE.
|
||||
// 32-bit Atomics:
|
||||
#define __HIP_ARCH_HAS_GLOBAL_INT32_ATOMICS__ (1)
|
||||
#define __HIP_ARCH_HAS_GLOBAL_FLOAT_ATOMIC_EXCH__ (1)
|
||||
#define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (0)
|
||||
#define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (0)
|
||||
#define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (1)
|
||||
#define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (1)
|
||||
#define __HIP_ARCH_HAS_FLOAT_ATOMIC_ADD__ (0)
|
||||
|
||||
// 64-bit Atomics:
|
||||
@@ -108,6 +108,12 @@ THE SOFTWARE.
|
||||
#define __HCC_C__
|
||||
#endif
|
||||
|
||||
|
||||
// TODO - hipify-clang - change to use the function call.
|
||||
//#define warpSize hc::__wavesize()
|
||||
const int warpSize = 64;
|
||||
|
||||
|
||||
#define clock_t long long int
|
||||
__device__ inline long long int clock64() { return (long long int)hc::__clock_u64(); };
|
||||
__device__ inline clock_t clock() { return (clock_t)hc::__clock_u64(); };
|
||||
@@ -195,18 +201,6 @@ __device__ inline unsigned long long int atomicMax(unsigned long long int* addre
|
||||
return (long long int)hc::atomic_fetch_max((uint64_t*)address,(uint64_t)val);
|
||||
}
|
||||
|
||||
//atomicInc()
|
||||
__device__ inline unsigned int atomicInc(unsigned int* address)
|
||||
{
|
||||
return hc::atomic_fetch_inc(address);
|
||||
}
|
||||
|
||||
//atomicDec()
|
||||
__device__ inline unsigned int atomicDec(unsigned int* address)
|
||||
{
|
||||
return hc::atomic_fetch_dec(address);
|
||||
}
|
||||
|
||||
//atomicCAS()
|
||||
__device__ inline int atomicCAS(int* address, int compare, int val)
|
||||
{
|
||||
@@ -351,49 +345,48 @@ __device__ inline int __any( int input)
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
__device__ inline unsigned long long int __ballot( int input)
|
||||
{
|
||||
return hc::__ballot( input);
|
||||
}
|
||||
|
||||
// warp shuffle functions
|
||||
__device__ inline int __shfl(int input, int lane, int width)
|
||||
__device__ inline int __shfl(int input, int lane, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl(input,lane,width);
|
||||
}
|
||||
|
||||
__device__ inline int __shfl_up(int input, unsigned int lane_delta, int width)
|
||||
__device__ inline int __shfl_up(int input, unsigned int lane_delta, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl_up(input,lane_delta,width);
|
||||
}
|
||||
|
||||
__device__ inline int __shfl_down(int input, unsigned int lane_delta, int width)
|
||||
__device__ inline int __shfl_down(int input, unsigned int lane_delta, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl_down(input,lane_delta,width);
|
||||
}
|
||||
|
||||
__device__ inline int __shfl_xor(int input, int lane_mask, int width)
|
||||
__device__ inline int __shfl_xor(int input, int lane_mask, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl_xor(input,lane_mask,width);
|
||||
}
|
||||
|
||||
__device__ inline float __shfl(float input, int lane, int width)
|
||||
__device__ inline float __shfl(float input, int lane, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl(input,lane,width);
|
||||
}
|
||||
|
||||
__device__ inline float __shfl_up(float input, unsigned int lane_delta, int width)
|
||||
__device__ inline float __shfl_up(float input, unsigned int lane_delta, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl_up(input,lane_delta,width);
|
||||
}
|
||||
|
||||
__device__ inline float __shfl_down(float input, unsigned int lane_delta, int width)
|
||||
__device__ inline float __shfl_down(float input, unsigned int lane_delta, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl_down(input,lane_delta,width);
|
||||
}
|
||||
|
||||
__device__ inline float __shfl_xor(float input, int lane_mask, int width)
|
||||
__device__ inline float __shfl_xor(float input, int lane_mask, int width=warpSize)
|
||||
{
|
||||
return hc::__shfl_xor(input,lane_mask,width);
|
||||
}
|
||||
@@ -452,7 +445,6 @@ __device__ inline float __dsqrt_rz(double x) {return hc::fast_math::sqrt(x); };
|
||||
#define hipGridDim_z (hc_get_num_groups(0))
|
||||
|
||||
|
||||
extern int warpSize ;
|
||||
|
||||
|
||||
#define __syncthreads() hc_barrier(CLK_LOCAL_MEM_FENCE)
|
||||
@@ -490,7 +482,8 @@ extern int warpSize ;
|
||||
|
||||
|
||||
#ifdef __HCC_CPP__
|
||||
hc::accelerator_view *ihipLaunchKernel(hipStream_t stream);
|
||||
hipStream_t ihipPreLaunchKernel(hipStream_t stream, hc::accelerator_view **av);
|
||||
void ihipPostLaunchKernel(hipStream_t stream, hc::completion_future &cf);
|
||||
|
||||
#if not defined(DISABLE_GRID_LAUNCH)
|
||||
#define hipLaunchKernel(_kernelName, _numBlocks3D, _blockDim3D, _groupMemBytes, _stream, ...) \
|
||||
@@ -505,12 +498,13 @@ do {\
|
||||
lp.groupMemBytes = _groupMemBytes;\
|
||||
hc::completion_future cf;\
|
||||
lp.cf = &cf; \
|
||||
lp.av = (ihipLaunchKernel(_stream)); \
|
||||
hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \
|
||||
if (HIP_TRACE_API) {\
|
||||
fprintf(stderr, "hiptrace1: launch '%s' gridDim:[%d.%d.%d] groupDim:[%d.%d.%d] groupMem:+%d stream=%p\n", \
|
||||
#_kernelName, lp.gridDim.z, lp.gridDim.y, lp.gridDim.x, lp.groupDim.z, lp.groupDim.y, lp.groupDim.x, lp.groupMemBytes, (void*)(_stream));\
|
||||
}\
|
||||
_kernelName (lp, __VA_ARGS__);\
|
||||
ihipPostLaunchKernel(trueStream, cf);\
|
||||
} while(0)
|
||||
|
||||
#else
|
||||
@@ -528,12 +522,13 @@ do {\
|
||||
lp.groupMemBytes = _groupMemBytes;\
|
||||
hc::completion_future cf;\
|
||||
lp.cf = &cf; \
|
||||
lp.av = (ihipLaunchKernel(_stream)); \
|
||||
hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \
|
||||
if (HIP_TRACE_API) {\
|
||||
fprintf(stderr, "hiptrace1: launch '%s' gridDim:[%d.%d.%d] groupDim:[%d.%d.%d] groupMem:+%d stream=%p\n", \
|
||||
#_kernelName, lp.gridDim.z, lp.gridDim.y, lp.gridDim.x, lp.groupDim.z, lp.groupDim.y, lp.groupDim.x, lp.groupMemBytes, (void*)(_stream));\
|
||||
}\
|
||||
_kernelName (lp, __VA_ARGS__);\
|
||||
ihipPostLaunchKernel(trueStream, cf);\
|
||||
} while(0)
|
||||
/*end hipLaunchKernel */
|
||||
#endif
|
||||
|
||||
@@ -105,6 +105,8 @@ enum hipMemcpyKind {
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
// Doxygen end group GlobalDefs
|
||||
/** @} */
|
||||
|
||||
@@ -113,7 +115,7 @@ enum hipMemcpyKind {
|
||||
|
||||
|
||||
// The handle allows the async commands to use the stream even if the parent hipStream_t goes out-of-scope.
|
||||
typedef struct ihipStream_t * hipStream_t;
|
||||
typedef class ihipStream_t * hipStream_t;
|
||||
|
||||
|
||||
/*
|
||||
@@ -128,6 +130,7 @@ typedef struct hipEvent_t {
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
@@ -634,6 +637,11 @@ hipError_t hipEventQuery(hipEvent_t event) ;
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Return attributes for the specified pointer
|
||||
*/
|
||||
hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr) ;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Allocate memory on the default accelerator
|
||||
|
||||
@@ -43,6 +43,11 @@ THE SOFTWARE.
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#if __cplusplus > 199711L
|
||||
#include <thread>
|
||||
#endif
|
||||
|
||||
|
||||
#include <hip_common.h>
|
||||
|
||||
#if defined(__HIP_PLATFORM_HCC__) and not defined (__HIP_PLATFORM_NVCC__)
|
||||
|
||||
+109
-73
@@ -33,34 +33,34 @@ THE SOFTWARE.
|
||||
#include <hip_common.h>
|
||||
|
||||
typedef struct {
|
||||
// 32-bit Atomics:
|
||||
unsigned hasGlobalInt32Atomics : 1; ///< 32-bit integer atomics for global memory
|
||||
unsigned hasGlobalFloatAtomicExch : 1; ///< 32-bit float atomic exch for global memory
|
||||
unsigned hasSharedInt32Atomics : 1; ///< 32-bit integer atomics for shared memory
|
||||
unsigned hasSharedFloatAtomicExch : 1; ///< 32-bit float atomic exch for shared memory
|
||||
unsigned hasFloatAtomicAdd : 1; ///< 32-bit float atomic add in global and shared memory
|
||||
// 32-bit Atomics
|
||||
unsigned hasGlobalInt32Atomics : 1; ///< 32-bit integer atomics for global memory.
|
||||
unsigned hasGlobalFloatAtomicExch : 1; ///< 32-bit float atomic exch for global memory.
|
||||
unsigned hasSharedInt32Atomics : 1; ///< 32-bit integer atomics for shared memory.
|
||||
unsigned hasSharedFloatAtomicExch : 1; ///< 32-bit float atomic exch for shared memory.
|
||||
unsigned hasFloatAtomicAdd : 1; ///< 32-bit float atomic add in global and shared memory.
|
||||
|
||||
// 64-bit Atomics:
|
||||
unsigned hasGlobalInt64Atomics : 1; ///< 64-bit integer atomics for global memory
|
||||
unsigned hasSharedInt64Atomics : 1; ///< 64-bit integer atomics for shared memory
|
||||
// 64-bit Atomics
|
||||
unsigned hasGlobalInt64Atomics : 1; ///< 64-bit integer atomics for global memory.
|
||||
unsigned hasSharedInt64Atomics : 1; ///< 64-bit integer atomics for shared memory.
|
||||
|
||||
// Doubles
|
||||
unsigned hasDoubles : 1; ///< double-precision floating point.
|
||||
unsigned hasDoubles : 1; ///< Double-precision floating point.
|
||||
|
||||
// Warp cross-lane operations:
|
||||
unsigned hasWarpVote : 1; ///< warp vote instructions (__any, __all)
|
||||
unsigned hasWarpBallot : 1; ///< warp ballot instructions (__ballot)
|
||||
unsigned hasWarpShuffle : 1; ///< warp shuffle operations. (__shfl_*)
|
||||
unsigned hasFunnelShift : 1; ///< funnel two words into one, with shift&mask caps
|
||||
// Warp cross-lane operations
|
||||
unsigned hasWarpVote : 1; ///< Warp vote instructions (__any, __all).
|
||||
unsigned hasWarpBallot : 1; ///< Warp ballot instructions (__ballot).
|
||||
unsigned hasWarpShuffle : 1; ///< Warp shuffle operations. (__shfl_*).
|
||||
unsigned hasFunnelShift : 1; ///< Funnel two words into one with shift&mask caps.
|
||||
|
||||
// Sync
|
||||
unsigned hasThreadFenceSystem : 1; ///< __threadfence_system
|
||||
unsigned hasSyncThreadsExt : 1; ///< __syncthreads_count, syncthreads_and, syncthreads_or
|
||||
unsigned hasThreadFenceSystem : 1; ///< __threadfence_system.
|
||||
unsigned hasSyncThreadsExt : 1; ///< __syncthreads_count, syncthreads_and, syncthreads_or.
|
||||
|
||||
// Misc
|
||||
unsigned hasSurfaceFuncs : 1; ///< Surface functions
|
||||
unsigned has3dGrid : 1; ///< Grid and group dims are 3D (rather than 2D)
|
||||
unsigned hasDynamicParallelism : 1; ///< Dynamic parallelism
|
||||
unsigned hasSurfaceFuncs : 1; ///< Surface functions.
|
||||
unsigned has3dGrid : 1; ///< Grid and group dims are 3D (rather than 2D).
|
||||
unsigned hasDynamicParallelism : 1; ///< Dynamic parallelism.
|
||||
} hipDeviceArch_t;
|
||||
|
||||
|
||||
@@ -72,31 +72,58 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
typedef struct hipDeviceProp_t {
|
||||
char name[256]; ///< Device name
|
||||
size_t totalGlobalMem; ///< Size of global memory region (in bytes)
|
||||
size_t sharedMemPerBlock; ///< Size of shared memory region (in bytes)
|
||||
int regsPerBlock ; ///< registers per block
|
||||
int warpSize ; ///< warp size
|
||||
int maxThreadsPerBlock; ///< max work items per work group or workgroup max size
|
||||
int maxThreadsDim[3]; ///< max number of threads in each dimension (XYZ) of a block
|
||||
int maxGridSize[3]; ///< max grid dimensions (XYZ)
|
||||
int clockRate ; ///< max clock frequency of the multiProcessors, in khz.
|
||||
|
||||
size_t totalConstMem; ///< Size of shared memory region (in bytes)
|
||||
int major ; ///< Major compute capability. On HCC, this is an approximation and features may differ from CUDA CC. See the arch feature flags for portable ways to query feature caps.
|
||||
int minor; ///< Minor compute capability. On HCC, this is an approximation and features may differ from CUDA CC. See the arch feature flags for portable ways to query feature caps.
|
||||
int multiProcessorCount; ///< number of multi-processors (compute units)
|
||||
int l2CacheSize; ///< L2 cache size
|
||||
int maxThreadsPerMultiProcessor; ///< Maximum resident threads per multi-processor
|
||||
int computeMode; ///< Compute mode
|
||||
|
||||
int clockInstructionRate ; ///< Frequency in khz of the timer used by the device-side "clock*" instructions. New for HIP.
|
||||
|
||||
hipDeviceArch_t arch; ///< Architectural feature flags. New for HIP.
|
||||
int concurrentKernels; ///< Device can possibly execute multiple kernels concurrently
|
||||
char name[256]; ///< Device name.
|
||||
size_t totalGlobalMem; ///< Size of global memory region (in bytes).
|
||||
size_t sharedMemPerBlock; ///< Size of shared memory region (in bytes).
|
||||
int regsPerBlock; ///< Registers per block.
|
||||
int warpSize; ///< Warp size.
|
||||
int maxThreadsPerBlock; ///< Max work items per work group or workgroup max size.
|
||||
int maxThreadsDim[3]; ///< Max number of threads in each dimension (XYZ) of a block.
|
||||
int maxGridSize[3]; ///< Max grid dimensions (XYZ).
|
||||
int clockRate; ///< Max clock frequency of the multiProcessors in khz.
|
||||
int memoryClockRate; ///< Max global memory clock frequency in khz.
|
||||
int memoryBusWidth; ///< Global memory bus width in bits.
|
||||
size_t totalConstMem; ///< Size of shared memory region (in bytes).
|
||||
int major; ///< Major compute capability. On HCC, this is an approximation and features may differ from CUDA CC. See the arch feature flags for portable ways to query feature caps.
|
||||
int minor; ///< Minor compute capability. On HCC, this is an approximation and features may differ from CUDA CC. See the arch feature flags for portable ways to query feature caps.
|
||||
int multiProcessorCount; ///< Number of multi-processors (compute units).
|
||||
int l2CacheSize; ///< L2 cache size.
|
||||
int maxThreadsPerMultiProcessor; ///< Maximum resident threads per multi-processor.
|
||||
int computeMode; ///< Compute mode.
|
||||
int clockInstructionRate; ///< Frequency in khz of the timer used by the device-side "clock*" instructions. New for HIP.
|
||||
hipDeviceArch_t arch; ///< Architectural feature flags. New for HIP.
|
||||
int concurrentKernels; ///< Device can possibly execute multiple kernels concurrently.
|
||||
int pciBusID; ///< PCI Bus ID.
|
||||
int pciDeviceID; ///< PCI Device ID.
|
||||
size_t maxSharedMemoryPerMultiProcessor; ///< Maximum Shared Memory Per Multiprocessor.
|
||||
int isMultiGpuBoard; ///< 1 if device is on a multi-GPU board, 0 if not.
|
||||
} hipDeviceProp_t;
|
||||
|
||||
|
||||
/**
|
||||
* Memory type (for pointer attributes)
|
||||
*/
|
||||
enum hipMemoryType {
|
||||
hipMemoryTypeHost, ///< Memory is physically located on host
|
||||
hipMemoryTypeDevice ///< Memory is physically located on device. (see deviceId for specific device)
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Pointer attributes
|
||||
*/
|
||||
typedef struct hipPointerAttribute_t {
|
||||
enum hipMemoryType memoryType;
|
||||
int device;
|
||||
void *devicePointer;
|
||||
void *hostPointer;
|
||||
int isManaged;
|
||||
unsigned allocationFlags; /* flags specified when memory was allocated*/
|
||||
/* peers? */
|
||||
} hipPointerAttribute_t;
|
||||
|
||||
|
||||
// hack to get these to show up in Doxygen:
|
||||
/**
|
||||
* @defgroup GlobalDefs Global enum and defines
|
||||
@@ -106,24 +133,26 @@ typedef struct hipDeviceProp_t {
|
||||
|
||||
|
||||
/*
|
||||
* @brief hipError_t
|
||||
asdasd* @brief hipError_t
|
||||
* @enum
|
||||
* @ingroup Enumerations
|
||||
*/
|
||||
// Developer note - when updating these, update the hipErrorName and hipErrorString functions
|
||||
typedef enum hipError_t {
|
||||
hipSuccess = 0 ///< Successful completion.
|
||||
,hipErrorMemoryAllocation ///< Memory allocation error.
|
||||
,hipErrorMemoryFree ///< Memory free error.
|
||||
,hipErrorUnknownSymbol ///< Unknown symbol
|
||||
,hipErrorOutOfResources ///< Out of resources error
|
||||
,hipErrorInvalidValue ///< One or more of the parameters passed to the API call is NULL or not in an acceptable range.
|
||||
,hipErrorInvalidResourceHandle ///< Resource handle (hipEvent_t or hipStream_t) invalid.
|
||||
,hipErrorInvalidDevice ///< DeviceID must be in range 0...#compute-devices.
|
||||
,hipErrorNoDevice ///< Call to hipGetDeviceCount returned 0 devices
|
||||
,hipErrorNotReady ///< indicates that asynchronous operations enqueued earlier are not ready. This is not actually an error, but is used to distinguish from hipSuccess (which indicates completion). APIs that return this error include hipEventQuery and hipStreamQuery.
|
||||
hipSuccess = 0 ///< Successful completion.
|
||||
,hipErrorMemoryAllocation ///< Memory allocation error.
|
||||
,hipErrorMemoryFree ///< Memory free error.
|
||||
,hipErrorUnknownSymbol ///< Unknown symbol.
|
||||
,hipErrorOutOfResources ///< Out of resources error.
|
||||
,hipErrorInvalidValue ///< One or more of the parameters passed to the API call is NULL or not in an acceptable range.
|
||||
,hipErrorInvalidResourceHandle ///< Resource handle (hipEvent_t or hipStream_t) invalid.
|
||||
,hipErrorInvalidDevice ///< DeviceID must be in range 0...#compute-devices.
|
||||
,hipErrorInvalidMemcpyDirection ///< Invalid memory copy direction
|
||||
|
||||
,hipErrorUnknown ///< Unknown error
|
||||
,hipErrorTbd ///< Marker that more error codes are needed.
|
||||
,hipErrorNoDevice ///< Call to hipGetDeviceCount returned 0 devices
|
||||
,hipErrorNotReady ///< Indicates that asynchronous operations enqueued earlier are not ready. This is not actually an error, but is used to distinguish from hipSuccess (which indicates completion). APIs that return this error include hipEventQuery and hipStreamQuery.
|
||||
,hipErrorUnknown ///< Unknown error.
|
||||
,hipErrorTbd ///< Marker that more error codes are needed.
|
||||
} hipError_t;
|
||||
|
||||
/*
|
||||
@@ -132,24 +161,31 @@ typedef enum hipError_t {
|
||||
* @ingroup Enumerations
|
||||
*/
|
||||
typedef enum hipDeviceAttribute_t {
|
||||
hipDeviceAttributeMaxThreadsPerBlock, ///< Maximum number of threads per block.
|
||||
hipDeviceAttributeMaxBlockDimX, ///< Maximum x-dimension of a block.
|
||||
hipDeviceAttributeMaxBlockDimY, ///< Maximum y-dimension of a block.
|
||||
hipDeviceAttributeMaxBlockDimZ, ///< Maximum z-dimension of a block.
|
||||
hipDeviceAttributeMaxGridDimX, ///< Maximum x-dimension of a grid.
|
||||
hipDeviceAttributeMaxGridDimY, ///< Maximum y-dimension of a grid.
|
||||
hipDeviceAttributeMaxGridDimZ, ///< Maximum z-dimension of a grid.
|
||||
hipDeviceAttributeMaxSharedMemoryPerBlock, ///< Maximum shared memory available per block in bytes.
|
||||
hipDeviceAttributeTotalConstantMemory, ///< Constant memory size in bytes.
|
||||
hipDeviceAttributeWarpSize, ///< Warp size in threads.
|
||||
hipDeviceAttributeMaxRegistersPerBlock, ///< Maximum number of 32-bit registers available to a thread block. This number is shared by all thread blocks simultaneously resident on a multiprocessor.
|
||||
hipDeviceAttributeClockRate, ///< Peak clock frequency in kilohertz.
|
||||
hipDeviceAttributeMultiprocessorCount, ///< Number of multiprocessors on the device.
|
||||
hipDeviceAttributeComputeMode, ///< Compute mode that device is currently in.
|
||||
hipDeviceAttributeL2CacheSize, ///< Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.
|
||||
hipDeviceAttributeMaxThreadsPerMultiProcessor, ///< Maximum resident threads per multiprocessor.
|
||||
hipDeviceAttributeComputeCapabilityMajor, ///< Major compute capability version number.
|
||||
hipDeviceAttributeComputeCapabilityMinor, ///< Minor compute capability version number.
|
||||
hipDeviceAttributeMaxThreadsPerBlock, ///< Maximum number of threads per block.
|
||||
hipDeviceAttributeMaxBlockDimX, ///< Maximum x-dimension of a block.
|
||||
hipDeviceAttributeMaxBlockDimY, ///< Maximum y-dimension of a block.
|
||||
hipDeviceAttributeMaxBlockDimZ, ///< Maximum z-dimension of a block.
|
||||
hipDeviceAttributeMaxGridDimX, ///< Maximum x-dimension of a grid.
|
||||
hipDeviceAttributeMaxGridDimY, ///< Maximum y-dimension of a grid.
|
||||
hipDeviceAttributeMaxGridDimZ, ///< Maximum z-dimension of a grid.
|
||||
hipDeviceAttributeMaxSharedMemoryPerBlock, ///< Maximum shared memory available per block in bytes.
|
||||
hipDeviceAttributeTotalConstantMemory, ///< Constant memory size in bytes.
|
||||
hipDeviceAttributeWarpSize, ///< Warp size in threads.
|
||||
hipDeviceAttributeMaxRegistersPerBlock, ///< Maximum number of 32-bit registers available to a thread block. This number is shared by all thread blocks simultaneously resident on a multiprocessor.
|
||||
hipDeviceAttributeClockRate, ///< Peak clock frequency in kilohertz.
|
||||
hipDeviceAttributeMemoryClockRate, ///< Peak memory clock frequency in kilohertz.
|
||||
hipDeviceAttributeMemoryBusWidth, ///< Global memory bus width in bits.
|
||||
hipDeviceAttributeMultiprocessorCount, ///< Number of multiprocessors on the device.
|
||||
hipDeviceAttributeComputeMode, ///< Compute mode that device is currently in.
|
||||
hipDeviceAttributeL2CacheSize, ///< Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.
|
||||
hipDeviceAttributeMaxThreadsPerMultiProcessor, ///< Maximum resident threads per multiprocessor.
|
||||
hipDeviceAttributeComputeCapabilityMajor, ///< Major compute capability version number.
|
||||
hipDeviceAttributeComputeCapabilityMinor, ///< Minor compute capability version number.
|
||||
hipDeviceAttributeConcurrentKernels, ///< Device can possibly execute multiple kernels concurrently.
|
||||
hipDeviceAttributePciBusId, ///< PCI Bus ID.
|
||||
hipDeviceAttributePciDeviceId, ///< PCI Device ID.
|
||||
hipDeviceAttributeMaxSharedMemoryPerMultiprocessor, ///< Maximum Shared Memory Per Multiprocessor.
|
||||
hipDeviceAttributeIsMultiGpuBoard, ///< Multiple GPU devices.
|
||||
} hipDeviceAttribute_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -242,6 +242,10 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
|
||||
cdattr = cudaDevAttrMaxRegistersPerBlock; break;
|
||||
case hipDeviceAttributeClockRate:
|
||||
cdattr = cudaDevAttrClockRate; break;
|
||||
case hipDeviceAttributeMemoryClockRate:
|
||||
cdattr = cudaDevAttrMemoryClockRate; break;
|
||||
case hipDeviceAttributeMemoryBusWidth:
|
||||
cdattr = cudaDevAttrGlobalMemoryBusWidth; break;
|
||||
case hipDeviceAttributeMultiprocessorCount:
|
||||
cdattr = cudaDevAttrMultiProcessorCount; break;
|
||||
case hipDeviceAttributeComputeMode:
|
||||
@@ -252,8 +256,16 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
|
||||
cdattr = cudaDevAttrMaxThreadsPerMultiProcessor; break;
|
||||
case hipDeviceAttributeComputeCapabilityMajor:
|
||||
cdattr = cudaDevAttrComputeCapabilityMajor; break;
|
||||
case hipDeviceAttributeComputeCapabilityMinor:
|
||||
cdattr = cudaDevAttrComputeCapabilityMinor; break;
|
||||
case hipDeviceAttributeConcurrentKernels:
|
||||
cdattr = cudaDevAttrConcurrentKernels; break;
|
||||
case hipDeviceAttributePciBusId:
|
||||
cdattr = cudaDevAttrPciBusId; break;
|
||||
case hipDeviceAttributePciDeviceId:
|
||||
cdattr = cudaDevAttrPciDeviceId; break;
|
||||
case hipDeviceAttributeMaxSharedMemoryPerMultiprocessor:
|
||||
cdattr = cudaDevAttrMaxSharedMemoryPerMultiprocessor; break;
|
||||
case hipDeviceAttributeIsMultiGpuBoard:
|
||||
cdattr = cudaDevAttrIsMultiGpuBoard; break;
|
||||
default:
|
||||
cerror = cudaErrorInvalidValue; break;
|
||||
}
|
||||
@@ -263,6 +275,29 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
|
||||
return hipCUDAErrorTohipError(cerror);
|
||||
}
|
||||
|
||||
|
||||
inline static hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr){
|
||||
cudaPointerAttributes cPA;
|
||||
hipError_t err = hipCUDAErrorTohipError(cudaPointerGetAttributes(&cPA, ptr));
|
||||
if(err == hipSuccess){
|
||||
switch (cPA.memoryType){
|
||||
case cudaMemoryTypeDevice:
|
||||
attributes->memoryType = hipMemoryTypeDevice; break;
|
||||
case cudaMemoryTypeHost:
|
||||
attributes->memoryType = hipMemoryTypeHost; break;
|
||||
default:
|
||||
return hipErrorUnknownSymbol;
|
||||
}
|
||||
attributes->device = cPA.device;
|
||||
attributes->devicePointer = cPA.devicePointer;
|
||||
attributes->hostPointer = cPA.hostPointer;
|
||||
attributes->isManaged = 0;
|
||||
attributes->allocationFlags = 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
inline static hipError_t hipMemGetInfo( size_t* free, size_t* total)
|
||||
{
|
||||
return hipCUDAErrorTohipError(cudaMemGetInfo(free,total));
|
||||
|
||||
Criar uma nova questão referindo esta
Bloquear um utilizador