Intel® Advisor User Guide

ID 766448
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Manage Invocation Taxes

You can control how to model invocation taxes for your application.

When Intel® Advisor detects high call count value for a potentially profitable code region, it assumes that the kernel invocation tax is paid as many times as the kernel is launched. The result is high invocation tax and cost of offloading, which means that this code region cannot benefit from offloading. This is a pessimistic assumption.

However, for simple applications where there is no need to wait for a kernel instance to finish, this cost can be hidden every time except the very first one.

In the Offload Modeling report, the kernel invocation tax is reported in the Estimated Bounded By > Kernel Launch Tax column. This metric includes time spent for kernel configuration (first launch), each kernel launch, and kernel code transfers.

You can tell Intel Advisor how to handle invocation taxes for your application when modeling its performance on a target device.

NOTE:
In the commands below, <APM> is the environment variable that points to script directory. Replace it with $APM on Linux* OS or %APM% on Windows* OS.

Hide All Taxes

For simple applications, you are recommended to enable the optimistic approach for estimating invocation taxes. In this approach, Offload Modeling assumes the invocation tax is paid only for the first time the kernel executes.

To enable this approach:

  • From GUI: Enable Single Kernel Launch Tax checkbox from the Analysis Workflow and re-run the Performance Modeling analysis.
  • From command line: Run Performance Modeling with the --assume-hide-taxes option:
    advisor --collect=projection --assume-hide-taxes --project-dir=./advi_results

    where ./advi_results is a path to your project directory. Make sure to replace it with your actual project directory where you collected results to before running the command.

    NOTE:
    You can specify a comma-separated list of loop IDs and source locations to the --assume-hide-taxes option to hide taxes only for those loops/functions. If you do not provide a list, taxes are hidden for all loops.

Check how the Kernel Launch Tax column value changed with the option used.

Do Not Hide Taxes

By default, Offload Modeling estimates invocation taxes using the pessimistic approach and assumes the invocation tax is paid each time the kernel is launched.

  • From GUI: Disable Single Kernel Launch Tax checkbox from the Analysis Workflow and re-run the Performance Modeling.
  • From command line: Run Performance Modeling with the --no-assume-hide-taxes option (default):
    advisor --collect=projection --no-assume-hide-taxes --project-dir=./advi_results

    where ./advi_results is a path to your project directory. Make sure to replace it with your actual project directory where you collected results to before running the command.

Check how the Kernel Launch Tax column value changed with the option used.

Fine-Tune the Number of Hidden Taxes

You can fine-tune the number of invocation taxes to hide by specifying the Invoke_tax_ratio parameter and a fraction of invocation taxes to hide in a TOML configuration file.

  1. Create a TOML file, for example, my_config.toml. Copy and paste the following text there:
    [scale]
    # Fraction of invocation taxes to hide.
    # Note: The invocation tax of the first kernel instance is not scaled.
    # Possible values: 0.0--1.0
    # Default value: 0.0
    Invoke_tax_hidden_ratio = <float>

    where <float> is a fraction of invocation taxes to hide, for example, Invoke_tax_hidden_ratio = 0.95, which means that 95% of invocation taxes will be hidden and only 5% of the taxes will be estimated.

  2. Save and close the file.
  3. Run the performance projection with the new TOML file as additional custom configuration:
    advisor --collect=projection --custom-config=my_config.toml --project-dir=./advi_results

    where ./advi_results is a path to your project directory. Make sure to replace it with your actual project directory where you collected results to before running the command.

    IMPORTANT:
    If you use the configuration parameter to control the number of taxes to hide, do not use the --assume-hide-taxes or --assume-never-hide-taxes option. These options overwrite the value of the configuration parameter.

You can also use the --set-parameter="scale.Invoke_tax_hidden_ratio = <float>" for the Performance Modeling to set the number of invocation taxes to hide only for the current execution. In this case, you do not need to create a custom configuration file.

Check how the Kernel Launch Tax column value changed with the parameter modified.