Intel® Advisor User Guide

ID 766448
Date 6/24/2024
Public

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

Document Table of Contents

Reduce Scheduler Overhead using Lightweight Policy

The Flow Graph API allows you to apply lightweight policy for computational nodes such as function node, multifunction node, continue node, and async node. Enabling the lightweight policy helps reduce scheduling overhead. It can limit parallel execution of tasks, so apply this policy on a per-node basis after careful evaluation.

The lightweight policy indicates that the body of a node contains a small amount of work and, if possible, should be executed without the overhead of scheduling a task. By default, the async node has the lightweight policy enabled because it has small computation weight. All other computational nodes do not have the lightweight policy enabled when they are dragged and dropped into the canvas.

Use the lightweight policy in the following cases:

  • Node weight is less than 1 microsecond when no trace information is available.
  • Node average time is less than 1 microsecond if the graph is loaded into context with trace data.

When validating a graph, the graph rule check automatically identifies nodes that can use the lightweight policy. If the above conditions are not met but the lightweight policy is set, the graph rule check recommends removing the lightweight policy for the corresponding node.

To display recommendations for applying the lightweight policy:

  1. Click the graph rule check icon on the toolbar to run the check.

  2. Go to the Analytics Report tab to see the results.

  3. Based on the results, set or disable the lightweight policy for certain nodes.

  • To set or disable the lightweight execution policy for a single node:

    1. Click the node to display the node properties on the right pane.

    2. Set the Execution policy property to none to disable lightweight policy or to lightweight to enable lightweight policy.

  • To set or disable the lightweight execution policy for all the nodes listed by graph rule check:
    1. Multi-select the report lines that say Consider enabling lightweight policy for small computational or async node or Consider disabling lightweight policy for small computational or async node to highlight all nodes in the canvas and display the common properties for all the selected nodes.

    2. Set the Execution policy property to none to disable lightweight policy or to lightweight to enable lightweight policy.

    For example, to enable the lightweight policy for multiple nodes:

Another important attribute related to node execution policy is a buffer policy:

  • If you set the buffer policy to queueing when lightweight policy is enabled, the Flow Graph Analyzer adds queueing_lightweight to the policy parameter of the node declaration during C++ code generation.

  • If you set buffer policy to rejecting, the Flow Graph Analyzer adds rejecting_lightweight to the policy parameter of the node declaration during C++ code generation.

For example, by default, the async node is set to queueing_lightweight, and the Flow Graph Analyzer does not add any policy during code generation for async node. Setting buffer policy to rejecting for the async node adds rejecting_lightweight to the policy parameter of async node declaration during code generations.