VECTOR and NOVECTOR

General Compiler Directive: Controls vectorization of DO loops. It can also affect certain optimizations.

Syntax

cDEC$ VECTOR [clause[, clause]...]

cDEC$ NOVECTOR

c

Is one of the following: C (or c), !, or * (see Syntax Rules for Compiler Directives).

clause

Is an optional vectorization or optimizer clause. It can be one or more of the following:

  • ALWAYS [ASSERT]

    Enables or disables vectorization of a DO loop. The ALWAYS clause overrides efficiency heuristics of the vectorizer, but it only works if the loop can actually be vectorized. If the ASSERT keyword is added, the compiler will generate an error-level assertion message saying that the compiler efficiency heuristics indicate that the loop cannot be vectorized. You should use the IVDEP directive to ignore assumed dependences.

  • ALIGNED | UNALIGNED

    Specifies that all data is aligned or no data is aligned in a DO loop. These clauses override efficiency heuristics in the optimizer. The clauses ALIGNED and UNALIGNED instruct the compiler to use, respectively, aligned and unaligned data movement instructions for all array references. These clauses disable all the advanced alignment optimizations of the compiler, such as determining alignment properties from the program context or using dynamic loop peeling to make references aligned.

    Be careful when using the ALIGNED clause. Instructing the compiler to implement all array references with aligned data movement instructions will cause a runtime exception if some of the access patterns are actually unaligned.

  • TEMPORAL | NONTEMPORAL [(var1 [, var2]...)]

    var

    Is an optional memory reference in the form of a variable name.

    Controls how the "stores" of register contents to storage are performed (streaming versus non-streaming).

    The TEMPORAL clause directs the compiler to use temporal (that is, non-streaming) stores. The NONTEMPORAL clause directs the compiler to use non-temporal (that is, streaming) stores.

    By default, the compiler automatically determines whether a streaming store should be used for each variable.

    Streaming stores may cause significant performance improvements over non-streaming stores for large numbers on certain processors. However, the misuse of streaming stores can significantly degrade performance.

The VECTOR and NOVECTOR directives control vectorization of the DO loop that directly follows the directive.

Caution iconCaution

The VECTOR directive should be used with care. Overriding the efficiency heuristics of the compiler should only be done if you are absolutely sure the vectorization will improve performance.

Example

The compiler normally does not vectorize DO loops that have a large number of non-unit stride references (compared to the number of unit stride references).

In the following example, vectorization would be disabled by default, but the directive overrides this behavior:

!DEC$ VECTOR ALWAYS
  do i = 1, 100, 2
    ! two references with stride 2 follow
    a(i) = b(i)
  enddo

There may be cases where you want to explicitly avoid vectorization of a loop; for example, if vectorization would result in a performance regression rather than an improvement. In these cases, you can use the NOVECTOR directive to disable vectorization of the loop.

In the following example, vectorization would be performed by default, but the directive overrides this behavior:

!DEC$ NOVECTOR
  do i = 1, 100
    a(i) = b(i) + c(i)
  enddo

See Also


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.