SWDEV-297563 - Update hip-common declarations
Change-Id: I2545489e3dde55fb9375b9f4cc20ea271fafd3f0
[ROCm/hip commit: 54e703b17e]
Bu işleme şunda yer alıyor:
@@ -25,12 +25,420 @@ THE SOFTWARE.
|
||||
|
||||
#include <hip/hip_common.h>
|
||||
|
||||
#if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/amd_detail/amd_driver_types.h>
|
||||
#elif !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#if !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include "driver_types.h"
|
||||
#elif (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
|
||||
// The follow macro should be removed after upstream updation.
|
||||
// It's defined here for workarround of rocThrust building failure.
|
||||
#define HIP_INCLUDE_HIP_HCC_DETAIL_DRIVER_TYPES_H
|
||||
#if !defined(__HIPCC_RTC__)
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
#endif // !defined(__HIPCC_RTC__)
|
||||
typedef void* hipDeviceptr_t;
|
||||
typedef enum hipChannelFormatKind {
|
||||
hipChannelFormatKindSigned = 0,
|
||||
hipChannelFormatKindUnsigned = 1,
|
||||
hipChannelFormatKindFloat = 2,
|
||||
hipChannelFormatKindNone = 3
|
||||
}hipChannelFormatKind;
|
||||
typedef struct hipChannelFormatDesc {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int w;
|
||||
enum hipChannelFormatKind f;
|
||||
}hipChannelFormatDesc;
|
||||
#define HIP_TRSA_OVERRIDE_FORMAT 0x01
|
||||
#define HIP_TRSF_READ_AS_INTEGER 0x01
|
||||
#define HIP_TRSF_NORMALIZED_COORDINATES 0x02
|
||||
#define HIP_TRSF_SRGB 0x10
|
||||
typedef enum hipArray_Format {
|
||||
HIP_AD_FORMAT_UNSIGNED_INT8 = 0x01,
|
||||
HIP_AD_FORMAT_UNSIGNED_INT16 = 0x02,
|
||||
HIP_AD_FORMAT_UNSIGNED_INT32 = 0x03,
|
||||
HIP_AD_FORMAT_SIGNED_INT8 = 0x08,
|
||||
HIP_AD_FORMAT_SIGNED_INT16 = 0x09,
|
||||
HIP_AD_FORMAT_SIGNED_INT32 = 0x0a,
|
||||
HIP_AD_FORMAT_HALF = 0x10,
|
||||
HIP_AD_FORMAT_FLOAT = 0x20
|
||||
}hipArray_Format;
|
||||
typedef struct HIP_ARRAY_DESCRIPTOR {
|
||||
size_t Width;
|
||||
size_t Height;
|
||||
enum hipArray_Format Format;
|
||||
unsigned int NumChannels;
|
||||
}HIP_ARRAY_DESCRIPTOR;
|
||||
typedef struct HIP_ARRAY3D_DESCRIPTOR {
|
||||
size_t Width;
|
||||
size_t Height;
|
||||
size_t Depth;
|
||||
enum hipArray_Format Format;
|
||||
unsigned int NumChannels;
|
||||
unsigned int Flags;
|
||||
}HIP_ARRAY3D_DESCRIPTOR;
|
||||
typedef struct hipArray {
|
||||
void* data; // FIXME: generalize this
|
||||
struct hipChannelFormatDesc desc;
|
||||
unsigned int type;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int depth;
|
||||
enum hipArray_Format Format;
|
||||
unsigned int NumChannels;
|
||||
bool isDrv;
|
||||
unsigned int textureType;
|
||||
}hipArray;
|
||||
#if !defined(__HIPCC_RTC__)
|
||||
typedef struct hip_Memcpy2D {
|
||||
size_t srcXInBytes;
|
||||
size_t srcY;
|
||||
hipMemoryType srcMemoryType;
|
||||
const void* srcHost;
|
||||
hipDeviceptr_t srcDevice;
|
||||
hipArray* srcArray;
|
||||
size_t srcPitch;
|
||||
size_t dstXInBytes;
|
||||
size_t dstY;
|
||||
hipMemoryType dstMemoryType;
|
||||
void* dstHost;
|
||||
hipDeviceptr_t dstDevice;
|
||||
hipArray* dstArray;
|
||||
size_t dstPitch;
|
||||
size_t WidthInBytes;
|
||||
size_t Height;
|
||||
} hip_Memcpy2D;
|
||||
#endif // !defined(__HIPCC_RTC__)
|
||||
typedef struct hipArray* hipArray_t;
|
||||
typedef hipArray_t hiparray;
|
||||
typedef const struct hipArray* hipArray_const_t;
|
||||
typedef struct hipMipmappedArray {
|
||||
void* data;
|
||||
struct hipChannelFormatDesc desc;
|
||||
unsigned int type;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int depth;
|
||||
unsigned int min_mipmap_level;
|
||||
unsigned int max_mipmap_level;
|
||||
unsigned int flags;
|
||||
enum hipArray_Format format;
|
||||
} hipMipmappedArray;
|
||||
typedef struct hipMipmappedArray* hipMipmappedArray_t;
|
||||
typedef const struct hipMipmappedArray* hipMipmappedArray_const_t;
|
||||
/**
|
||||
* hip resource types
|
||||
*/
|
||||
typedef enum hipResourceType {
|
||||
hipResourceTypeArray = 0x00,
|
||||
hipResourceTypeMipmappedArray = 0x01,
|
||||
hipResourceTypeLinear = 0x02,
|
||||
hipResourceTypePitch2D = 0x03
|
||||
}hipResourceType;
|
||||
typedef enum HIPresourcetype_enum {
|
||||
HIP_RESOURCE_TYPE_ARRAY = 0x00, /**< Array resoure */
|
||||
HIP_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, /**< Mipmapped array resource */
|
||||
HIP_RESOURCE_TYPE_LINEAR = 0x02, /**< Linear resource */
|
||||
HIP_RESOURCE_TYPE_PITCH2D = 0x03 /**< Pitch 2D resource */
|
||||
} HIPresourcetype;
|
||||
/**
|
||||
* hip address modes
|
||||
*/
|
||||
typedef enum HIPaddress_mode_enum {
|
||||
HIP_TR_ADDRESS_MODE_WRAP = 0,
|
||||
HIP_TR_ADDRESS_MODE_CLAMP = 1,
|
||||
HIP_TR_ADDRESS_MODE_MIRROR = 2,
|
||||
HIP_TR_ADDRESS_MODE_BORDER = 3
|
||||
} HIPaddress_mode;
|
||||
/**
|
||||
* hip filter modes
|
||||
*/
|
||||
typedef enum HIPfilter_mode_enum {
|
||||
HIP_TR_FILTER_MODE_POINT = 0,
|
||||
HIP_TR_FILTER_MODE_LINEAR = 1
|
||||
} HIPfilter_mode;
|
||||
/**
|
||||
* Texture descriptor
|
||||
*/
|
||||
typedef struct HIP_TEXTURE_DESC_st {
|
||||
HIPaddress_mode addressMode[3]; /**< Address modes */
|
||||
HIPfilter_mode filterMode; /**< Filter mode */
|
||||
unsigned int flags; /**< Flags */
|
||||
unsigned int maxAnisotropy; /**< Maximum anisotropy ratio */
|
||||
HIPfilter_mode mipmapFilterMode; /**< Mipmap filter mode */
|
||||
float mipmapLevelBias; /**< Mipmap level bias */
|
||||
float minMipmapLevelClamp; /**< Mipmap minimum level clamp */
|
||||
float maxMipmapLevelClamp; /**< Mipmap maximum level clamp */
|
||||
float borderColor[4]; /**< Border Color */
|
||||
int reserved[12];
|
||||
} HIP_TEXTURE_DESC;
|
||||
/**
|
||||
* hip texture resource view formats
|
||||
*/
|
||||
typedef enum hipResourceViewFormat {
|
||||
hipResViewFormatNone = 0x00,
|
||||
hipResViewFormatUnsignedChar1 = 0x01,
|
||||
hipResViewFormatUnsignedChar2 = 0x02,
|
||||
hipResViewFormatUnsignedChar4 = 0x03,
|
||||
hipResViewFormatSignedChar1 = 0x04,
|
||||
hipResViewFormatSignedChar2 = 0x05,
|
||||
hipResViewFormatSignedChar4 = 0x06,
|
||||
hipResViewFormatUnsignedShort1 = 0x07,
|
||||
hipResViewFormatUnsignedShort2 = 0x08,
|
||||
hipResViewFormatUnsignedShort4 = 0x09,
|
||||
hipResViewFormatSignedShort1 = 0x0a,
|
||||
hipResViewFormatSignedShort2 = 0x0b,
|
||||
hipResViewFormatSignedShort4 = 0x0c,
|
||||
hipResViewFormatUnsignedInt1 = 0x0d,
|
||||
hipResViewFormatUnsignedInt2 = 0x0e,
|
||||
hipResViewFormatUnsignedInt4 = 0x0f,
|
||||
hipResViewFormatSignedInt1 = 0x10,
|
||||
hipResViewFormatSignedInt2 = 0x11,
|
||||
hipResViewFormatSignedInt4 = 0x12,
|
||||
hipResViewFormatHalf1 = 0x13,
|
||||
hipResViewFormatHalf2 = 0x14,
|
||||
hipResViewFormatHalf4 = 0x15,
|
||||
hipResViewFormatFloat1 = 0x16,
|
||||
hipResViewFormatFloat2 = 0x17,
|
||||
hipResViewFormatFloat4 = 0x18,
|
||||
hipResViewFormatUnsignedBlockCompressed1 = 0x19,
|
||||
hipResViewFormatUnsignedBlockCompressed2 = 0x1a,
|
||||
hipResViewFormatUnsignedBlockCompressed3 = 0x1b,
|
||||
hipResViewFormatUnsignedBlockCompressed4 = 0x1c,
|
||||
hipResViewFormatSignedBlockCompressed4 = 0x1d,
|
||||
hipResViewFormatUnsignedBlockCompressed5 = 0x1e,
|
||||
hipResViewFormatSignedBlockCompressed5 = 0x1f,
|
||||
hipResViewFormatUnsignedBlockCompressed6H = 0x20,
|
||||
hipResViewFormatSignedBlockCompressed6H = 0x21,
|
||||
hipResViewFormatUnsignedBlockCompressed7 = 0x22
|
||||
}hipResourceViewFormat;
|
||||
typedef enum HIPresourceViewFormat_enum
|
||||
{
|
||||
HIP_RES_VIEW_FORMAT_NONE = 0x00, /**< No resource view format (use underlying resource format) */
|
||||
HIP_RES_VIEW_FORMAT_UINT_1X8 = 0x01, /**< 1 channel unsigned 8-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_2X8 = 0x02, /**< 2 channel unsigned 8-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_4X8 = 0x03, /**< 4 channel unsigned 8-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_1X8 = 0x04, /**< 1 channel signed 8-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_2X8 = 0x05, /**< 2 channel signed 8-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_4X8 = 0x06, /**< 4 channel signed 8-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_1X16 = 0x07, /**< 1 channel unsigned 16-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_2X16 = 0x08, /**< 2 channel unsigned 16-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_4X16 = 0x09, /**< 4 channel unsigned 16-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_1X16 = 0x0a, /**< 1 channel signed 16-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_2X16 = 0x0b, /**< 2 channel signed 16-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_4X16 = 0x0c, /**< 4 channel signed 16-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_1X32 = 0x0d, /**< 1 channel unsigned 32-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_2X32 = 0x0e, /**< 2 channel unsigned 32-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_UINT_4X32 = 0x0f, /**< 4 channel unsigned 32-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_1X32 = 0x10, /**< 1 channel signed 32-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_2X32 = 0x11, /**< 2 channel signed 32-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_SINT_4X32 = 0x12, /**< 4 channel signed 32-bit integers */
|
||||
HIP_RES_VIEW_FORMAT_FLOAT_1X16 = 0x13, /**< 1 channel 16-bit floating point */
|
||||
HIP_RES_VIEW_FORMAT_FLOAT_2X16 = 0x14, /**< 2 channel 16-bit floating point */
|
||||
HIP_RES_VIEW_FORMAT_FLOAT_4X16 = 0x15, /**< 4 channel 16-bit floating point */
|
||||
HIP_RES_VIEW_FORMAT_FLOAT_1X32 = 0x16, /**< 1 channel 32-bit floating point */
|
||||
HIP_RES_VIEW_FORMAT_FLOAT_2X32 = 0x17, /**< 2 channel 32-bit floating point */
|
||||
HIP_RES_VIEW_FORMAT_FLOAT_4X32 = 0x18, /**< 4 channel 32-bit floating point */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC1 = 0x19, /**< Block compressed 1 */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC2 = 0x1a, /**< Block compressed 2 */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC3 = 0x1b, /**< Block compressed 3 */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC4 = 0x1c, /**< Block compressed 4 unsigned */
|
||||
HIP_RES_VIEW_FORMAT_SIGNED_BC4 = 0x1d, /**< Block compressed 4 signed */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC5 = 0x1e, /**< Block compressed 5 unsigned */
|
||||
HIP_RES_VIEW_FORMAT_SIGNED_BC5 = 0x1f, /**< Block compressed 5 signed */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20, /**< Block compressed 6 unsigned half-float */
|
||||
HIP_RES_VIEW_FORMAT_SIGNED_BC6H = 0x21, /**< Block compressed 6 signed half-float */
|
||||
HIP_RES_VIEW_FORMAT_UNSIGNED_BC7 = 0x22 /**< Block compressed 7 */
|
||||
} HIPresourceViewFormat;
|
||||
/**
|
||||
* HIP resource descriptor
|
||||
*/
|
||||
typedef struct hipResourceDesc {
|
||||
enum hipResourceType resType;
|
||||
union {
|
||||
struct {
|
||||
hipArray_t array;
|
||||
} array;
|
||||
struct {
|
||||
hipMipmappedArray_t mipmap;
|
||||
} mipmap;
|
||||
struct {
|
||||
void* devPtr;
|
||||
struct hipChannelFormatDesc desc;
|
||||
size_t sizeInBytes;
|
||||
} linear;
|
||||
struct {
|
||||
void* devPtr;
|
||||
struct hipChannelFormatDesc desc;
|
||||
size_t width;
|
||||
size_t height;
|
||||
size_t pitchInBytes;
|
||||
} pitch2D;
|
||||
} res;
|
||||
}hipResourceDesc;
|
||||
typedef struct HIP_RESOURCE_DESC_st
|
||||
{
|
||||
HIPresourcetype resType; /**< Resource type */
|
||||
union {
|
||||
struct {
|
||||
hipArray_t hArray; /**< HIP array */
|
||||
} array;
|
||||
struct {
|
||||
hipMipmappedArray_t hMipmappedArray; /**< HIP mipmapped array */
|
||||
} mipmap;
|
||||
struct {
|
||||
hipDeviceptr_t devPtr; /**< Device pointer */
|
||||
hipArray_Format format; /**< Array format */
|
||||
unsigned int numChannels; /**< Channels per array element */
|
||||
size_t sizeInBytes; /**< Size in bytes */
|
||||
} linear;
|
||||
struct {
|
||||
hipDeviceptr_t devPtr; /**< Device pointer */
|
||||
hipArray_Format format; /**< Array format */
|
||||
unsigned int numChannels; /**< Channels per array element */
|
||||
size_t width; /**< Width of the array in elements */
|
||||
size_t height; /**< Height of the array in elements */
|
||||
size_t pitchInBytes; /**< Pitch between two rows in bytes */
|
||||
} pitch2D;
|
||||
struct {
|
||||
int reserved[32];
|
||||
} reserved;
|
||||
} res;
|
||||
unsigned int flags; /**< Flags (must be zero) */
|
||||
} HIP_RESOURCE_DESC;
|
||||
/**
|
||||
* hip resource view descriptor
|
||||
*/
|
||||
struct hipResourceViewDesc {
|
||||
enum hipResourceViewFormat format;
|
||||
size_t width;
|
||||
size_t height;
|
||||
size_t depth;
|
||||
unsigned int firstMipmapLevel;
|
||||
unsigned int lastMipmapLevel;
|
||||
unsigned int firstLayer;
|
||||
unsigned int lastLayer;
|
||||
};
|
||||
/**
|
||||
* Resource view descriptor
|
||||
*/
|
||||
typedef struct HIP_RESOURCE_VIEW_DESC_st
|
||||
{
|
||||
HIPresourceViewFormat format; /**< Resource view format */
|
||||
size_t width; /**< Width of the resource view */
|
||||
size_t height; /**< Height of the resource view */
|
||||
size_t depth; /**< Depth of the resource view */
|
||||
unsigned int firstMipmapLevel; /**< First defined mipmap level */
|
||||
unsigned int lastMipmapLevel; /**< Last defined mipmap level */
|
||||
unsigned int firstLayer; /**< First layer index */
|
||||
unsigned int lastLayer; /**< Last layer index */
|
||||
unsigned int reserved[16];
|
||||
} HIP_RESOURCE_VIEW_DESC;
|
||||
/**
|
||||
* Memory copy types
|
||||
*
|
||||
*/
|
||||
#if !defined(__HIPCC_RTC__)
|
||||
typedef enum hipMemcpyKind {
|
||||
hipMemcpyHostToHost = 0, ///< Host-to-Host Copy
|
||||
hipMemcpyHostToDevice = 1, ///< Host-to-Device Copy
|
||||
hipMemcpyDeviceToHost = 2, ///< Device-to-Host Copy
|
||||
hipMemcpyDeviceToDevice = 3, ///< Device-to-Device Copy
|
||||
hipMemcpyDefault =
|
||||
4 ///< Runtime will automatically determine copy-kind based on virtual addresses.
|
||||
} hipMemcpyKind;
|
||||
typedef struct hipPitchedPtr {
|
||||
void* ptr;
|
||||
size_t pitch;
|
||||
size_t xsize;
|
||||
size_t ysize;
|
||||
}hipPitchedPtr;
|
||||
typedef struct hipExtent {
|
||||
size_t width; // Width in elements when referring to array memory, in bytes when referring to
|
||||
// linear memory
|
||||
size_t height;
|
||||
size_t depth;
|
||||
}hipExtent;
|
||||
typedef struct hipPos {
|
||||
size_t x;
|
||||
size_t y;
|
||||
size_t z;
|
||||
}hipPos;
|
||||
typedef struct hipMemcpy3DParms {
|
||||
hipArray_t srcArray;
|
||||
struct hipPos srcPos;
|
||||
struct hipPitchedPtr srcPtr;
|
||||
hipArray_t dstArray;
|
||||
struct hipPos dstPos;
|
||||
struct hipPitchedPtr dstPtr;
|
||||
struct hipExtent extent;
|
||||
enum hipMemcpyKind kind;
|
||||
} hipMemcpy3DParms;
|
||||
typedef struct HIP_MEMCPY3D {
|
||||
unsigned int srcXInBytes;
|
||||
unsigned int srcY;
|
||||
unsigned int srcZ;
|
||||
unsigned int srcLOD;
|
||||
hipMemoryType srcMemoryType;
|
||||
const void* srcHost;
|
||||
hipDeviceptr_t srcDevice;
|
||||
hipArray_t srcArray;
|
||||
unsigned int srcPitch;
|
||||
unsigned int srcHeight;
|
||||
unsigned int dstXInBytes;
|
||||
unsigned int dstY;
|
||||
unsigned int dstZ;
|
||||
unsigned int dstLOD;
|
||||
hipMemoryType dstMemoryType;
|
||||
void* dstHost;
|
||||
hipDeviceptr_t dstDevice;
|
||||
hipArray_t dstArray;
|
||||
unsigned int dstPitch;
|
||||
unsigned int dstHeight;
|
||||
unsigned int WidthInBytes;
|
||||
unsigned int Height;
|
||||
unsigned int Depth;
|
||||
} HIP_MEMCPY3D;
|
||||
static inline struct hipPitchedPtr make_hipPitchedPtr(void* d, size_t p, size_t xsz,
|
||||
size_t ysz) {
|
||||
struct hipPitchedPtr s;
|
||||
s.ptr = d;
|
||||
s.pitch = p;
|
||||
s.xsize = xsz;
|
||||
s.ysize = ysz;
|
||||
return s;
|
||||
}
|
||||
static inline struct hipPos make_hipPos(size_t x, size_t y, size_t z) {
|
||||
struct hipPos p;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
p.z = z;
|
||||
return p;
|
||||
}
|
||||
static inline struct hipExtent make_hipExtent(size_t w, size_t h, size_t d) {
|
||||
struct hipExtent e;
|
||||
e.width = w;
|
||||
e.height = h;
|
||||
e.depth = d;
|
||||
return e;
|
||||
}
|
||||
typedef enum hipFunction_attribute {
|
||||
HIP_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK,
|
||||
HIP_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES,
|
||||
HIP_FUNC_ATTRIBUTE_CONST_SIZE_BYTES,
|
||||
HIP_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES,
|
||||
HIP_FUNC_ATTRIBUTE_NUM_REGS,
|
||||
HIP_FUNC_ATTRIBUTE_PTX_VERSION,
|
||||
HIP_FUNC_ATTRIBUTE_BINARY_VERSION,
|
||||
HIP_FUNC_ATTRIBUTE_CACHE_MODE_CA,
|
||||
HIP_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES,
|
||||
HIP_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT,
|
||||
HIP_FUNC_ATTRIBUTE_MAX
|
||||
}hipFunction_attribute;
|
||||
#endif // !defined(__HIPCC_RTC__)
|
||||
#else
|
||||
#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -463,8 +463,8 @@ enum hipComputeMode {
|
||||
#define GENERIC_GRID_LAUNCH 1
|
||||
#endif
|
||||
#include <hip/amd_detail/host_defines.h>
|
||||
#include <hip/amd_detail/amd_driver_types.h>
|
||||
#include <hip/amd_detail/amd_hip_texture_types.h>
|
||||
#include <hip/driver_types.h>
|
||||
#include <hip/texture_types.h>
|
||||
#include <hip/amd_detail/amd_hip_surface_types.h>
|
||||
#if defined(_MSC_VER)
|
||||
#define DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
|
||||
@@ -24,13 +24,6 @@ THE SOFTWARE.
|
||||
#ifndef HIP_INCLUDE_HIP_HIP_TEXTURE_TYPES_H
|
||||
#define HIP_INCLUDE_HIP_HIP_TEXTURE_TYPES_H
|
||||
|
||||
#if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/amd_detail/amd_hip_texture_types.h>
|
||||
#elif !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/nvidia_detail/nvidia_hip_texture_types.h>
|
||||
#else
|
||||
#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
|
||||
#endif
|
||||
|
||||
#include <hip/texture_types.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,10 +23,217 @@ THE SOFTWARE.
|
||||
|
||||
#include <hip/hip_common.h>
|
||||
|
||||
#if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/amd_detail/amd_hiprtc.h>
|
||||
#elif !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#if !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/nvidia_detail/nvidia_hiprtc.h>
|
||||
#else
|
||||
#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
|
||||
#elif (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
|
||||
/**
|
||||
* @addtogroup Runtime Runtime Compilation
|
||||
* @{
|
||||
* @ingroup Runtime
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#pragma GCC visibility push (default)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief hiprtcResult
|
||||
* @enum
|
||||
*
|
||||
*/
|
||||
|
||||
typedef enum hiprtcResult {
|
||||
HIPRTC_SUCCESS = 0,
|
||||
HIPRTC_ERROR_OUT_OF_MEMORY = 1,
|
||||
HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
|
||||
HIPRTC_ERROR_INVALID_INPUT = 3,
|
||||
HIPRTC_ERROR_INVALID_PROGRAM = 4,
|
||||
HIPRTC_ERROR_INVALID_OPTION = 5,
|
||||
HIPRTC_ERROR_COMPILATION = 6,
|
||||
HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
|
||||
HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
|
||||
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
|
||||
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
|
||||
HIPRTC_ERROR_INTERNAL_ERROR = 11
|
||||
} hiprtcResult;
|
||||
|
||||
/**
|
||||
* @brief Returns text string message to explain the error which occurred
|
||||
*
|
||||
* @param [in] result code to convert to string.
|
||||
* @return const char pointer to the NULL-terminated error string
|
||||
*
|
||||
* @warning In HIP, this function returns the name of the error,
|
||||
* if the hiprtc result is defined, it will return "Invalid HIPRTC error code"
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
const char* hiprtcGetErrorString(hiprtcResult result);
|
||||
|
||||
/**
|
||||
* @brief Sets the parameters as major and minor version.
|
||||
*
|
||||
* @param [out] major HIP Runtime Compilation major version.
|
||||
* @param [out] minor HIP Runtime Compilation minor version.
|
||||
*
|
||||
*/
|
||||
hiprtcResult hiprtcVersion(int* major, int* minor);
|
||||
|
||||
typedef struct _hiprtcProgram* hiprtcProgram;
|
||||
|
||||
/**
|
||||
* @brief Adds the given name exprssion to the runtime compilation program.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [in] name_expression const char pointer to the name expression.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* If const char pointer is NULL, it will return HIPRTC_ERROR_INVALID_INPUT.
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcAddNameExpression(hiprtcProgram prog,
|
||||
const char* name_expression);
|
||||
|
||||
/**
|
||||
* @brief Compiles the given runtime compilation program.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [in] numOptions number of compiler options.
|
||||
* @param [in] options compiler options as const array of strins.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* If the compiler failed to build the runtime compilation program,
|
||||
* it will return HIPRTC_ERROR_COMPILATION.
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcCompileProgram(hiprtcProgram prog,
|
||||
int numOptions,
|
||||
const char** options);
|
||||
|
||||
/**
|
||||
* @brief Creates an instance of hiprtcProgram with the given input parameters,
|
||||
* and sets the output hiprtcProgram prog with it.
|
||||
*
|
||||
* @param [in, out] prog runtime compilation program instance.
|
||||
* @param [in] src const char pointer to the program source.
|
||||
* @param [in] name const char pointer to the program name.
|
||||
* @param [in] numHeaders number of headers.
|
||||
* @param [in] headers array of strings pointing to headers.
|
||||
* @param [in] includeNames array of strings pointing to names included in program source.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* Any invalide input parameter, it will return HIPRTC_ERROR_INVALID_INPUT
|
||||
* or HIPRTC_ERROR_INVALID_PROGRAM.
|
||||
*
|
||||
* If failed to create the program, it will return HIPRTC_ERROR_PROGRAM_CREATION_FAILURE.
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcCreateProgram(hiprtcProgram* prog,
|
||||
const char* src,
|
||||
const char* name,
|
||||
int numHeaders,
|
||||
const char** headers,
|
||||
const char** includeNames);
|
||||
|
||||
/**
|
||||
* @brief Destroys an instance of given hiprtcProgram.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* If prog is NULL, it will return HIPRTC_ERROR_INVALID_INPUT.
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcDestroyProgram(hiprtcProgram* prog);
|
||||
|
||||
/**
|
||||
* @brief Gets the lowered (mangled) name from an instance of hiprtcProgram with the given input parameters,
|
||||
* and sets the output lowered_name with it.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [in] name_expression const char pointer to the name expression.
|
||||
* @param [in, out] lowered_name const char array to the lowered (mangled) name.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* If any invalide nullptr input parameters, it will return HIPRTC_ERROR_INVALID_INPUT
|
||||
*
|
||||
* If name_expression is not found, it will return HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID
|
||||
*
|
||||
* If failed to get lowered_name from the program, it will return HIPRTC_ERROR_COMPILATION.
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog,
|
||||
const char* name_expression,
|
||||
const char** lowered_name);
|
||||
|
||||
/**
|
||||
* @brief Gets the log generated by the runtime compilation program instance.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [out] log memory pointer to the generated log.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcGetProgramLog(hiprtcProgram prog, char* log);
|
||||
|
||||
/**
|
||||
* @brief Gets the size of log generated by the runtime compilation program instance.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [out] logSizeRet size of generated log.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram prog,
|
||||
size_t* logSizeRet);
|
||||
|
||||
/**
|
||||
* @brief Gets the pointer of compilation binary by the runtime compilation program instance.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [out] code char pointer to binary.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcGetCode(hiprtcProgram prog, char* code);
|
||||
|
||||
/**
|
||||
* @brief Gets the size of compilation binary by the runtime compilation program instance.
|
||||
*
|
||||
* @param [in] prog runtime compilation program instance.
|
||||
* @param [out] code the size of binary.
|
||||
* @return HIPRTC_SUCCESS
|
||||
*
|
||||
* @see hiprtcResult
|
||||
*/
|
||||
hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog, size_t* codeSizeRet);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
// doxygen end HIPrtc feature
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#else
|
||||
#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,22 @@ THE SOFTWARE.
|
||||
#include <hip/hip_common.h>
|
||||
|
||||
#if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/amd_detail/amd_library_types.h>
|
||||
|
||||
typedef enum hipDataType {
|
||||
HIP_R_16F = 2,
|
||||
HIP_R_32F = 0,
|
||||
HIP_R_64F = 1,
|
||||
HIP_C_16F = 6,
|
||||
HIP_C_32F = 4,
|
||||
HIP_C_64F = 5
|
||||
} hipDataType;
|
||||
|
||||
typedef enum hipLibraryPropertyType {
|
||||
HIP_LIBRARY_MAJOR_VERSION,
|
||||
HIP_LIBRARY_MINOR_VERSION,
|
||||
HIP_LIBRARY_PATCH_LEVEL
|
||||
} hipLibraryPropertyType;
|
||||
|
||||
#elif !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include "library_types.h"
|
||||
#else
|
||||
|
||||
@@ -25,10 +25,156 @@ THE SOFTWARE.
|
||||
|
||||
#include <hip/hip_common.h>
|
||||
|
||||
#if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include <hip/amd_detail/amd_texture_types.h>
|
||||
#elif !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#if !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
#include "texture_types.h"
|
||||
#elif (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#if !defined(__HIPCC_RTC__)
|
||||
#include <limits.h>
|
||||
#include <hip/channel_descriptor.h>
|
||||
#endif // !defined(__HIPCC_RTC__)
|
||||
|
||||
#include <hip/driver_types.h>
|
||||
|
||||
#define hipTextureType1D 0x01
|
||||
#define hipTextureType2D 0x02
|
||||
#define hipTextureType3D 0x03
|
||||
#define hipTextureTypeCubemap 0x0C
|
||||
#define hipTextureType1DLayered 0xF1
|
||||
#define hipTextureType2DLayered 0xF2
|
||||
#define hipTextureTypeCubemapLayered 0xFC
|
||||
|
||||
/**
|
||||
* Should be same as HSA_IMAGE_OBJECT_SIZE_DWORD/HSA_SAMPLER_OBJECT_SIZE_DWORD
|
||||
*/
|
||||
#define HIP_IMAGE_OBJECT_SIZE_DWORD 12
|
||||
#define HIP_SAMPLER_OBJECT_SIZE_DWORD 8
|
||||
#define HIP_SAMPLER_OBJECT_OFFSET_DWORD HIP_IMAGE_OBJECT_SIZE_DWORD
|
||||
#define HIP_TEXTURE_OBJECT_SIZE_DWORD (HIP_IMAGE_OBJECT_SIZE_DWORD + HIP_SAMPLER_OBJECT_SIZE_DWORD)
|
||||
|
||||
/**
|
||||
* An opaque value that represents a hip texture object
|
||||
*/
|
||||
struct __hip_texture;
|
||||
typedef struct __hip_texture* hipTextureObject_t;
|
||||
|
||||
/**
|
||||
* hip texture address modes
|
||||
*/
|
||||
enum hipTextureAddressMode {
|
||||
hipAddressModeWrap = 0,
|
||||
hipAddressModeClamp = 1,
|
||||
hipAddressModeMirror = 2,
|
||||
hipAddressModeBorder = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* hip texture filter modes
|
||||
*/
|
||||
enum hipTextureFilterMode { hipFilterModePoint = 0, hipFilterModeLinear = 1 };
|
||||
|
||||
/**
|
||||
* hip texture read modes
|
||||
*/
|
||||
enum hipTextureReadMode { hipReadModeElementType = 0, hipReadModeNormalizedFloat = 1 };
|
||||
|
||||
/**
|
||||
* hip texture reference
|
||||
*/
|
||||
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;
|
||||
int sRGB; // Perform sRGB->linear conversion during texture read
|
||||
unsigned int maxAnisotropy; // Limit to the anisotropy ratio
|
||||
enum hipTextureFilterMode mipmapFilterMode;
|
||||
float mipmapLevelBias;
|
||||
float minMipmapLevelClamp;
|
||||
float maxMipmapLevelClamp;
|
||||
|
||||
hipTextureObject_t textureObject;
|
||||
int numChannels;
|
||||
enum hipArray_Format format;
|
||||
}textureReference;
|
||||
|
||||
/**
|
||||
* hip texture descriptor
|
||||
*/
|
||||
typedef struct hipTextureDesc {
|
||||
enum hipTextureAddressMode addressMode[3]; // Texture address mode for up to 3 dimensions
|
||||
enum hipTextureFilterMode filterMode;
|
||||
enum hipTextureReadMode readMode;
|
||||
int sRGB; // Perform sRGB->linear conversion during texture read
|
||||
float borderColor[4];
|
||||
int normalizedCoords;
|
||||
unsigned int maxAnisotropy;
|
||||
enum hipTextureFilterMode mipmapFilterMode;
|
||||
float mipmapLevelBias;
|
||||
float minMipmapLevelClamp;
|
||||
float maxMipmapLevelClamp;
|
||||
}hipTextureDesc;
|
||||
|
||||
#if __cplusplus
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#if __HIP__
|
||||
#define __HIP_TEXTURE_ATTRIB __attribute__((device_builtin_texture_type))
|
||||
#else
|
||||
#define __HIP_TEXTURE_ATTRIB
|
||||
#endif
|
||||
|
||||
typedef textureReference* hipTexRef;
|
||||
|
||||
template <class T, int texType = hipTextureType1D,
|
||||
enum hipTextureReadMode mode = hipReadModeElementType>
|
||||
struct __HIP_TEXTURE_ATTRIB texture : public textureReference {
|
||||
texture(int norm = 0, enum hipTextureFilterMode fMode = hipFilterModePoint,
|
||||
enum hipTextureAddressMode aMode = hipAddressModeClamp) {
|
||||
normalized = norm;
|
||||
readMode = mode;
|
||||
filterMode = fMode;
|
||||
addressMode[0] = aMode;
|
||||
addressMode[1] = aMode;
|
||||
addressMode[2] = aMode;
|
||||
channelDesc = hipCreateChannelDesc<T>();
|
||||
sRGB = 0;
|
||||
textureObject = nullptr;
|
||||
maxAnisotropy = 0;
|
||||
mipmapLevelBias = 0;
|
||||
minMipmapLevelClamp = 0;
|
||||
maxMipmapLevelClamp = 0;
|
||||
}
|
||||
|
||||
texture(int norm, enum hipTextureFilterMode fMode, enum hipTextureAddressMode aMode,
|
||||
struct hipChannelFormatDesc desc) {
|
||||
normalized = norm;
|
||||
readMode = mode;
|
||||
filterMode = fMode;
|
||||
addressMode[0] = aMode;
|
||||
addressMode[1] = aMode;
|
||||
addressMode[2] = aMode;
|
||||
channelDesc = desc;
|
||||
sRGB = 0;
|
||||
textureObject = nullptr;
|
||||
maxAnisotropy = 0;
|
||||
mipmapLevelBias = 0;
|
||||
minMipmapLevelClamp = 0;
|
||||
maxMipmapLevelClamp = 0;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#else
|
||||
#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
|
||||
#endif
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle