Edit

Share via


/vlen

Specifies the vector length for code generation on x86 and x64. For more information about /arch for x86 and x64, see /arch (x86) and /arch (x64).

Syntax

/vlen=[256|512]

/vlen

Arguments

/vlen=256
Specify a vector length of 256 bits for auto-vectorization and other optimizations.

/vlen=512
Specify a vector length of 512 bits for auto-vectorization and other optimizations.

/vlen
Specify the default vector length for the selected /arch setting.

Remarks

If a specific /vlen value isn't specified, the default vector length depends on the /arch flag setting. The /vlen flag can override the default vector length specified by /arch:AVX512 or /arch:AVX10.1 flag. For example:

  • /arch:AVX512 /vlen=256 overrides the default vector length of 512 bits specified by /arch:AVX512 to be 256 bits.
  • /arch:AVX10.1 /vlen=512 overrides the default vector length of 256 bits specified by /arch:AVX10.1 to be 512 bits.

When the specified /vlen value is incompatible with specified /arch flag, a warning is generated and default vector length for the /arch setting is used. For example:

  • /arch:AVX2 /vlen=512 generates a warning because AVX2 doesn't support 512-bit vectors. Vector length of 256 bits is used in this case.

To set the /vlen=256 or /vlen=512 compiler option in Visual Studio

  1. Open the Property Pages dialog box for the project. For more information, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > C/C++ > Command Line property page.

  3. In the Additional options box, add /vlen=256 or /vlen=512. Choose OK to save your changes.

See also

/arch (Minimum CPU Architecture)
MSVC compiler options
MSVC compiler command-line syntax