# CUPTI SASS Metrics API

## Enumerations
enum | CUpti_SassMetrics_OutputGranularity { CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_GPU = 0, CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_SM = 1, CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_SMSP = 2 }
## Functions
CUptiResult | cuptiSassMetricsDisable (CUpti_SassMetricsDisable_Params *pParams)
| SASS metric data collection disable API will mark the end of a range, any kernel launched after this API call will not be profiled for the SASS metrics.
CUptiResult | cuptiSassMetricsEnable (CUpti_SassMetricsEnable_Params *pParams)
| Sass metric data collection enable API will mark the start of a range, between which kernel will be profiled for SASS metrics.
CUptiResult | cuptiSassMetricsFlushData (CUpti_SassMetricsFlushData_Params *pParams)
| Flush SASS metrics data from CUPTI internal buffer to the user buffer. User needs to allocate the buffer for retrieving the data. The number of records collected can be queried using the API cuptiSassMetricsGetDataProperties().
CUptiResult | cuptiSassMetricsGetDataProperties (CUpti_SassMetricsGetDataProperties_Params *pParams)
| SASS metric data properties API will give the data regarding number of instances of a metric value and number of SASS instruction data has been collected. The number of instances of a metric will vary as per user set the output granularity level with CUpti_SassMetrics_OutputGranularity value. User need to allocate memory for retriving the SASS data using cuptiSassMetricsFlushData() API.
CUptiResult | cuptiSassMetricsGetMetrics (CUpti_SassMetrics_GetMetrics_Params *pParams)
| Get the list of all supported SASS metrics for the chip.
CUptiResult | cuptiSassMetricsGetNumOfMetrics (CUpti_SassMetrics_GetNumOfMetrics_Params *pParams)
| Get the number of supported SASS metrics for the chip.
CUptiResult | cuptiSassMetricsGetProperties (CUpti_SassMetrics_GetProperties_Params *pParams)
| Get metric properties for the queried metric. For a given metric the results will be put in CUpti_SassMetrics_MetricDetails which stores metric ID, description of the metric.
CUptiResult | cuptiSassMetricsSetConfig (CUpti_SassMetricsSetConfig_Params *pParams)
| Set config for the SASS metric data collection for a device. User need to call this API before calling any of the SASS metric data collection APIs. Each set config API call need to be followed by cuptiSassPatchingUnSetConfig API before calling the cuptiSassMetricsSetConfig() API again for the same device.
CUptiResult | cuptiSassMetricsUnsetConfig (CUpti_SassMetricsUnsetConfig_Params *pParams)
| Unset config API will reset the SASS metric data collection configuration for the device. Once this API called CUPTI will deallocate all the memory allocated and remove all the configuration for SASS metric data collection. User can only call this API for a device where cuptiSassMetricsSetConfig() API has been called earlier for the device.

## Detailed Description

Functions, types, and enums that implement the CUPTI SASS Metrics API.

## Enumeration Type Documentation

enum CUpti_SassMetrics_OutputGranularity

Enumerator:

  CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_GPU | SASS metric data will be collected at GPU level. In CUpti_SassMetricsGetDataProperties_Params struct the numOfInstances will be equal to 1
  CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_SM | SASS metric data will be collected at SM level In CUpti_SassMetricsGetDataProperties_Params struct the numOfInstances will be equal to number of SMs in the GPU
  CUPTI_SASS_METRICS_OUTPUT_GRANULARITY_SMSP | SASS metric data will be collected at SM sub-partition level In CUpti_SassMetricsGetDataProperties_Params struct the numOfInstances will be equal to number of SM sub-partitions in the GPU

## Function Documentation

CUptiResult cuptiSassMetricsDisable | ( | CUpti_SassMetricsDisable_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetricsDisable_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection
  | CUPTI_ERROR_INVALID_CONTEXT | if any cuda context has not been created prior to this API call
  | CUPTI_ERROR_INVALID_OPERATION | if this API is called multiple times for a cuda context without calling cuptiSassMetricsEnable() API or called before cuptiSassMetricsSetConfig() API call.

CUptiResult cuptiSassMetricsEnable | ( | CUpti_SassMetricsEnable_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetricsEnable_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection
  | CUPTI_ERROR_INVALID_CONTEXT | if any cuda context has not been created prior to this API call
  | CUPTI_ERROR_INVALID_OPERATION | if this API is called multiple times for a cuda context without calling cuptiSassMetricsDisable() API or called before cuptiSassMetricsSetConfig() API call.

CUptiResult cuptiSassMetricsFlushData | ( | CUpti_SassMetricsFlushData_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetricsFlushData_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection.
  | CUPTI_ERROR_INVALID_OPERATION | if this API is called outside the enable/disable range.

CUptiResult cuptiSassMetricsGetDataProperties | ( | CUpti_SassMetricsGetDataProperties_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetricsGetDataProperties_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection
  | CUPTI_ERROR_INVALID_OPERATION | if this API is called outside the enable/disable range.

CUptiResult cuptiSassMetricsGetMetrics | ( | CUpti_SassMetrics_GetMetrics_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetrics_GetMetrics_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric collection

CUptiResult cuptiSassMetricsGetNumOfMetrics | ( | CUpti_SassMetrics_GetNumOfMetrics_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetrics_GetNumOfMetrics_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric collection

CUptiResult cuptiSassMetricsGetProperties | ( | CUpti_SassMetrics_GetProperties_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetrics_GetProperties_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection

CUptiResult cuptiSassMetricsSetConfig | ( | CUpti_SassMetricsSetConfig_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetricsSetConfig_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_INVALID_CONTEXT | if any cuda context has not been created prior to this API call
  | CUPTI_ERROR_INVALID_OPERATION | if this is called multiple times for the device without calling unset config API
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection

CUptiResult cuptiSassMetricsUnsetConfig | ( | CUpti_SassMetricsUnsetConfig_Params * | pParams | ) |

Parameters:

  | Refer | CUpti_SassMetricsSetConfig_Params

Return values:

  | CUPTI_SUCCESS |
  | CUPTI_ERROR_INVALID_PARAMETER | if any `pParams` is not valid
  | CUPTI_ERROR_INVALID_CONTEXT | if any cuda context has not been created prior to this API call
  | CUPTI_ERROR_INVALID_OPERATION | if this is called multiple times for the device without calling set config API
  | CUPTI_ERROR_NOT_SUPPORTED | indicates that the system/device doesn't support SASS metric data collection