HIP: Heterogenous-computing Interface for Portability: Occupancy

HIP: Heterogenous-computing Interface for Portability

Functions
Occupancy
HIP API

This section describes the occupancy functions of HIP runtime API. More...

Collaboration diagram for Occupancy:

## Functions
hipError_t | hipModuleOccupancyMaxPotentialBlockSize (int *gridSize, int *blockSize, hipFunction_t f, size_t dynSharedMemPerBlk, int blockSizeLimit)
| determine the grid and block sizes to achieves maximum occupancy for a kernel More...
hipError_t | hipModuleOccupancyMaxPotentialBlockSizeWithFlags (int *gridSize, int *blockSize, hipFunction_t f, size_t dynSharedMemPerBlk, int blockSizeLimit, unsigned int flags)
| determine the grid and block sizes to achieves maximum occupancy for a kernel More...
hipError_t | hipModuleOccupancyMaxActiveBlocksPerMultiprocessor (int *numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk)
| Returns occupancy for a device function. More...
hipError_t | hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags (int *numBlocks, hipFunction_t f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags)
| Returns occupancy for a device function. More...
hipError_t | hipOccupancyMaxActiveBlocksPerMultiprocessor (int *numBlocks, const void *f, int blockSize, size_t dynSharedMemPerBlk)
| Returns occupancy for a device function. More...
hipError_t | hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags (int *numBlocks, const void *f, int blockSize, size_t dynSharedMemPerBlk, unsigned int flags __dparm(hipOccupancyDefault))
| Returns occupancy for a device function. More...
hipError_t | hipOccupancyMaxPotentialBlockSize (int *gridSize, int *blockSize, const void *f, size_t dynSharedMemPerBlk, int blockSizeLimit)
| determine the grid and block sizes to achieves maximum occupancy for a kernel More...

## Detailed Description

This section describes the occupancy functions of HIP runtime API.

## Function Documentation

## ◆ hipModuleOccupancyMaxActiveBlocksPerMultiprocessor()

hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessor | ( | int * | numBlocks,
|  | hipFunction_t | f,
|  | int | blockSize,
|  | size_t | dynSharedMemPerBlk
| ) |  |

Returns occupancy for a device function.

Parameters

  [out] | numBlocks | Returned occupancy
  [in] | func | Kernel function (hipFunction) for which occupancy is calulated
  [in] | blockSize | Block size the kernel is intended to be launched with
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block

## ◆ hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags()

hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags | ( | int * | numBlocks,
|  | hipFunction_t | f,
|  | int | blockSize,
|  | size_t | dynSharedMemPerBlk,
|  | unsigned int | flags
| ) |  |

Returns occupancy for a device function.

Parameters

  [out] | numBlocks | Returned occupancy
  [in] | f | Kernel function(hipFunction_t) for which occupancy is calulated
  [in] | blockSize | Block size the kernel is intended to be launched with
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block
  [in] | flags | Extra flags for occupancy calculation (only default supported)

## ◆ hipModuleOccupancyMaxPotentialBlockSize()

hipError_t hipModuleOccupancyMaxPotentialBlockSize | ( | int * | gridSize,
|  | int * | blockSize,
|  | hipFunction_t | f,
|  | size_t | dynSharedMemPerBlk,
|  | int | blockSizeLimit
| ) |  |

determine the grid and block sizes to achieves maximum occupancy for a kernel

Parameters

  [out] | gridSize | minimum grid size for maximum potential occupancy
  [out] | blockSize | block size for maximum potential occupancy
  [in] | f | kernel function for which occupancy is calulated
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block
  [in] | blockSizeLimit | the maximum block size for the kernel, use 0 for no limit

Returns
  hipSuccess, hipInvalidDevice, hipErrorInvalidValue

## ◆ hipModuleOccupancyMaxPotentialBlockSizeWithFlags()

hipError_t hipModuleOccupancyMaxPotentialBlockSizeWithFlags | ( | int * | gridSize,
|  | int * | blockSize,
|  | hipFunction_t | f,
|  | size_t | dynSharedMemPerBlk,
|  | int | blockSizeLimit,
|  | unsigned int | flags
| ) |  |

determine the grid and block sizes to achieves maximum occupancy for a kernel

Parameters

  [out] | gridSize | minimum grid size for maximum potential occupancy
  [out] | blockSize | block size for maximum potential occupancy
  [in] | f | kernel function for which occupancy is calulated
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block
  [in] | blockSizeLimit | the maximum block size for the kernel, use 0 for no limit
  [in] | flags | Extra flags for occupancy calculation (only default supported)

Returns
  hipSuccess, hipInvalidDevice, hipErrorInvalidValue

## ◆ hipOccupancyMaxActiveBlocksPerMultiprocessor()

hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessor | ( | int * | numBlocks,
|  | const void * | f,
|  | int | blockSize,
|  | size_t | dynSharedMemPerBlk
| ) |  |

Returns occupancy for a device function.

Parameters

  [out] | numBlocks | Returned occupancy
  [in] | func | Kernel function for which occupancy is calulated
  [in] | blockSize | Block size the kernel is intended to be launched with
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block

## ◆ hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags()

hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags | ( | int * | numBlocks,
|  | const void * | f,
|  | int | blockSize,
|  | size_t | dynSharedMemPerBlk,
|  | unsigned int flags | __dparmhipOccupancyDefault
| ) |  |

Returns occupancy for a device function.

Parameters

  [out] | numBlocks | Returned occupancy
  [in] | f | Kernel function for which occupancy is calulated
  [in] | blockSize | Block size the kernel is intended to be launched with
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block
  [in] | flags | Extra flags for occupancy calculation (currently ignored)

## ◆ hipOccupancyMaxPotentialBlockSize()

hipError_t hipOccupancyMaxPotentialBlockSize | ( | int * | gridSize,
|  | int * | blockSize,
|  | const void * | f,
|  | size_t | dynSharedMemPerBlk,
|  | int | blockSizeLimit
| ) |  |

determine the grid and block sizes to achieves maximum occupancy for a kernel

Parameters

  [out] | gridSize | minimum grid size for maximum potential occupancy
  [out] | blockSize | block size for maximum potential occupancy
  [in] | f | kernel function for which occupancy is calulated
  [in] | dynSharedMemPerBlk | dynamic shared memory usage (in bytes) intended for each block
  [in] | blockSizeLimit | the maximum block size for the kernel, use 0 for no limit

Returns
  hipSuccess, hipInvalidDevice, hipErrorInvalidValue