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

MSVC internal compiler error #151

Open
tksuoran opened this issue Jul 24, 2024 · 6 comments
Open

MSVC internal compiler error #151

tksuoran opened this issue Jul 24, 2024 · 6 comments

Comments

@tksuoran
Copy link

FYI: https://developercommunity.visualstudio.com/t/fatal--error-C1001:-Internal-compiler-er/10703305

I have not tried to make a minimal repro yet, but at least the workaround might be useful while waiting for MS to fix the compiler not to crash.

@nigeltao
Copy link
Collaborator

Thanks for the FYI.

Another workaround might be to temporarily downgrade wuffs-v0.4.c from the latest (alpha) version, v0.4.0-alpha.5, to the previous one (v0.4.0-alpha.4: check out commit f169822) until we hear more from the Microsoft C++ team.

@nigeltao
Copy link
Collaborator

I don't use Windows or MSVC, so I'm only guessing, but I'm curious if your "Internal compiler error" repro still crashes (with the latest Wuffs version, v0.4.0-alpha.5) if you pass the /arch:AVX or /arch:AVX2 compiler flag.

@tksuoran
Copy link
Author

I am already using the v0.4.0-alpha.5 tag. I added /arch:AVX2 - the ICE still happens the same.

@tksuoran
Copy link
Author

This config does not trigger MSVC ICE:

#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__ADLER32
#define WUFFS_CONFIG__MODULE__AUX__BASE
#define WUFFS_CONFIG__MODULE__AUX__IMAGE
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__JPEG

If I add CRC32 module (required by PNG), there ICE gets triggered.

#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__ADLER32
#define WUFFS_CONFIG__MODULE__AUX__BASE
#define WUFFS_CONFIG__MODULE__AUX__IMAGE
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__CRC32
#define WUFFS_CONFIG__MODULE__JPEG

@nigeltao
Copy link
Collaborator

Huh, interesting.

I still don't have MSVC but if you have the time, you could #define WUFFS_CONFIG__MODULE__CRC32 (to trigger ICE) and then delete lines of code from the wuffs_crc32__ieee_hasher__up_x86_sse42 function (in wuffs-v0.4.c line 36762) until the ICE stops? That might give us (and the Microsoft C++ team) a reproducer.

If you want a minimal reproducer, you should be able to trim the module allow-list to just this:

#define WUFFS_CONFIG__MODULES
#define WUFFS_CONFIG__MODULE__CRC32

nigeltao added a commit that referenced this issue Aug 4, 2024
This recreates the case as of commit f169822 (tag v0.4.0-alpha.4), in
that, by default (without #define'ing a macro or passing an /arch:ETC
compiler flag), Wuffs does not use SIMD on MSVC x86_64.

Commit b64a761 (after tag v0.4.0-alpha.4, before tag v0.4.0-alpha.5)
changed the default so that x86_64_v2 (roughly equivalent to SSE4.2) was
enabled by default, since the user from issue #148 was enabling that
anyway (in an unsupported way, by #define'ing a macro that was a private
implementation detail) with no problems (and better performance).

However, another user later reported (in issue #151) that enabling SIMD
on MSVC x86_64 somehow lead to ICEs (Internal Compiler Errors).

This commit restores the default to "no SIMD" and it is up to the MSVC
user to opt in to the SIMD code paths. Clang and GCC are unaffected:
SIMD remains enabled by default.

Updates #148
Updates #151
@nigeltao
Copy link
Collaborator

nigeltao commented Aug 4, 2024

I've just rolled Wuffs v0.4.0-alpha.6, which rolls back to the v0.4.0-alpha.4 behavior where, on MSVC, SIMD is opt in (instead of v0.4.0-alpha.5's opt out).

You can still get ICE if you opt in, but at least you should no longer see this ICE by default.

#define WUFFS_CONFIG__ENABLE_MSVC_CPU_ARCH__X86_64_V2 (or _V3) to opt in.

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

No branches or pull requests

2 participants