Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 autovectorization and other optimizations.
/vlen=512
Specify a vector length of 512 bits for autovectorization and other optimizations.
/vlen
Specify the default vector length for the selected /arch setting.
Remarks
This compiler option was introduced in Visual Studio 2022 17.13.
If a specific /vlen value isn't specified, the default vector length depends on the /arch compiler option setting. The /vlen compiler option can override the default vector length specified by /arch:AVX512, /arch:AVX10.1, or /arch:AVX10.2 compiler option. For example:
/arch:AVX512 /vlen=256overrides the default vector length of 512 bits specified by/arch:AVX512to be 256 bits./arch:AVX10.1 /vlen=512overrides the default vector length of 256 bits specified by/arch:AVX10.1to be 512 bits.
When the specified /vlen value is incompatible with specified /arch compiler option, a warning is generated and default vector length for the /arch setting is used. For example:
/arch:AVX2 /vlen=512generates a warning because AVX2 doesn't support 512-bit vectors. A 256-bit vector length is used in this case.
To set the /vlen=256 or /vlen=512 compiler option in Visual Studio
Open the Property Pages dialog box for the project. For more information, see Set C++ compiler and build properties in Visual Studio.
Select the Configuration Properties > C/C++ > Command Line property page.
In the Additional options box, add
/vlen=256or/vlen=512. Choose OK to save your changes.
See also
/arch (Minimum CPU Architecture)
MSVC compiler options
MSVC compiler command-line syntax