[hip] Data types for hipLaunchKernelExC with cooperative launch support (#42)

Этот коммит содержится в:
Betigeri, Sourabh
2025-04-01 08:33:22 -07:00
коммит произвёл GitHub
родитель 42419ff0d6
Коммит 0dfd257dc2
2 изменённых файлов: 142 добавлений и 72 удалений
+58 -61
Просмотреть файл
@@ -53,7 +53,7 @@ typedef enum hipChannelFormatKind {
hipChannelFormatKindUnsigned = 1, ///< Unsigned channel format
hipChannelFormatKindFloat = 2, ///< Float channel format
hipChannelFormatKindNone = 3 ///< No channel format
}hipChannelFormatKind;
} hipChannelFormatKind;
/**
* HIP channel format descriptor
*/
@@ -63,7 +63,7 @@ typedef struct hipChannelFormatDesc {
int z;
int w;
enum hipChannelFormatKind f; ///< Channel format kind
}hipChannelFormatDesc;
} hipChannelFormatDesc;
/** @brief The hipTexRefSetArray function flags parameter override format value*/
#define HIP_TRSA_OVERRIDE_FORMAT 0x01
/** @brief The hipTexRefSetFlags function flags parameter read as integer value*/
@@ -87,28 +87,28 @@ typedef enum hipArray_Format {
HIP_AD_FORMAT_SIGNED_INT32 = 0x0a, ///< Signed 32-bit array format
HIP_AD_FORMAT_HALF = 0x10, ///< Half array format
HIP_AD_FORMAT_FLOAT = 0x20 ///< Float array format
}hipArray_Format;
} hipArray_Format;
/**
* HIP array descriptor
*/
typedef struct HIP_ARRAY_DESCRIPTOR {
size_t Width; ///< Width of the array
size_t Height; ///< Height of the array
enum hipArray_Format Format; ///< Format of the array
unsigned int NumChannels; ///< Number of channels of the array
}HIP_ARRAY_DESCRIPTOR;
size_t Width; ///< Width of the array
size_t Height; ///< Height of the array
enum hipArray_Format Format; ///< Format of the array
unsigned int NumChannels; ///< Number of channels of the array
} HIP_ARRAY_DESCRIPTOR;
/**
* HIP 3D array descriptor
*/
typedef struct HIP_ARRAY3D_DESCRIPTOR {
size_t Width; ///< Width of the array
size_t Height; ///< Height of the array
size_t Depth; ///< Depth of the array
enum hipArray_Format Format; ///< Format of the array
unsigned int NumChannels; ///< Number of channels of the array
unsigned int Flags; ///< Flags of the array
}HIP_ARRAY3D_DESCRIPTOR;
size_t Width; ///< Width of the array
size_t Height; ///< Height of the array
size_t Depth; ///< Depth of the array
enum hipArray_Format Format; ///< Format of the array
unsigned int NumChannels; ///< Number of channels of the array
unsigned int Flags; ///< Flags of the array
} HIP_ARRAY3D_DESCRIPTOR;
#if !defined(__HIPCC_RTC__)
/**
* HIP 2D memory copy parameters
@@ -136,17 +136,17 @@ typedef struct hip_Memcpy2D {
* HIP mipmapped array
*/
typedef struct hipMipmappedArray {
void* data; ///< Data pointer of the mipmapped array
struct hipChannelFormatDesc desc; ///< Description of the mipmapped array
unsigned int type; ///< Type of the mipmapped array
unsigned int width; ///< Width of the mipmapped array
unsigned int height; ///< Height of the mipmapped array
unsigned int depth; ///< Depth of the mipmapped array
unsigned int min_mipmap_level; ///< Minimum level of the mipmapped array
unsigned int max_mipmap_level; ///< Maximum level of the mipmapped array
unsigned int flags; ///< Flags of the mipmapped array
enum hipArray_Format format; ///< Format of the mipmapped array
unsigned int num_channels; ///< Number of channels of the mipmapped array
void* data; ///< Data pointer of the mipmapped array
struct hipChannelFormatDesc desc; ///< Description of the mipmapped array
unsigned int type; ///< Type of the mipmapped array
unsigned int width; ///< Width of the mipmapped array
unsigned int height; ///< Height of the mipmapped array
unsigned int depth; ///< Depth of the mipmapped array
unsigned int min_mipmap_level; ///< Minimum level of the mipmapped array
unsigned int max_mipmap_level; ///< Maximum level of the mipmapped array
unsigned int flags; ///< Flags of the mipmapped array
enum hipArray_Format format; ///< Format of the mipmapped array
unsigned int num_channels; ///< Number of channels of the mipmapped array
} hipMipmappedArray;
/**
* HIP mipmapped array pointer
@@ -162,7 +162,7 @@ typedef enum hipResourceType {
hipResourceTypeMipmappedArray = 0x01, ///< Mipmapped array resource
hipResourceTypeLinear = 0x02, ///< Linear resource
hipResourceTypePitch2D = 0x03 ///< Pitch 2D resource
}hipResourceType;
} hipResourceType;
typedef enum HIPresourcetype_enum {
HIP_RESOURCE_TYPE_ARRAY = 0x00, ///< Array resource
HIP_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, ///< Mipmapped array resource
@@ -239,12 +239,11 @@ typedef enum hipResourceViewFormat {
hipResViewFormatUnsignedBlockCompressed6H = 0x20, ///< Block-compressed 6 unsigned half-float
hipResViewFormatSignedBlockCompressed6H = 0x21, ///< Block-compressed 6 signed half-float
hipResViewFormatUnsignedBlockCompressed7 = 0x22 ///< Block-compressed 7
}hipResourceViewFormat;
} hipResourceViewFormat;
/**
* HIP texture resource view formats
*/
typedef enum HIPresourceViewFormat_enum
{
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 channels, unsigned 8-bit integers
@@ -306,13 +305,12 @@ typedef struct hipResourceDesc {
size_t pitchInBytes; ///< Pitch between two rows in bytes
} pitch2D;
} res;
}hipResourceDesc;
} hipResourceDesc;
/**
* HIP resource view descriptor struct
*/
typedef struct HIP_RESOURCE_DESC_st
{
typedef struct HIP_RESOURCE_DESC_st {
HIPresourcetype resType; ///< Resource type
union {
struct {
@@ -357,8 +355,7 @@ struct hipResourceViewDesc {
/**
* Resource view descriptor
*/
typedef struct HIP_RESOURCE_VIEW_DESC_st
{
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
@@ -390,7 +387,7 @@ typedef struct hipPitchedPtr {
size_t pitch; ///< Pitch in bytes
size_t xsize; ///< Logical size of the first dimension of allocation in elements
size_t ysize; ///< Logical size of the second dimension of allocation in elements
}hipPitchedPtr;
} hipPitchedPtr;
/**
* HIP extent
*/
@@ -399,7 +396,7 @@ typedef struct hipExtent {
// linear memory
size_t height;
size_t depth;
}hipExtent;
} hipExtent;
/**
* HIP position
*/
@@ -407,7 +404,7 @@ typedef struct hipPos {
size_t x; ///< X coordinate
size_t y; ///< Y coordinate
size_t z; ///< Z coordinate
}hipPos;
} hipPos;
/**
* HIP 3D memory copy parameters
*/
@@ -425,29 +422,29 @@ typedef struct hipMemcpy3DParms {
* HIP 3D memory copy
*/
typedef struct HIP_MEMCPY3D {
size_t srcXInBytes; ///< Source X in bytes
size_t srcY; ///< Source Y
size_t srcZ; ///< Source Z
size_t srcLOD; ///< Source LOD
hipMemoryType srcMemoryType; ///< Source memory type
const void* srcHost; ///< Source host pointer
hipDeviceptr_t srcDevice; ///< Source device
hipArray_t srcArray; ///< Source array
size_t srcPitch; ///< Source pitch
size_t srcHeight; ///< Source height
size_t dstXInBytes; ///< Destination X in bytes
size_t dstY; ///< Destination Y
size_t dstZ; ///< Destination Z
size_t dstLOD; ///< Destination LOD
hipMemoryType dstMemoryType; ///< Destination memory type
void* dstHost; ///< Destination host pointer
hipDeviceptr_t dstDevice; ///< Destination device
hipArray_t dstArray; ///< Destination array
size_t dstPitch; ///< Destination pitch
size_t dstHeight; ///< Destination height
size_t WidthInBytes; ///< Width in bytes of 3D memory copy
size_t Height; ///< Height in bytes of 3D memory copy
size_t Depth; ///< Depth in bytes of 3D memory copy
size_t srcXInBytes; ///< Source X in bytes
size_t srcY; ///< Source Y
size_t srcZ; ///< Source Z
size_t srcLOD; ///< Source LOD
hipMemoryType srcMemoryType; ///< Source memory type
const void* srcHost; ///< Source host pointer
hipDeviceptr_t srcDevice; ///< Source device
hipArray_t srcArray; ///< Source array
size_t srcPitch; ///< Source pitch
size_t srcHeight; ///< Source height
size_t dstXInBytes; ///< Destination X in bytes
size_t dstY; ///< Destination Y
size_t dstZ; ///< Destination Z
size_t dstLOD; ///< Destination LOD
hipMemoryType dstMemoryType; ///< Destination memory type
void* dstHost; ///< Destination host pointer
hipDeviceptr_t dstDevice; ///< Destination device
hipArray_t dstArray; ///< Destination array
size_t dstPitch; ///< Destination pitch
size_t dstHeight; ///< Destination height
size_t WidthInBytes; ///< Width in bytes of 3D memory copy
size_t Height; ///< Height in bytes of 3D memory copy
size_t Depth; ///< Depth in bytes of 3D memory copy
} HIP_MEMCPY3D;
/**
* @brief Make hipPitchedPtr
+84 -11
Просмотреть файл
@@ -1150,9 +1150,9 @@ typedef struct hipMemPoolPtrExportData {
* @warning On AMD devices and some Nvidia devices, these hints and controls are ignored.
*/
typedef enum hipFuncAttribute {
hipFuncAttributeMaxDynamicSharedMemorySize = 8,
hipFuncAttributePreferredSharedMemoryCarveout = 9,
hipFuncAttributeMax
hipFuncAttributeMaxDynamicSharedMemorySize = 8, ///< The maximum number of bytes requested for dynamically allocated shared memory
hipFuncAttributePreferredSharedMemoryCarveout = 9, ///< Sets the percentage of total shared memory allocated as the shared memory carveout
hipFuncAttributeMax
} hipFuncAttribute;
/**
* @warning On AMD devices and some Nvidia devices, these hints and controls are ignored.
@@ -1429,20 +1429,21 @@ typedef struct hipAccessPolicyWindow {
* Launch Attribute ID
*/
typedef enum hipLaunchAttributeID {
hipLaunchAttributeAccessPolicyWindow = 1, /**< Valid for Streams, graph nodes, launches*/
hipLaunchAttributeCooperative = 2, /**< Valid for graph nodes, launches */
hipLaunchAttributePriority = 8, /**< Valid for graph node, streams, launches */
hipLaunchAttributeAccessPolicyWindow = 1, ///< Valid for Streams, graph nodes, launches
hipLaunchAttributeCooperative = 2, ///< Valid for graph nodes, launches
hipLaunchAttributePriority = 8, ///< Valid for graph node, streams, launches
hipLaunchAttributeMax
} hipLaunchAttributeID;
/**
* Launch Attribute Value
*/
typedef union hipLaunchAttributeValue {
hipAccessPolicyWindow accessPolicyWindow; /**< Value of launch attribute::
hipLaunchAttributePolicyWindow. */
int cooperative; /**< Value of launch attribute ::hipLaunchAttributeCooperative */
int priority; /**< Value of launch attribute :: hipLaunchAttributePriority. Execution
priority of kernel. */
char pad[64]; ///< 64 byte padding
hipAccessPolicyWindow accessPolicyWindow; ///< Value of launch attribute ::hipLaunchAttributePolicyWindow.
int cooperative; ///< Value of launch attribute ::hipLaunchAttributeCooperative. Indicates whether the kernel is cooperative.
int priority; ///< Value of launch attribute :: hipLaunchAttributePriority. Execution priority of kernel
} hipLaunchAttributeValue;
/**
@@ -1791,6 +1792,47 @@ typedef struct hipGraphEdgeData {
unsigned char type; ///< This should be populated with a value from hipGraphDependencyType
} hipGraphEdgeData;
/**
* Used to specify custom attributes for launching kernels
*/
typedef struct hipLaunchAttribute_st {
hipLaunchAttributeID id; ///< Identifier of the launch attribute
char pad[8 - sizeof(hipLaunchAttributeID)]; ///< Padding to align the structure to 8 bytes
union {
hipLaunchAttributeValue val; ///< Value associated with the launch attribute
hipLaunchAttributeValue value; ///< Value associated with the launch attribute
};
} hipLaunchAttribute;
/**
* HIP extensible launch configuration
*/
typedef struct hipLaunchConfig_st {
dim3 gridDim; ///< Grid dimensions
dim3 blockDim; ///< Block dimensions
size_t dynamicSmemBytes; ///< Dynamic shared-memory size per thread block
hipStream_t stream; ///< Stream identifier
hipLaunchAttribute* attrs; ///< Attributes list
unsigned int numAttrs; ///< Number of attributes
} hipLaunchConfig_t;
/**
* HIP driver extensible launch configuration
*/
typedef struct HIP_LAUNCH_CONFIG_st {
unsigned int gridDimX; ///< Grid width in blocks
unsigned int gridDimY; ///< Grid height in blocks
unsigned int gridDimZ; ///< Grid depth in blocks
unsigned int blockDimX; ///< Thread block dimension in X
unsigned int blockDimY; ///< Thread block dimension in Y
unsigned int blockDimZ; ///< Thread block dimension in Z
unsigned int sharedMemBytes; ///< Dynamic shared-memory size in bytes per block
hipStream_t hStream; ///< HIP stream identifier
hipLaunchAttribute* attrs; ///< Attribute list
unsigned int numAttrs; ///< Number of attributes
} HIP_LAUNCH_CONFIG;
// Doxygen end group GlobalDefs
/**
* @}
@@ -6111,6 +6153,37 @@ hipError_t hipLaunchCooperativeKernelMultiDevice(hipLaunchParams* launchParamsLi
*/
hipError_t hipExtLaunchMultiKernelMultiDevice(hipLaunchParams* launchParamsList,
int numDevices, unsigned int flags);
/**
* @brief Launches a HIP kernel using a generic function pointer and the specified configuration.
* @ingroup Execution
*
* This function is equivalent to hipLaunchKernelEx but accepts the kernel as a generic function
* pointer.
*
* @param [in] config Pointer to the kernel launch configuration structure.
* @param [in] fPtr Pointer to the device kernel function.
* @param [in] args Array of pointers to the kernel arguments.
*
* @returns #hipSuccess if the kernel is launched successfully, otherwise an appropriate error code.
*/
hipError_t hipLaunchKernelExC(const hipLaunchConfig_t* config, const void* fPtr, void** args);
/**
* @brief Launches a HIP kernel using the driver API with the specified configuration.
* @ingroup Execution
*
* This function dispatches the device kernel represented by a HIP function object.
* It passes both the kernel parameters and any extra configuration arguments to the kernel launch.
*
* @param [in] config Pointer to the kernel launch configuration structure.
* @param [in] f HIP function object representing the device kernel to be launched.
* @param [in] params Array of pointers to the kernel parameters.
* @param [in] extra Array of pointers for additional launch parameters or extra configuration
* data.
*
* @returns #hipSuccess if the kernel is launched successfully, otherwise an appropriate error code.
*/
hipError_t hipDrvLaunchKernelEx(const HIP_LAUNCH_CONFIG* config, hipFunction_t f, void** params,
void** extra);
// doxygen end Module
/**
* @}