cuptiProfilerSetConfig para confusion

How to understand the significance of cuptiProfilerSetConfig’s parameter minNestingLevel numNestingLevels and targetNestingLevel? cupti use them control what?

The CUPTI profiler supports nested range profiling (a subset of user range profiling), allowing users to add push/pop range API calls inside a push/pop range. For example:

cuptiProfilerPushRange(“RangeA”) // Push rangeA at nesting level 1
Launch kernel A
cuptiProfilerPushRange(“RangeB”) // Push rangeB at nesting level 2
Launch kernel B
cuptiProfilerPopRange() // Pop rangeB
cuptiProfilerPopRange() // Pop rangeA

To understand the nesting parameters, consider above example:

minNestingLevel: This specifies the base nesting level that CUPTI considers when profiling. When set to 1, CUPTI will consider all the ranges starting from 1 to numNestingLevel value set in the set config structure. When set to 2, for the above sample case CUPTI will only profile RangeB.

numNestingLevel: This tells CUPTI how many nested levels to consider as ranges. In the example above, setting this to 2 would allow us to get profiling data for both RangeA and RangeB.

targetNestingLevel: This is used in application replay mode for multi-pass metrics and is set to the output of CUpti_Profiler_EndPass_Params after calling the cuptiProfilerEndPass API. It’s an intermediate value that tells CUPTI which nesting level to consider when collecting profiling data.

CUPTI provides a public sample, nested_range_profiling, where users can modify parameters to generate different outputs based on changed settings.