microsoft / OpenCLOn12

The OpenCL-on-D3D12 mapping layer
MIT License
104 stars 13 forks source link

winarm: clon12compiler crashes with 0xc000001d: "illegal instruction" during clBuildProgram() #35

Closed jfitz-adobe closed 2 years ago

jfitz-adobe commented 2 years ago

a 0xc000001d "illegal instruction" exception will occur inside clon12compiler when calling clBuildProgram() for certain shader programs. this occurs when using clon12compiler as part of the opencl/opengl compatibility pack v2.2204.5.0 on WinArm64 platform. see stacktrace:

Unhandled exception at 0x00007FFE4DE9AD30 (clon12compiler.dll) in sample.exe: 0xC000001D: Illegal Instruction.

    clon12compiler.dll!00007ffe4de9ad30()   Unknown
    clon12compiler.dll!00007ffe4de95264()   Unknown
    clon12compiler.dll!00007ffe4de9a208()   Unknown
    clon12compiler.dll!00007ffe4ddd19bc()   Unknown
    OpenCLOn12.dll!00007ffe7d68e264()   Unknown
    OpenCLOn12.dll!00007ffe7d6adbfc()   Unknown
    OpenCLOn12.dll!00007ffe7d6ac76c()   Unknown
    OpenCLOn12.dll!00007ffe7d6ac154()   Unknown
    OpenCLOn12.dll!00007ffe7d6b05dc()   Unknown
    opencl.dll!clBuildProgram()    Unknown
    aif.dll!AIF::OCL::Program::build(const std::vector<AIF::OCL::Device,std::allocator<AIF::OCL::Device>> & devs, const std::string & buildOptions) Line 138    C++
>   aif.dll!AIF::OCL::Program::build(const std::string & buildOptions) Line 128 C++

email me directly, and i can provide minidump-with-heap and/or affected shader source.

jenatali commented 2 years ago

Followed up offline, this is a bug when a kernel contains an image that is unused. The compiler normally assigns a type to an image (float, int, uint) based on what types of accesses are done to it, but if it's never accessed, that doesn't happen, and then the compiler is unable to emit a DXIL declaration for it.

jenatali commented 2 years ago

The compiler issue is fixed in Mesa and a new package is pushed to the Store with the fix.