Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AVX instructions used on CPUs that don't support them #1935

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

brechtvl
Copy link
Contributor

It's supposed to check all bits are enabled, not just one of them. This causes a crash using OpenColorIO on older CPUs.

Thanks to Ray Molenkamp for help tracking this down.

It's supposed to check all bits are enabled, not just one of them.
This causes a crash using OpenColorIO on older CPUs.

Thanks to Ray Molenkamp for help tracking this down.

Signed-off-by: Brecht Van Lommel <[email protected]>
@brechtvl
Copy link
Contributor Author

CC @markreidvfx

@doug-walker
Copy link
Collaborator

Thank you for the fix @brechtvl ! Do you have any more information about specifically which CPUs are affected?

@brechtvl
Copy link
Contributor Author

This was based on a bug report from a user, we haven't heard back from them yet to know the exact CPU model. But it was a relatively old one that support instructions only up to SSE 4.1.

Still it's the AVX check that fails. So it wouldn't be surprising if CPUs that support up to SSE 4.2 are affected too, and that's the current minimum requirement for Blender, Maya and Houdini.

But I don't know the exact conditions for when that XSAVE bit is enabled while the AVX bit is not.

@doug-walker
Copy link
Collaborator

Linking this Blender issue, which seems to be the original report, for reference.

Copy link
Contributor

@markreidvfx markreidvfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! That must have been tricky to track down. I think we also need to check both bits of the Extended Control Register register too.

src/OpenColorIO/CPUInfo.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@markreidvfx markreidvfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We will probably want to backport this to 2.3.

Copy link
Collaborator

@doug-walker doug-walker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @brechtvl for this fix! My goal is to accelerate a 2.3.2 release due to this.

Copy link
Contributor

@KelSolaar KelSolaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (Nasty one!)

@doug-walker doug-walker merged commit 0c90ded into AcademySoftwareFoundation:main Jan 26, 2024
23 checks passed
@doug-walker
Copy link
Collaborator

@brechtvl , we noticed that Ray Molenkamp posted an OCIO_CPUINFO.exe in the Blender forum as a way of troubleshooting this. If you or he would like to contribute that to OCIO (e.g., under src/apps or share/troubleshooting), we would welcome that.

doug-walker pushed a commit to autodesk-forks/OpenColorIO that referenced this pull request Jan 29, 2024
…twareFoundation#1935)

* Fix AVX instructions used on CPUs that don't support them

It's supposed to check all bits are enabled, not just one of them.
This causes a crash using OpenColorIO on older CPUs.

Thanks to Ray Molenkamp for help tracking this down.

Signed-off-by: Brecht Van Lommel <[email protected]>

* Fix another case pointed out in review

Signed-off-by: Brecht Van Lommel <[email protected]>

---------

Signed-off-by: Brecht Van Lommel <[email protected]>
(cherry picked from commit 0c90ded)
Signed-off-by: Doug Walker <[email protected]>
doug-walker added a commit that referenced this pull request Jan 30, 2024
* Fix ssse3 detection typo (#1929)

Signed-off-by: Mark Reid <[email protected]>
(cherry picked from commit 003b6a1)
Signed-off-by: Doug Walker <[email protected]>

* fix: use system `include pystring.h` for `ConfigUtils.cpp` (#1921)

Signed-off-by: Rui Chen <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
(cherry picked from commit e747e9c)
Signed-off-by: Doug Walker <[email protected]>

* Fix narrowing conversion error on riscv64 (#1924)

Signed-off-by: phancb <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
(cherry picked from commit a95febc)
Signed-off-by: Doug Walker <[email protected]>

* Add manylinux_2_28 Python wheels (#1933)

Signed-off-by: Rémi Achard <[email protected]>
Co-authored-by: Michael Dolan <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
(cherry picked from commit f925099)
Signed-off-by: Doug Walker <[email protected]>

* Enhance ociochecklut to print the output after each step in a multi-t… (#1925)

* Enhance ociochecklut to print the output after each step in a multi-transform LUT

Signed-off-by: pylee <[email protected]>

* Review feedback to enable printe of transforms list when using -s flag.

Signed-off-by: pylee <[email protected]>

* Print transform description for each step instead.

Signed-off-by: pylee <[email protected]>

---------

Signed-off-by: pylee <[email protected]>
Co-authored-by: Doug Walker <[email protected]>
(cherry picked from commit aadf595)
Signed-off-by: Doug Walker <[email protected]>

* Fix AVX instructions used on CPUs that don't support them (#1935)

* Fix AVX instructions used on CPUs that don't support them

It's supposed to check all bits are enabled, not just one of them.
This causes a crash using OpenColorIO on older CPUs.

Thanks to Ray Molenkamp for help tracking this down.

Signed-off-by: Brecht Van Lommel <[email protected]>

* Fix another case pointed out in review

Signed-off-by: Brecht Van Lommel <[email protected]>

---------

Signed-off-by: Brecht Van Lommel <[email protected]>
(cherry picked from commit 0c90ded)
Signed-off-by: Doug Walker <[email protected]>

* Increment library version to 2.3.2

Signed-off-by: Doug Walker <[email protected]>

---------

Signed-off-by: Mark Reid <[email protected]>
Signed-off-by: Doug Walker <[email protected]>
Signed-off-by: Rui Chen <[email protected]>
Signed-off-by: phancb <[email protected]>
Signed-off-by: Rémi Achard <[email protected]>
Signed-off-by: pylee <[email protected]>
Signed-off-by: Brecht Van Lommel <[email protected]>
Co-authored-by: Mark Reid <[email protected]>
Co-authored-by: Rui Chen <[email protected]>
Co-authored-by: phanium <[email protected]>
Co-authored-by: Rémi Achard <[email protected]>
Co-authored-by: Michael Dolan <[email protected]>
Co-authored-by: PenneLee <[email protected]>
Co-authored-by: Brecht Van Lommel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants