Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 11/07/2023
Public

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

Document Table of Contents

Score and Match Context Selectors

An OpenMP* context is compatible with a context selector if the following conditions are met:

  • All conditions specified in the user trait set evaluate to true.

  • All traits and trait properties defined by implementation, device, and construct sets are active in the corresponding trait set of the context.

  • All trait and trait properties defined by the target_device set are active in the target-device trait set for the device corresponding to the device_num selector.

  • Selectors in the construct set of the selector specify the same construct ordering as the construct trait set of the context.

  • For each selector in the context selector, the properties specified are a subset of the properties of the corresponding trait of the context.

  • No implementation-defined selector specified is ignored by the implementation.

The following additional rules apply to matching certain simd selector properties with the simd trait:

  • The aligned (list :n) property of the selector matches the aligned (list :m) trait of the context if n is a multiple of m.

  • The simdlen (n) property specified in the selector matches the simdlen (m) property of the context if m is a multiple of n.

The following algorithm is used to score compatible context selectors:

  • Trait selectors that specify a trait-score are given the value of the trait-score expression.

  • Each specified construct trait selector that matches the construct trait in the context is given the value 2p-1, where p is the position of the corresponding trait cp in the context trait set specified by the context selector. The highest valued subset of context traits containing all selectors in the same order is used if the traits that correspond to the construct selector set appear multiple times in the context.

  • If specified, the kind, arch, and isa selectors are given the values 2n, 2n+1, and 2n+2 respectively, where n is the number of traits in the construct set.

  • Other selectors are given the value of zero.

  • Values given to implementation-defined selectors are defined by the implementation.

  • A context selector that is a strict subset of another context selector is given a score of zero. For other selectors, their final value is the sum of the values of the specified selector plus 1.