Skip to content

Conversation

@apache-hb
Copy link

Resolves #152. I opted to use the compiler provided extension support rather than modify codec_choose_x86 just to be sure I didn't introduce any bugs into the autodetection logic. I've tested these changes on zen4 Genoa windows & linux, as well as qemu without kvm enabled. Changes were tested on clang, gcc, and msvc.

#endif // __cplusplus
#endif // _MSC_VER

#if __has_builtin(__builtin_cpu_supports)
Copy link
Owner

Choose a reason for hiding this comment

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

This might not be very portable and it seems to be breaking CI. Perhaps it can be wrapped in an #ifdef __has_builtin?

Copy link
Owner

Choose a reason for hiding this comment

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

While I agree that it's bad form for the tests to crash without warning, I'm not totally sure about this solution yet. Two reasons:

  • There is already some "mature" runtime feature detection code in lib/codec_choose.c, and this PR feels like it's treading the same ground. I'd prefer to unify those things if possible. (I'm not happy with the runtime detection code there by the way - it's a wart that grew out of necessity and not a problem I want to have.)
  • Catching SIGILL seems like possibly a reasonable way to deal with the issue, since these are just tests.
    • Catching signals portably across platforms is another can of worms.

@apache-hb
Copy link
Author

Sorry I couldn't respond sooner, I've been very busy at my day job. Your comments make sense, I was initialy hesitant to use the internals of codec_choose_x86 because I didn't want to accidentally export a symbol from it that wasnt previously visible. If I can figure out how to ensure no symbols leak I'll push a new revision using that function to detect feature support rather than using compiler builtins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests abort with SIGILL on x86 machines without required ISA support

2 participants