Merge pull request #419 from gargrahul/fix_hip_gcc_host_build

Fix gcc build issues for host code

[ROCm/clr commit: 2e6b46f308]
Этот коммит содержится в:
Maneesh Gupta
2018-05-01 12:42:50 +05:30
коммит произвёл GitHub
родитель 6183085a89 f932a51c8e
Коммит d6f360e65d
4 изменённых файлов: 43 добавлений и 64 удалений
+28 -24
Просмотреть файл
@@ -23,27 +23,31 @@ THE SOFTWARE.
#ifndef HIP_INCLUDE_HIP_HCC_DETAIL_DRIVER_TYPES_H
#define HIP_INCLUDE_HIP_HCC_DETAIL_DRIVER_TYPES_H
#ifndef __cplusplus
#include <stdbool.h>
#endif
typedef void* hipDeviceptr_t;
enum hipChannelFormatKind {
typedef enum hipChannelFormatKind {
hipChannelFormatKindSigned = 0,
hipChannelFormatKindUnsigned = 1,
hipChannelFormatKindFloat = 2,
hipChannelFormatKindNone = 3
};
}hipChannelFormatKind;
struct hipChannelFormatDesc {
typedef struct hipChannelFormatDesc {
int x;
int y;
int z;
int w;
enum hipChannelFormatKind f;
};
}hipChannelFormatDesc;
#define HIP_TRSF_NORMALIZED_COORDINATES 0x01
#define HIP_TRSF_READ_AS_INTEGER 0x00
#define HIP_TRSA_OVERRIDE_FORMAT 0x01
enum hipArray_Format {
typedef enum hipArray_Format {
HIP_AD_FORMAT_UNSIGNED_INT8 = 0x01,
HIP_AD_FORMAT_UNSIGNED_INT16 = 0x02,
HIP_AD_FORMAT_UNSIGNED_INT32 = 0x03,
@@ -52,18 +56,18 @@ enum hipArray_Format {
HIP_AD_FORMAT_SIGNED_INT32 = 0x0a,
HIP_AD_FORMAT_HALF = 0x10,
HIP_AD_FORMAT_FLOAT = 0x20
};
}hipArray_Format;
struct HIP_ARRAY_DESCRIPTOR {
typedef struct HIP_ARRAY_DESCRIPTOR {
enum hipArray_Format format;
unsigned int numChannels;
size_t width;
size_t height;
unsigned int flags;
size_t depth;
};
}HIP_ARRAY_DESCRIPTOR;
struct hipArray {
typedef struct hipArray {
void* data; // FIXME: generalize this
struct hipChannelFormatDesc desc;
unsigned int type;
@@ -73,7 +77,7 @@ struct hipArray {
struct HIP_ARRAY_DESCRIPTOR drvDesc;
bool isDrv;
unsigned int textureType;
};
}hipArray;
typedef struct hip_Memcpy2D {
size_t height;
@@ -115,17 +119,17 @@ typedef const struct hipMipmappedArray* hipMipmappedArray_const_t;
/**
* hip resource types
*/
enum hipResourceType {
typedef enum hipResourceType {
hipResourceTypeArray = 0x00,
hipResourceTypeMipmappedArray = 0x01,
hipResourceTypeLinear = 0x02,
hipResourceTypePitch2D = 0x03
};
}hipResourceType;
/**
* hip texture resource view formats
*/
enum hipResourceViewFormat {
typedef enum hipResourceViewFormat {
hipResViewFormatNone = 0x00,
hipResViewFormatUnsignedChar1 = 0x01,
hipResViewFormatUnsignedChar2 = 0x02,
@@ -161,12 +165,12 @@ enum hipResourceViewFormat {
hipResViewFormatUnsignedBlockCompressed6H = 0x20,
hipResViewFormatSignedBlockCompressed6H = 0x21,
hipResViewFormatUnsignedBlockCompressed7 = 0x22
};
}hipResourceViewFormat;
/**
* HIP resource descriptor
*/
struct hipResourceDesc {
typedef struct hipResourceDesc {
enum hipResourceType resType;
union {
@@ -189,7 +193,7 @@ struct hipResourceDesc {
size_t pitchInBytes;
} pitch2D;
} res;
};
}hipResourceDesc;
/**
* hip resource view descriptor
@@ -218,27 +222,27 @@ typedef enum hipMemcpyKind {
4 ///< Runtime will automatically determine copy-kind based on virtual addresses.
} hipMemcpyKind;
struct hipPitchedPtr {
typedef struct hipPitchedPtr {
void* ptr;
size_t pitch;
size_t xsize;
size_t ysize;
};
}hipPitchedPtr;
struct hipExtent {
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;
struct hipPos {
typedef struct hipPos {
size_t x;
size_t y;
size_t z;
};
}hipPos;
struct hipMemcpy3DParms {
typedef struct hipMemcpy3DParms {
hipArray_t srcArray;
struct hipPos srcPos;
struct hipPitchedPtr srcPtr;
@@ -273,7 +277,7 @@ struct hipMemcpy3DParms {
size_t srcXInBytes;
size_t srcY;
size_t srcZ;
};
}hipMemcpy3DParms;
static __inline__ struct hipPitchedPtr make_hipPitchedPtr(void* d, size_t p, size_t xsz,
size_t ysz) {
+9 -34
Просмотреть файл
@@ -30,7 +30,6 @@ THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#ifndef GENERIC_GRID_LAUNCH
#define GENERIC_GRID_LAUNCH 1
@@ -1317,7 +1316,7 @@ hipError_t hipMemcpyDtoDAsync(hipDeviceptr_t dst, hipDeviceptr_t src, size_t siz
* hipMemcpyFromSymbolAsync
*/
hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t sizeBytes,
size_t offset = 0, hipMemcpyKind kind = hipMemcpyHostToDevice);
size_t offset __dparm(0), hipMemcpyKind kind __dparm(hipMemcpyHostToDevice));
/**
@@ -1346,13 +1345,13 @@ hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t siz
* hipMemcpyFromSymbolAsync
*/
hipError_t hipMemcpyToSymbolAsync(const void* symbolName, const void* src, size_t sizeBytes,
size_t offset, hipMemcpyKind kind, hipStream_t stream = 0);
size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0));
hipError_t hipMemcpyFromSymbol(void* dst, const void* symbolName, size_t sizeBytes,
size_t offset = 0, hipMemcpyKind kind = hipMemcpyDeviceToHost);
size_t offset __dparm(0), hipMemcpyKind kind __dparm( hipMemcpyDeviceToHost ));
hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t sizeBytes,
size_t offset, hipMemcpyKind kind, hipStream_t stream = 0);
size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0));
/**
* @brief Copy data from src to dst asynchronously.
@@ -1382,13 +1381,8 @@ hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t si
* hipMemcpyFromArrayAsync, hipMemcpy2DFromArrayAsync, hipMemcpyToSymbolAsync,
* hipMemcpyFromSymbolAsync
*/
#if __cplusplus
hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
hipStream_t stream = 0);
#else
hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
hipStream_t stream);
#endif
hipStream_t stream __dparm(0));
/**
* @brief Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant
@@ -1427,11 +1421,7 @@ hipError_t hipMemsetD8(hipDeviceptr_t dest, unsigned char value, size_t sizeByte
* @param[in] stream - Stream identifier
* @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree
*/
#if __cplusplus
hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream = 0);
#else
hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream);
#endif
hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream __dparm(0));
/**
* @brief Fills the memory area pointed to by dst with the constant value.
@@ -1487,13 +1477,8 @@ hipError_t hipMemPtrGetInfo(void* ptr, size_t* size);
*
* @see hipMalloc, hipMallocPitch, hipFree, hipFreeArray, hipHostMalloc, hipHostFree
*/
#if __cplusplus
hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, size_t width,
size_t height = 0, unsigned int flags = hipArrayDefault);
#else
hipError_t hipMallocArray(hipArray** array, const struct hipChannelFormatDesc* desc, size_t width,
size_t height, unsigned int flags);
#endif
size_t height __dparm(0), unsigned int flags __dparm(hipArrayDefault));
hipError_t hipArrayCreate(hipArray** pHandle, const HIP_ARRAY_DESCRIPTOR* pAllocateArray);
hipError_t hipArray3DCreate(hipArray_t* array, const HIP_ARRAY_DESCRIPTOR* pAllocateArray);
@@ -1561,13 +1546,8 @@ hipError_t hipMemcpyParam2D(const hip_Memcpy2D* pCopy);
* @see hipMemcpy, hipMemcpyToArray, hipMemcpy2DToArray, hipMemcpyFromArray, hipMemcpyToSymbol,
* hipMemcpyAsync
*/
#if __cplusplus
hipError_t hipMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
size_t height, hipMemcpyKind kind, hipStream_t stream = 0);
#else
hipError_t hipMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
size_t height, hipMemcpyKind kind, hipStream_t stream);
#endif
size_t height, hipMemcpyKind kind, hipStream_t stream __dparm(0));
/**
* @brief Copies data between host and device.
@@ -1779,13 +1759,8 @@ hipError_t hipMemcpyPeer(void* dst, int dstDeviceId, const void* src, int srcDev
*
* @returns #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidDevice
*/
#if __cplusplus
hipError_t hipMemcpyPeerAsync(void* dst, int dstDeviceId, const void* src, int srcDevice,
size_t sizeBytes, hipStream_t stream = 0);
#else
hipError_t hipMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice,
size_t sizeBytes, hipStream_t stream);
#endif
size_t sizeBytes, hipStream_t stream __dparm(0));
#endif
+4 -4
Просмотреть файл
@@ -70,7 +70,7 @@ enum hipTextureReadMode { hipReadModeElementType = 0, hipReadModeNormalizedFloat
/**
* hip texture reference
*/
struct textureReference {
typedef struct textureReference {
int normalized;
enum hipTextureFilterMode filterMode;
enum hipTextureAddressMode addressMode[3]; // Texture address mode for up to 3 dimensions
@@ -85,12 +85,12 @@ struct textureReference {
hipTextureObject_t textureObject;
int numChannels;
enum hipArray_Format format;
};
}textureReference;
/**
* hip texture descriptor
*/
struct hipTextureDesc {
typedef struct hipTextureDesc {
enum hipTextureAddressMode addressMode[3]; // Texture address mode for up to 3 dimensions
enum hipTextureFilterMode filterMode;
enum hipTextureReadMode readMode;
@@ -102,6 +102,6 @@ struct hipTextureDesc {
float mipmapLevelBias;
float minMipmapLevelClamp;
float maxMipmapLevelClamp;
};
}hipTextureDesc;
#endif
+2 -2
Просмотреть файл
@@ -120,14 +120,14 @@ typedef struct hipDeviceProp_t {
/**
* Memory type (for pointer attributes)
*/
enum hipMemoryType {
typedef enum hipMemoryType {
hipMemoryTypeHost, ///< Memory is physically located on host
hipMemoryTypeDevice, ///< Memory is physically located on device. (see deviceId for specific
///< device)
hipMemoryTypeArray, ///< Array memory, physically located on device. (see deviceId for specific
///< device)
hipMemoryTypeUnified ///< Not used currently
};
}hipMemoryType;
/**