Skip to content

[BUG] SIMD support does not work correctly when building with MSVC #4265

@jessey-git

Description

@jessey-git

Describe the bug

Broadly speaking there are two issues here:

  • MSVC's /arch switch only supports the following items[1]: AVX|AVX2|AVX512
  • MSVC does not define __SSE4_2__, or similar, meaning all of the machinery inside simd.h is unused[2]

[1] https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170
Trying to use USE_SIMD="sse4.2" will result in the following warnings during build:

cl : command line  warning D9002: ignoring unknown option '/arch:sse4.2'

[2] When using USE_SIMD="sse4.2"
The cmake output says that things are happening:

-- Building with C++17, downstream minimum C++17
-- Compiling with SIMD level sse4.2
-- SIMD feature: sse4.2

But trying the resulting binaries results in the following attribute values:

hw:simd = sse2,sse3,ssse3,sse41,sse42,avx,avx2,fma,f16c,popcnt,rdrand
build:simd = sse2

OpenImageIO version and dependencies
2.5.x and master

I'll see if I can make a fix to untangle but it's a bit complicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions