ISPCTextureCompressor icon indicating copy to clipboard operation
ISPCTextureCompressor copied to clipboard

bad code generation causing incorrect encoding in when compiling with clang optimization.

Open hypnosnhendricks opened this issue 4 years ago • 2 comments

We use ISPCTextureCompressor on a linux backend. Recently we ran into issues with clang's optimization code generation. With optimizations turned on, the generated code would cause artifacts in the resulting ASTC images as seen below:

image

This is an eyeball texture & the pink pixels showcase the isssue. We are not sure exactly what is causing this error, only that without optimizations turned on, everything comes out ok. We ended up adding #pragma clang optimize off to ispc_texcomp_astc.cpp to work around the issue and allow the rest of the code to work with optimizations turned on.

Recently, we ran into a new issue where Clangs new-pass-manager compile flag is causing the same behavior, even with our pragma to turn optimization off for this code.

hypnosnhendricks avatar Aug 11 '21 23:08 hypnosnhendricks

could you tell me a little more about your configuration (CPU, OS version, clang version) and attach an uncompressed image to test?

thanks

DaveBookout-Intel avatar Aug 12 '21 16:08 DaveBookout-Intel

CPU: Variety, similar to Amazon's EC2s OS: CentOS Stream, version 8 Clang: clang version 9.0.20190721 editor_img15

I'll be trying to get a small, reproducible test case as sample program and see if I can figure out exactly what it going wrong. We have multiple teams using this code, each having their own copy of the source. As far as I'm aware we are the only team that has run into this issue.

We first encountered this issue with just having clang optimization turned on, so we added a workaround by disabling optimization using a pragma. The complier flag to use the new pass manager is causing the bug to resurface. Our current stopgap solution is to disable the new pass manager and keep the pragma in the .cpp to turn off optimizations.

hypnosnhendricks avatar Aug 13 '21 19:08 hypnosnhendricks