AnsweredAssumed Answered

New Omega drivers seem to not work with SPIR 1.2

Question asked by neko on Jan 8, 2015


we are using SPIR 1.2 for binary generation mainly as kernel sources obfuscation, which are statically included into our libraries (simple C-like byte arrays). This was working fine until the last update of AMD driver 14.09 into the newset one, omega catalyst driver 14.12.


This issue was also experienced with attached minimalistic examle using the same steps of compilation:

0.) build clang (spir complier) according to this manual:

----- compilation ------

1.) ${CLANG_PATH}/clang -cc1 -x cl -triple spir-unknown-unknown -cl-spir-compile-options "-cl-fast-relaxed-math" -emit-llvm-bc -include ${OPENCL_SPIR_H_PATH}/opencl_spir.h -w -Wno-constant-logical-operand -o ${OUTPUT_PATH}/kernel.binary ${KERNEL_PATH}/, which should generate valid SPIR LLVM IR binary file


2.) convert binary into C-like array, using for example xxd or similiar utility


3.) include this converted binary into source code


---- runtime ----

4.) call clCreateProgramWithBinary(); with included binary and build program using: clBuildProgram(); with "-x spir -spir-std=1.2 -cl-fast-relaxed-math" as compilation flags


5.) use standard way of kernel creation and exectution ...


After execution of this simple example or any other program which uses SPIR under 14.12 catalyst driver all resutling data are pretty much undefined. We tried profiling with CodeXL and various debugging, where was clearly visible that all kernels have no effect at all and results are only dumps of unitialized GPU memory. Classical kernel compilation from sources works fine, tho.


We tested this on both Windows 7 and Ubuntu 14.04 (trusty tahr) with the same results.


To run attached example simply type: ./sample in command line, result should be grayscale RAW image file (out.raw). To switch between run-time compilation from sources and from binaries comment out / leave uncommented line 16: #define BINARY.