4 Replies Latest reply on Feb 15, 2017 1:15 AM by dipak

    Weird and incorrect code generated by legacy OpenCL 1.2 compiler

    matszpk

      While testing my assembler (CLRadeonExtender), I found bug in the legacy AMD OpenCL 1.2 compiler. Compiler adds weird instructions to code that should not be added. These instructions were added when compiler tries to compile kernel with tens arguments and when code will be compiled for GCN 1.1 (Bonaire, Hawaii, Spectre,...) GPU's. I reproduced this bug for Windows driver 16.12.2 (OpenCL version 2236.10) and my old Linux drivers 15.12 (1912.5). The generated code can behave inpredictable manner.

      I found this bug, while I was trying to assemble compiled code, The assembler reported errors like that:

       

      <stdin>:1305:23: Error: More than one SGPR to read in instruction

       

      A generated code have illegal form of v_cndmask_b32 instruction:

       

      v_cndmask_b32   v0, s32, v1, vcc

       

      In this case, instructins read two scalar registers: S32 and double VCC. This code, ofcourse works incorrectly on GPU, giving an unexpected results.

      In attachment are an OpenCL code and a disassembled code.