Giter Club home page Giter Club logo

intel-graphics-compiler's Introduction

Intel® Graphics Compiler for OpenCL™

GitHub release (latest by date)

Introduction

The Intel® Graphics Compiler for OpenCL™ is an LLVM-based compiler for OpenCL™ targeting Intel® graphics hardware architecture.

Please visit the compute Intel® Graphics Compute Runtime repository for more information about the Intel® open-source compute stack: https://github.com/intel/compute-runtime

License

The Intel® Graphics Compute Runtime for OpenCL™ is distributed under the MIT License.

For detailed terms, you can access the full License at:

https://opensource.org/licenses/MIT

Dependencies

Supported Linux versions

IGC is continuously built and tested on the following 64-bit Linux operating systems:

  • Ubuntu 22.04
  • Ubuntu 20.04

Documentation

More documentation is available in the documentation directory.

Supported Platforms

  • Intel® Xe2
  • Intel® Xe
  • Intel® Gen12 graphics
  • Intel® Gen11 graphics
  • Intel® Gen9 graphics

How to provide feedback

If you have any feedback or questions, please open an issue through the native github.com interface: https://github.com/intel/intel-graphics-compiler/issues.

How to contribute

Create a pull request on github.com with your changes. Ensure that your modifications build without errors. A maintainer will get in touch with you if there are any inquiries or concerns.

intel-graphics-compiler's People

Contributors

aparshin-intel avatar aratajew avatar aus-intel avatar bcheng0127 avatar dianachen avatar dlei6g avatar dmitryryintel avatar fangliu2020 avatar fftzeng avatar houjenko avatar igorban-intel avatar iwwu avatar jfuentes avatar jgu222 avatar krystian-andrzejewski avatar lukaszgotszaldintel avatar lwesiers avatar matborzyszkowski avatar mateuszchudyk avatar mmerecki avatar mnaczk avatar paigeale avatar paweljurek avatar petechou avatar pratikashar avatar pszymich avatar scottp101 avatar trbauer avatar vmustya avatar weiyu-chen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intel-graphics-compiler's Issues

Pointer Arithmetic issue

(Most of this is a copy from https://software.intel.com/en-us/comment/1926881)

I have just tracked down a bug in a opencl kernel i have written. The code had been working fine until one of the users got a graphics driver update (versione 20.19.15.4835).
The code had worked for about 1 year on a wide assortment of CPU's and integrated and dedicated GPU's, both when compiled with x64 and x86. The old code still works on the CPU when compiled with either x64 or x86, and on the integrated gpu when compiled with x86. But when run on integrated graphics cards, with the newest driver, in x64 mode, it failes.
i have been able to track it down to this line of code:
'global float* inputCPtr = inputC + turbines * windDirIndex;
out[gid] = inputCPtr[inputA[gid]];'

Seemingly randomly, this line would return 0 instead of the content in xCoords. Changing the code to the following fixes the bug.
global float* inputCPtr = inputC + turbines * windDirIndex;
out[gid] = inputC[turbines * windDirIndex + gid];'

full, (quite) minimal example below:

The vector "test" should contain all 1's, but on the HD 5500 with the newest driver, compiled in visual studio on 64 bit on windows 8, it contains a mix of 1's and 0's, seemingly in blocks of a multiple of 8.

#define __CL_ENABLE_EXCEPTIONS
#include "cl/cl.hpp"
#include <string>
#include <fstream>
#include <streambuf>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>

typedef struct Device
{
	cl::Device DevicePtr; // the device handle
	cl::Program Program; // The compiled program for this device. Should only be compiled for Device
	cl::Context Context; // A context for this device. Must be the same context used for Program
	Device(cl::Device device, std::string source)
	{
		DevicePtr = device;
		Context = cl::Context(device);
		Program = cl::Program(Context, source);
		Program.build();
	}
} Device;

std::vector<cl::Device> getAllDevices()
{
	std::vector<cl::Platform> platforms;
	cl::Platform::get(&platforms);
	std::vector<cl::Device> devices;
	for (auto platform : platforms)
	{
		std::vector<cl::Device> platformDevices;
		platform.getDevices(CL_DEVICE_TYPE_ALL, &platformDevices);
		devices.insert(devices.end(), platformDevices.begin(), platformDevices.end());
	}
	return devices;
}

int main()
{
	std::string kernelsString = 
		"kernel void example(global int* inputA, global ushort* inputB, global float* inputC, ushort turbines, uint threadCount, global float* out)\n"
		"{\n"
		"uint gid = get_global_id(0);\n"
		"if (gid >= threadCount) return;\n"
		"ushort windDirIndex = inputB[gid];\n"
		"global float* inputCPtr = inputC + turbines * windDirIndex;\n"
		"out[gid] = inputCPtr[inputA[gid]];\n"
		"}";

	for (auto ptr : getAllDevices()) {
		auto dev = Device(ptr, kernelsString);
		cl::Context context = dev.Context;
		auto queue = cl::CommandQueue(context);

		auto inputA = cl::Buffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * 100);
		queue.enqueueFillBuffer(inputA, cl_int(0), 0, sizeof(cl_int) * 100);
		cl::Buffer inputB = cl::Buffer(context, NULL, sizeof(cl_ushort) * 100);
		queue.enqueueFillBuffer(inputB, cl_ushort(0), 0, sizeof(cl_ushort) * 100);
		cl::Buffer inputC = cl::Buffer(context, NULL, sizeof(cl_float) * 100);
		queue.enqueueFillBuffer(inputC, cl_float(1), 0, sizeof(cl_float) * 100);
		auto outputA = cl::Buffer(context, CL_MEM_WRITE_ONLY | CL_MEM_ALLOC_HOST_PTR, sizeof(cl_float)*100);

		auto calculateFactorKernel = cl::Kernel(dev.Program, "example");
		calculateFactorKernel.setArg(0, inputA);
		calculateFactorKernel.setArg(1, inputB);
		calculateFactorKernel.setArg(2, inputC);
		calculateFactorKernel.setArg(3, cl_ushort(0));
		calculateFactorKernel.setArg(4, 100);
		calculateFactorKernel.setArg(5, outputA);
		queue.enqueueNDRangeKernel(calculateFactorKernel, cl::NullRange, cl::NDRange(100));
		float* testptr = static_cast<cl_float*>(queue.enqueueMapBuffer(outputA, true, CL_MAP_READ, 0, sizeof(cl_float) * 100));
		std::vector<cl_float> test(testptr, testptr + 100);
		
	}
}

Provide installation support for the IGC

Please, remove custom -DIGC_OPTION__OUTPUT_DIR and provide installation support for the IGC targets. On Linux, please, use https://cmake.org/cmake/help/v3.6/module/GNUInstallDirs.html and standard variables provided with this module. You can refer to this for example: https://github.com/intel/media-driver/blob/master/CMakeLists.txt

Essentially, work with the IGC package should look somehow like (assuming you will use cmake):

cmake -DCMAKE_INSTALL_PREFIX=/my/custom/prefix -DCMAKE_INSTALL_LIBDIR=/my/custom/libdir /path/to/igc
make -j8
make install

Build failure for GenISA Intrinsics.

The instructions for building GenISA Intrinsics aren't there and running the cmake and make command in the documentation results in the build failure for GenISA Intrinsics.

recipe for target 'GenISAIntrinsics/CMakefiles/GenISAIntrinsics.dir/all' failed.

[RFC] Build IGC against system installed dependencies

This is an RFC (Request for Comments) to help trigger a discussion on how to simplify IGC build and installation instructions. I hope it will be helpful.

I was able to build IGC in a following way:

  1. Build and install LLVM
git clone https://github.com/llvm/llvm-project.git && cd llvm-project
mkdir build && cd build
cmake -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_INSTALL_PREFIX=/path/to/install.llvm8 ..
make && make install
  1. Build and install SPIRV tools:
git https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git && cd SPIRV-LLVM-Translator
mkdir build && cd build
cmake \
  -DLLVM_DIR=/path/to/install.llvm8/lib/cmake/llvm \
  -DCMAKE_INSTALL_PREFIX=/path/to/install.llvm8 \
  -DCMAKE_CXX_FLAGS="-fPIC" \
  ..
make && make install
  1. Build and install common clang:
git clone https://github.com/intel/opencl-clang && cd opencl-clang
cmake \
  -DLLVM_DIR=/path/to/install.llvm8/lib/cmake/llvm \
  -DCMAKE_INSTALL_PREFIX=/path/to/install.llvm8 \
  ..
make && make install
  1. **Build and install IGC. Here I did not avoid custom patches. They are here: #55 **
git clone https://github.com/intel/intel-graphics-compiler.git igc && cd igc
git fetch origin pull/55/head:pr_55 && git checkout pr_55
cmake \
  -DLLVM_DIR=/path/to/install.llvm8/lib/cmake/llvm \
  -DCMAKE_PREFIX_PATH=/path/to/install.llvm8/lib/cmake/clang \
  -DCMAKE_INSTALL_PREFIX=/path/to/install.llvm8 \
  -DIGC_PREFERRED_LLVM_VERSION=8
  ..
  1. [UPDATED] after ae4aa3b. Build and install IGC:
git clone https://github.com/intel/intel-graphics-compiler.git igc && cd igc
git fetch origin pull/55/head:pr_55 && git checkout pr_55
export PATH=/path/to/install.llvm8/bin  # to fetch clang-8
cmake \
  -DLLVM_DIR=/path/to/install.llvm8/lib/cmake/llvm \
  -DCMAKE_INSTALL_PREFIX=/path/to/install.llvm8 \
  -DIGC_PREFERRED_LLVM_VERSION=8
  ..

The above instruction works for me against LLVM 8.x, i.e.:

  • LLVM: git checkout -b 8.x remotes/origin/release/8.x
  • SPIRV: git checkout -b llvm_release_80 remotes/origin/llvm_release_80
  • CommonClang: git checkout -b ocl-open-80 remotes/origin/ocl-open-80
  • IGC: master bracnh

IGC is not yet ready for LLVM 9.x, there are build issues. Some - trivial (fix in #58). Some - beyond my current knowledge of LLVM (see #59).

I did not try the instruction with LLVM 7.x

The above modified IGC build procedure is described in the proposed README update in RFC #65.

libs have no SONAME

The produced libs have no SONAME, please fix that so that distros can ship proper packages.

Remove non-related warnings

Like this, UFO_VK shouldn't be attempted here.

CMake Warning at CMakeLists.txt:2196 (message):
not defined, defaulting to y: UFO_VK

build fails on patching files.

Hi,

I am getting a build failure during the build when it attempts to patch files.

For example,

"Apply /home/kevin/NEO/common_clang/clang_patches/releases/4.0.1/patches/01-opencl-improved-enqueue_kernel-diagnostic-message.patch"

states "can't find file to patch at input line 16 Perhaps you used the wrong -p or --strip option"; I can make the build continue if I by hand provide the FULL path of each of the files to patch (relative path fails with "Invalid cross-device link" error).

Update to llvm 7.0

With llvm 7.0 out, we should update to the latest version of llvm. I also recommend upstreaming all the patches. This could allow one day to use system clang espically on linux

Missing load regrouping optimization when pointer is modified

I have the following code

__kernel void compute_nearest_neighboors_naive(__global float * restrict dst,
                                               __global const SRC_TYPE * restrict src,
                                               int w,
                                               int h,
                                               int items_row,
                                               int items_img,
                                               int src_offset,
                                               int dst_offset)
{
    ...
    __global const SRC_TYPE * restrict src_shifted = src + src_offset + dz * items_img;
    ...
    #pragma unroll
    for (int i = 0; i < 8; i++) {
        float data = src_shifted[position+i];
        ....//something with data
    }
    ...
}

Ideally, the unrolling should cause into the send operations merging into two RGBA send operations.
Unfortunately with the above code, this doesn't happen: the unrolled code has 8 send operations.

However if data is loaded with the following line:
float data = src[src_offset + dz * items_img + position+i];

Then the optimization occurs and performance is much greater.

Expected behaviour: Both code should generate the optimization.

I can send code if requested, but I guess this issue should be reproducible with a small kernel and you may want to write such a kernel for your regression tests anyway.

I use release 18.26.10987

Add way to control SIMD width

For some reasons, a few changes in my kernels can lead the compiler to pick a different choice for SIMD width (8, 16 or 32).

For some reason I don't explain, some of my kernels using shared memory and barriers perform very significantly better (several times faster) when the selected SIMD width is 8.

Thus I'd like a way to enforce the choice of SIMD width of 8. (Also ideally compiler would make better choices).

Maybe make __attribute__((vec_type_hint(float8))) trigger SIMD-8 for example ?

file INSTALL cannot find ".../build_IGC/BiFModule/clang_build/src/docs/ocamldoc/html/.".

I have followed the following steps to pull and compile code:

cd <worksapce>
git clone -b release_40 https://github.com/llvm-mirror/clang clang_source
git clone -b ocl-open-40 https://github.com/intel/opencl-clang common_clang
git clone https://github.com/intel/llvm-patches llvm_patches
git clone -b release_40 https://github.com/llvm-mirror/llvm llvm_source
git clone https://github.com/intel/intel-graphics-compiler

mkdir build && cd build
cmake -DIGC_OPTION__OUTPUT_DIR=../IGC-install/Release ../intel-graphics-compiler/IGC
make -j4

Then, I got the error:

         -- Up-to-date: /usr/lib/ocaml/llvm/llvm.mli
         CMake Error at bindings/ocaml/llvm/cmake_install.cmake:44 (file):
           file INSTALL cannot set permissions on "/usr/lib/ocaml/llvm/llvm.mli"
         Call Stack (most recent call first):
           bindings/ocaml/cmake_install.cmake:37 (include)
           cmake_install.cmake:61 (include)
           
         Makefile:126: recipe for target 'install' failed
         make[3]: *** [install] Error 1
         BiFModule/clang_build/CMakeFiles/cclang.dir/build.make:130: recipe for target 'BiFModule/clang_build/src/src/cclang-stamp/cclang-install' failed
         make[2]: *** [BiFModule/clang_build/src/src/cclang-stamp/cclang-install] Error 2
         CMakeFiles/Makefile2:1410: recipe for target 'BiFModule/clang_build/CMakeFiles/cclang.dir/all' failed
         make[1]: *** [BiFModule/clang_build/CMakeFiles/cclang.dir/all] Error 2
         Makefile:138: recipe for target 'all' failed
         make: *** [all] Error 2

So, I changed to: sudo make -j4 , but I got the error:

         -- Up-to-date: /media/dengliqiang/DATADRIVE0/Dev/Intel/build_IGC/BiFModule/clang_build/install/bin/verify-uselistorder
         -- Up-to-date: /media/dengliqiang/DATADRIVE0/Dev/Intel/build_IGC/BiFModule/clang_build/install/bin/yaml2obj
         CMake Error at docs/cmake_install.cmake:36 (file):
           file INSTALL cannot find
           "/media/dengliqiang/DATADRIVE0/Dev/Intel/build_IGC/BiFModule/clang_build/src/docs/ocamldoc/html/.".
         Call Stack (most recent call first):
           cmake_install.cmake:68 (include)
           
         Makefile:126: recipe for target 'install' failed
         make[3]: *** [install] Error 1
         BiFModule/clang_build/CMakeFiles/cclang.dir/build.make:130: recipe for target 'BiFModule/clang_build/src/src/cclang-stamp/cclang-install' failed
         make[2]: *** [BiFModule/clang_build/src/src/cclang-stamp/cclang-install] Error 2
         CMakeFiles/Makefile2:1410: recipe for target 'BiFModule/clang_build/CMakeFiles/cclang.dir/all' failed
         make[1]: *** [BiFModule/clang_build/CMakeFiles/cclang.dir/all] Error 2
         Makefile:138: recipe for target 'all' failed
         make: *** [all] Error 2

I have already installed OCaml, but I don't know how to fix the error.
Can anybody help me? Thanks a lot.

Intel Graphics Compiler Failed Build

Hello,

I want to use the Intel Compute Runtime for OpenCL and now installing the dependencies gmmlib and the igc. GmmLib was successful but igc return errors while make [-j'nproc'], that llvm::SmallSet and llvm::AttributeSet are not declared but acutally can be found in the "workspace"-directory.

image

I'm following the constructions but don't know how to solve the problem.

For more Details:
I am using an Minnowboard Max with Intel Atom E3825 CPU and already installed LLVM/Clang 4.0. before I build the IGC

Hope some of you guys can help me

Tool to compile .cl files

Question or feature request.

Is there tool (build target) in this repository which can be used to compile .cl files into ISA.

At least it is necessary to simplify "git bisect" work (no need to search compatible runtime and recompile it too).

Currently found these tools:

  • iga64 - assembler tool (doesn't know about .cl)
  • GenX_IR - it knows some H/W platforms, but no any public guides how to use it.

Need tool similar to cloc (renamed ocloc), but without requirement of compatible OpenCL runtime?

Expected input for such tool:

  • .cl kernel source
  • OpenCL build options
  • H/W platform options / config files (Gen9 for Skylake)

Expected output format:

  • low-level, binary/text form compatible with iga64 tool

Also please consider adding some basic subset of tests for IGC.

pragma unroll not always respected

I'm working on some code, and a small change triggered the shader to take much more time.
I found out adding '-cl-std=CL2.0' to the build options would solve the issue.

I looked at the difference in shader generation with and without the option and found that some loops were no longer unrolled (even with my #pragma unroll), which caused some __private tables to be stored in memory instead of registers.

This is not the first time I notice '-cl-std=CL2.0' generates better code.

I use the driver version 18.26.10987

CMake cannot find SPIRV-Tools.pc

Installation failed with the following message:

CMake Error at AdaptorOCL/SPIRV/SPIRV-Tools/cmake_install.cmake:50 (file):
  file INSTALL cannot find
  "/home/charles/intel_graphics_compiler/build/AdaptorOCL/SPIRV/SPIRV-Tools/SPIRV-Tools.pc".
Call Stack (most recent call first):
  cmake_install.cmake:132 (include)

When I open cmake_install.cmake and go to line 50 I see


 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" TYPE FILE FILES
    "/home/charles/intel_graphics_compiler/build/AdaptorOCL/SPIRV/SPIRV-Tools/SPIRV-Tools.pc"
    "/home/charles/intel_graphics_compiler/build/AdaptorOCL/SPIRV/SPIRV-Tools/SPIRV-Tools-shared.pc"
    )

Then when I look for those .pc files they are indeed missing from the SPIRV-Tools directory.

Debug builds are not wroking correctly

Hello,
@ruiling reports problem with debug build configuration:
intel/compute-runtime#26

Looks like problems while building IGC.
"EnableDxbcDump not defined but used in IGC/AdaptorCommon/customApi.cpp
an invalid product family was passed in to IGC::SetWorkaroundTable() which triggers an assert there.
please help to fix them."

Cleanup installation targets

After building IGC with the recommended steps:

$ cd build
$ cmake -DIGC_OPTION__OUTPUT_DIR=../igc-install/Release \
    -DCMAKE_BUILD_TYPE=Release -DIGC_OPTION__ARCHITECTURE_TARGET=Linux64 \
    ../igc/IGC
$ make -j`nproc`

I get the following layout:

.
└── Release
    ├── bif
    │   ├── embedder
    │   │   ├── IGCsize_t_32__igc_bif_BC_120.cpp
    │   │   ├── IGCsize_t_64__igc_bif_BC_121.cpp
    │   │   └── OCLBiFImpl__igc_bif_BC_122.cpp
    │   ├── IBiF_Impl_int.bc
    │   ├── IBiF_Impl_int.bc_IBiF_Impl__cl__0.bc
    │   ├── IBiF_Impl_int.bc_IBiF_Impl__cl__0.bc.tmp
    │   ├── IBiF_Impl_int_spirv.bc
    │   ├── IBiF_Impl_int_spirv.bc_IBiF_Impl__cl__0.bc
    │   ├── IBiF_Impl_int_spirv.bc_IBiF_Impl__cl__0.bc.tmp
    │   ├── IBiF_PreRelease_int.bc
    │   ├── IBiF_PreRelease_int.bc_IBIF_PreRelease_Impl__cl__0.bc
    │   ├── IBiF_PreRelease_int.bc_IBIF_PreRelease_Impl__cl__0.bc.tmp
    │   ├── IBiF_spirv_size_t_32.bc
    │   ├── IBiF_spirv_size_t_32.bc_pointersize__cl__0.bc
    │   ├── IBiF_spirv_size_t_32.bc_pointersize__cl__0.bc.tmp
    │   ├── IBiF_spirv_size_t_64.bc
    │   ├── IBiF_spirv_size_t_64.bc_pointersize__cl__0.bc
    │   ├── IBiF_spirv_size_t_64.bc_pointersize__cl__0.bc.tmp
    │   ├── IGCsize_t_32.bc
    │   ├── IGCsize_t_32.bc__link__0.bc
    │   ├── IGCsize_t_32.bc__link__0.bc.tmp
    │   ├── IGCsize_t_32_int.bc
    │   ├── IGCsize_t_32_int.bc_IBiF_size_t__cl__0.bc
    │   ├── IGCsize_t_32_int.bc_IBiF_size_t__cl__0.bc.tmp
    │   ├── IGCsize_t_64.bc
    │   ├── IGCsize_t_64.bc__link__0.bc
    │   ├── IGCsize_t_64.bc__link__0.bc.tmp
    │   ├── IGCsize_t_64_int.bc
    │   ├── IGCsize_t_64_int.bc_IBiF_size_t__cl__0.bc
    │   ├── IGCsize_t_64_int.bc_IBiF_size_t__cl__0.bc.tmp
    │   ├── igdclbif.bin
    │   ├── OCLBiFImpl.bc
    │   ├── OCLBiFImpl.bc__link__0.bc
    │   ├── OCLBiFImpl.bc__link__0.bc.tmp
    │   └── opencl_cth.h
    ├── clang
    │   └── linux-ubuntu64
    │       ├── clang
    │       ├── common_clang.h
    │       ├── libopencl_clang.so
    │       ├── module.modulemap
    │       ├── opencl-c-20.h
    │       ├── opencl-c-common.h
    │       ├── opencl-c.h
    │       ├── opencl-c-intel.h
    │       ├── opencl-c-platform-12.h
    │       ├── opencl-c-platform-20.h
    │       └── opencl-c-platform.h
    ├── elf_packager
    ├── fcl
    │   └── embedder
    │       └── opencl_cth_IDR_CTH_H_H_133.cpp
    ├── IntrinsicGenISA.gen
    ├── libBiFLibOcl.a
    ├── libCompiler.a
    ├── libCTHLibFcl.a
    ├── libGenISAIntrinsics.a
    ├── libiga64.so
    ├── libiga_enc64.a
    ├── libiga_s64.a
    ├── libigc.so
    ├── libigdfcl.so
    ├── libLocalScheduler.a
    ├── libSPIRV-Tools.a
    └── Tools
        └── GenX_IR

This is most definitely not something I am expecting to see on Linux. Could you, please, change the layout to the Linux standard one (see https://cmake.org/cmake/help/v3.6/module/GNUInstallDirs.html):

  1. Provide applications in the bin folder (CMAKE_INSTALL_BINDIR, defaults to bin)
  2. Provide dynamic libraries in the lib or lib64 or other standard folder (CMAKE_INSTALL_LIBDIR, defaults to lib or lib64 or lib/<multiarch-tuple> on Debian)
  3. Distribute other files accordingly

Other questions/concerns:

  1. Do you really need all the above targets for IGC or GenX_IR to be functional
  2. How I can make sure that GenX_IR lands nearby cm-compiler (it would be obviously so if you would follow standard practices)
  3. Why do you name your targets in the same way other standard package name them? clang is the most obvious example, elf_packager is the next suspect

cmake error

Tire to build IGC on Ubuntu 16.04, according to the step in build wiki:
$ git clone -b release_40 https://github.com/llvm-mirror/clang clang_source
$ git clone https://github.com/intel/opencl-clang common_clang
$ git clone https://github.com/intel/llvm-patches llvm_patches
$ git clone -b release_40 https://github.com/llvm-mirror/llvm llvm_source
$ git clone -b release_70 https://github.com/llvm-mirror/llvm llvm7.0.0_source
$ git clone -b igc_release_2019-01-05 https://github.com/intel/intel-graphics-compiler igc;
git checkout -b igc_release_2019-01-05
$ mkdir build
$ cd build
$ cmake -DIGC_OPTION__OUTPUT_DIR=../igc-install/Release ../igc/IGC

I failed with following error, do you know how to fix such kind of problem?

-- [IGC] LLVM targets are not defined. Searching for LLVM.
-- [IGC] Using system LLVM 7.0.1
-- [IGC] Using static LLVM.
-- SPIRV-Tools: nosetests was not found - python support code will not be tested
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.12")
-- Precompiled common clang bundle /home/share/worksapce/opencl_compiling/igc/IGC/../Clang/Prebuilt/linux-ubuntu/Release/64/clang.7z does not exist. Try to compile from sources.
-- Trigger common clang compilation from /home/share/worksapce/opencl_compiling/common_clang to /home/share/worksapce/opencl_compiling/igc/igc-install/Release/clang/linux-ubuntu64
CMake Error at /home/share/worksapce/opencl_compiling/common_clang/CMakeLists.txt:53 (include):
include could not find load file:

AddLLVM

CMake Error at /home/share/worksapce/opencl_compiling/common_clang/CMakeLists.txt:54 (include):
include could not find load file:

TableGen

-- Found Git: /usr/bin/git (found version "2.7.4")
-- /tools/clang:
-- /projects/llvm-spirv:
CMake Error at /home/share/worksapce/opencl_compiling/common_clang/CMakeLists.txt:112 (tablegen):
Unknown CMake command "tablegen".

-- Configuring incomplete, errors occurred!

cmake errors

I have the required file structure, running on 8700T, Ubuntu 16.04. Keep getting this error, and llvm7 is no longer available from apt.

`CMake Warning at CMakeLists.txt:1908 (message):
CMAKE_BUILD_TYPE: Unknown build configuration. The following
configurations are available: Debug;ReleaseInternal;Release.

The "Release" configuration will be used.

This value has meaning only for single-configuration generators (like
Make). It will be ignored for MSVC/XCode.

CMake Warning (dev) at CMakeLists.txt:2050 (set):
Cannot set "IGC_LIBRARY_NAME": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:2059 (set):
Cannot set "FCL_LIBRARY_NAME": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.

IGC Project
Build type: Release (single-configuration generator)
Build tools: OFF
LLVM dir:

Output directory:

  • "/home/burro/graphics_compiler/igc/igc-install/Release"
    Install root directory:
    "/usr/local"
    Architecture:
  • target: Linux64 (detected: Linux64)
  • host: Linux64 (detected: Linux64)
    Cross-compilation needed: NO
    Cross-compilation set: FALSE

-Advanced:

  • Link BiF resources: ON
  • Building Windows Universal:

CMake Warning at CMakeLists.txt:2196 (message):
not defined, defaulting to y: UFO_VK

[IGC] LLVM targets are not defined. Searching for LLVM.
CMake Warning at CMakeLists.txt:3262 (find_package):
Could not find a configuration file for package "LLVM" that is compatible
with requested version "7.0.0".

The following configuration files were considered but not accepted:

/usr/lib/llvm-9/cmake/LLVMConfig.cmake, version: 9.0.0
/usr/lib/llvm-4.0/cmake/LLVMConfig.cmake, version: 4.0.0

-[IGC] LLVM compilation from /home/burro/graphics_compiler/igc/IGC/../../llvm_patches

  • LLVM_SOURCE_URL = /home/burro/graphics_compiler/llvm_patches/../llvm7.0.0_source
    -- LLVM_OPTIONS = -DLLVM_TARGETS_TO_BUILD=;-DLLVM_BUILD_TOOLS=true;-DLLVM_INCLUDE_TOOLS=true;-DLLVM_INSTALL_UTILS=false;-DLLVM_INCLUDE_UTILS=false;-DLLVM_BUILD_EXAMPLES=false;-DLLVM_INCLUDE_EXAMPLES=false;-DLLVM_BUILD_TESTS=false;-DLLVM_INCLUDE_TESTS=false;-DLLVM_APPEND_VC_REV=false;-DLLVM_ENABLE_THREADS=true;-DLLVM_ENABLE_CXX1Y=false;-DLLVM_ENABLE_PIC=true;-DLLVM_ENABLE_WARNINGS=true;-DLLVM_ENABLE_PEDANTIC=true;-DLLVM_ENABLE_WERROR=false;-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF;-DLLVM_BUILD_RUNTIME=true;-DLLVM_ENABLE_TERMINFO=false;-DLLVM_ENABLE_EH=true;-DLLVM_ENABLE_RTTI=true;-DLLVM_BUILD_32_BITS=false
    -- LLVM_BUILD_TYPE = Release
    -- [LLVM] PYTHON_EXECUTABLE = /usr/bin/python2
    -- [LLVM] Clearing build system compilation flags
    -- Native target X86 is not selected; lli will not JIT code
    -- Threads enabled.
    -- Doxygen disabled.
    -- Go bindings disabled.
    -- OCaml bindings disabled, need ctypes >=0.4.
    -- Found Python module pygments
    -- Found Python module pygments.lexers.c_cpp
    -- Found Python module yaml
    -- LLVM host triple: x86_64-unknown-linux-gnu
    -- LLVM default target triple: x86_64-unknown-linux-gnu
    -- Building with -fPIC
    -- Constructing LLVMBuild project information
    -- Linker detection: GNU ld
    -- [LLVM] Restoring build system compilation flags
    -- SPIRV-Tools: nosetests found - python support code will be tested
    -- Precompiled common clang bundle /home/burro/graphics_compiler/igc/IGC/../Clang/Prebuilt/linux-ubuntu/Release/64/clang.7z does not exist. Try to compile from sources.
    -- Trigger common clang compilation from /home/burro/graphics_compiler/common_clang to /home/burro/graphics_compiler/igc/igc-install/Release/clang/linux-ubuntu64
    CMake Error at /home/burro/graphics_compiler/common_clang/CMakeLists.txt:53 (include):
    include could not find load file:

    AddLLVM

CMake Error at /home/burro/graphics_compiler/common_clang/CMakeLists.txt:54 (include):
include could not find load file:

TableGen

-- No patches in /home/burro/graphics_compiler/common_clang/patches/clang
-- No patches in /home/burro/graphics_compiler/common_clang/patches/spirv
CMake Error at /home/burro/graphics_compiler/build/llvm/src/cmake/modules/LLVM-Config.cmake:31 (list):
list sub-command REMOVE_ITEM requires two or more arguments.
Call Stack (most recent call first):
/home/burro/graphics_compiler/build/llvm/src/cmake/modules/LLVM-Config.cmake:253 (is_llvm_target_library)
/home/burro/graphics_compiler/build/llvm/src/cmake/modules/AddLLVM.cmake:544 (llvm_map_components_to_libnames)
/home/burro/graphics_compiler/build/llvm/src/cmake/modules/AddLLVM.cmake:620 (llvm_add_library)
/home/burro/graphics_compiler/common_clang/CMakeLists.txt:231 (add_llvm_library)

-- Configuring Intel Gen Assembler (IGA) Component
-- - GED_BRANCH: GED_external
-- - CMAKE_CXX_COMPILER: /usr/bin/c++
INFOLIT tests not enabled. Missing igc_opt target.
-- Configuring incomplete, errors occurred!`

IGC build errors against LLVM-9

I was trying to build IGC against LLVM-9 following the instruction here: #54. There are few non-trivial incompatibilities which are beyond my knowledge of LLVM. For example:

/home/dvrogozh/git/github/tmp/igc/IGC/GenISAIntrinsics/GenIntrinsics.cpp:519:83: error: no matching function for call to ‘cast<llvm::Function>(llvm::FunctionCallee)’
/home/dvrogozh/git/github/tmp/igc/IGC/Compiler/CISACodeGen/ResolveGAS.cpp:595:14: error: cannot convert ‘llvm::FunctionCallee’ to ‘llvm::Constant*’ in assignment

I think that this incompatibility came after this LLVM change: llvm/llvm-project@1368022.

Please, be aware of the problem. Can someone, please, guide on how to fix or help to fix? I will attach full log.

llvm9_build_log.txt

UPDATE

I was able to resolve trivial issues just reusing LLVM-8 path, here is a patch for that: #58

These changes landed as 80db6d6

igc on Clear Linux

Hi I am working on IGC on Clear Linux and during $make I am seeing lots of Errors such as

/home/kimsehun/project/intel/igc/visa/iga/IGALibrary/Backend/../IR/Loc.hpp:43:14: error: ‘iga::Loc::col’ will be initialized after [-Werror=reorder]
uint32_t col;
^~~
/home/kimsehun/project/intel/igc/visa/iga/IGALibrary/Backend/../IR/Loc.hpp:41:14: error: ‘iga::PC iga::Loc::offset’ [-Werror=reorder]
PC offset; // file offset or binary offset (PC)
^~~~~~
/home/kimsehun/project/intel/igc/visa/iga/IGALibrary/Backend/../IR/Loc.hpp:54:5: error: when initialized here [-Werror=reorder]
Loc(uint32_t ln,
^~~
home/kimsehun/project/intel/igc/visa/iga/IGALibrary/Backend/GED/../../IR/Loc.hpp:43:14: error: ‘iga::Loc::col’ will be initialized after [-Werror=reorder]
uint32_t col;
^~~
/home/kimsehun/project/intel/igc/visa/iga/IGALibrary/Backend/GED/../../IR/Loc.hpp:41:14: error: ‘iga::PC iga::Loc::offset’ [-Werror=reorder]
PC offset; // file offset or binary offset (PC)
^~~~~~
/home/kimsehun/project/intel/igc/visa/iga/IGALibrary/Backend/GED/../../IR/Loc.hpp:54:5: error: when initialized here [-Werror=reorder]
Loc(uint32_t ln,
^~~
Do you happened to know why?

Over generation of 'mov' instruction for some kernels

Hi,

For some kernels, a lot of useless mov operations are generated (usually after an if conditional). The mov operations can be avoided by just writing to the correct registers in the if condition or equivalent.
I noticed specifying 'cl-std=CL2.0' helps workaround the issue in some cases, however not in all cases.
I've sent an example by mail to Alexander Paige, but I open this bug report to keep track of the issue.

[Question] Intel igpu offloading plan regarding openMP support on GCC and LLVM ?

My question is not directly related to openCL.
But as a consumer I would like to say that I think GPGPU is coming slowly to a new era.
GPGPU has been possible on various accelerators sinces a decade, yet it has gotten quite a niche usage despite being extremely useful.
This is because reasons such as:
1* The needs to learn a new langage such as openCL/CUDA where most of the market will have a separate cpu code on c++. SYCL help to bridge this gap but still require the needs to systematically adapt existing cpu code.
2* The perceived learning curve, and the real one, and even after mastering them, the inherent productivity loss of having need of kernel boilerplate and to fit to a constrained hardware model.
3* The lack of teaching in universities, or the teaching of Nvidia vendor lockin through proprietary CUDA
4* The lack of heterogeneous computing capabilities that led to yet another api HSA that has currently no suffisant traction in x86 world. the lack of ability to e.g run a loop in multithread, AND on SIMD AND on GPU. As I understund today, SYCL does not allow simultaneous SIMD (AVX) and GPU. I am not aware if it allow simultaneous multithread and GPU offloading on the same loop.

The new era I see is the new thing in town that answer all of thoses real world issues:
openMP 4.5
openMP 4.5 regarding issue 1 and 2*:
One still needs to learn openMP and it has some advanced features that imply a cognitive load.
BUT openMP is made of annotations, that is you can INCREMENTALLY multithread/SIMDIFY/offload parts of codes, WITHOUT changing the code (in most cases) by adding clear explicit annotations.
OpenMP is far higher level, eliminate entire classes of errors, automate things for the developper, is easier and one order of magnitude quicker to learn.

regarding issue 3* openMP is widely used / teached in HPC world, and is extremely vendor, even langage agnostic (supported on Fortran by example).

Regarding issue 4* openMP is the only way that i'm aware of to run code simultaneously in SIMD(avx), cores and an accelerator. Enabling unprecedented performance gain. And openMP is according many benchmarks the most optimised multithread AND SIMD implementation.
It is evolving (5.0) and OpenACC is being merged into openMP !

That being said, let's be clear, openMP offloading does NOT replace SYCL as SYCL can allow better performance on fine grained cases. But because of all said reasons it will play a massive role in HPC/GPGPU computing.
Intel does not yet support openMP offloading to intel iGPUs, while Nvidia NVPTX is well supported on Clang and GCC, and AMD GCN offloading is ready for GCC 10. This is making intel far less competitive.
Yet Intel is really making a push for GPU computing, and has the ressources.

This is why I ask Intel to consider OpenMP intel i/D/GPU/FPGA offloading support in llvm and GCC as a priority.
And allowing better openMP/SYCL interoperability, and investing ressources in improving openMP (e.g clang omp declare simd: does not yet enable the vectorizer passe which is big low hanging fruit) instead of reinventing the wheel with yet another competing standard () that seems to be intel oneAPI.
https://www.phoronix.com/scan.php?page=news_item&px=Intel-oneAPI-Announcement
Another big improvment that could be brought by openMP would be to allow it run easily on clusters in a standardised way.
currently HPC users mixes openMP and MPI but this is suboptimal, intel already has developped cluster openMP https://software.intel.com/sites/default/files/1b/1f/6330 but integrated in the standard for openMP next and adding support for it in other compilers than ICC would be a nice improvment !
I wonder if there could also be a map reduce extension.
Edit: There's one! But not well tested: https://ompcloud.github.io/

What's IGC_OPTION_OUTPUT_DIR

I'm trying to build this with -DIGC_OPTION_OUTPUT_DIR=<LOCAL_FOLDER>

but configure print out shows

Install root directory:
-- "/usr/local"

It only changes when using -DCMAKE_INSTALL_PREFIX=<LOCAL_FOLDER>

keep a copy of khronos headers

Can this program/library do something with the headers? Keep a copy of the version supported or add them as a git submodule? This will result on a building experience less complex.

Intel i3-i8300

Linux system: i3-8300 cpu

I have compiled and installed the graphics compiler and clinfo gives me:

cl_get_gt_device(): error, unknown device: 3e91
cl_get_gt_device(): error, unknown device: 3e91
Number of platforms 2
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 18.3.1
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA

Platform Name Intel Gen OCL Driver
Platform Vendor Intel
Platform Version OpenCL 2.0 beignet 1.3
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing
Platform Extensions function suffix Intel
cl_get_gt_device(): error, unknown device: 3e91

Any comments please?

Remove ubuntu special directives inside CMake

I am not sure why this is needed but it looks like it can be improved.

If I am not using Ubuntu, Most of these build requirements will be configured wrong unnecessarily.

This is about everything related to -DLINUX_DISTRO=ubuntu

A good approach would be put everything on a single CMake file where linux, windows and others are separated.

Some performance issues with format conversion

I was told on #intel-gfx there was some interest reporting compiler inefficiencies here.

I have the following pattern with issues:

SRC_TYPE4 data = vload4(0, ptr_to_mydata);
if (something) {
some work
}
some work
table_of_float4[k] = convert_float4(data);
some work with table_of_float4[k]

This pattern is in a for loop. k is fixed. All accesses to the __private table_of_float4 have their indexes known in advance because all loops on it are unrolled, thus enabling to store it in registers.

If SRC_TYPE4 is uchar4, the conversion to float is moved before "if (something)", thus the latency is not well hidden and more registers are consumed. My program performance is 20% slower than with uint4.

if SRC_TYPE is float4 (no conversion needed), the compiler decides to store table_of_float4 in memory instead of registers, and the program performance is more than 10 times slower.

I used vtune to analyse the compiler output. I use the Neo driver on Skylake.

The code is intended to be published in the future, but I don't want to publish it here publicly yet. I can send it by mail to developpers if requested.

Build instructions are not clear

Hi, I think your build instructions could be improved. Currently you have references to two different LLVM versions in your clone commands. If you support both or plan to support just the 7.0 version I would suggest to either remove the references to LLVM 4.0 from the build instructions or have separate sections for each version. Also, regarding the igc git clone command... you only have master branch so, the las command in the current build instructions does nothing but create a new branch using latest master branch code.
I will change the instructions to something like:

Example command:
$ git clone -b release_70 https://github.com/llvm-mirror/clang clang_source
$ git clone https://github.com/intel/opencl-clang common_clang
$ git clone https://github.com/intel/llvm-patches llvm_patches
$ git clone -b release_70 https://github.com/llvm-mirror/llvm llvm_source
$ git clone https://github.com/intel/intel-graphics-compiler igc

Problem with wdk

Hello.
I'm trying to build igc on windows and have such cmake errors.

CMake Error at IGC/CMakeLists.txt:2165 (include):
  include could not find load file:

    /utils.cmake


CMake Warning at IGC/CMakeLists.txt:2206 (message):
  not defined, defaulting to y: UFO_VK


CMake Deprecation Warning at build/IGC/llvm/src/CMakeLists.txt:15 (cmake_policy):
  The OLD behavior for policy CMP0051 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Error at IGC/GenISAIntrinsics/CMakeLists.txt:71 (bs_set_wdk):
  Unknown CMake command "bs_set_wdk".

Support for more atomics

Hi,

I run a Skylake GPU (the device reports Intel(R) Gen9 HD Graphics NEO).

The device advertises a few atomic extensions:
cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics

I need for some applications global float atomics, and even double or long atomics.

float add atomic can be emulated with the atomic_cmpxchg instruction, but that part of the code runs 4 times slower than when I use int32 add atomic (even when conflicts only occur less than 0.1% of the time)

I have some precision issues in some cases and would need to use double for these cases, but intel doesn't advertised the cl_khr_int64_* atomics.

I looked at the hardware documentation files available here:
https://01.org/linuxgraphics/documentation/hardware-specification-prms

To my understanding of these documents, not only int64 atomics are available on the hardware, but also float and double atomics.

Please add support for int64 atomics, and add support for float and double atomics as well via a new OpenCL extension, that would be great !

Make failed...

I followed the instruction cloned the release_40 llvm.

Example command:
$ git clone -b release_40 https://github.com/llvm-mirror/clang clang_source
$ git clone https://github.com/intel/opencl-clang common_clang
$ git clone https://github.com/intel/llvm-patches llvm_patches
$ git clone -b release_40 https://github.com/llvm-mirror/llvm llvm_source
$ git clone https://github.com/intel/intel-graphics-compiler igc
$ git clone https://github.com/KhronosGroup/OpenCL-Headers opencl_headers

But, I got make faied as below. I think the llvm release_40 branch doesn't have
class llvm::FastMathFlagsthe function isFast. So, I think you should update your Readme.md file, tell us your master branch used specific llvm branch, otherwise do as the Readme said we cannot build it.

Thanks...

igc/IGC/Compiler/CustomUnsafeOptPass.cpp:105:69: error: ‘class llvm::FastMathFlags’ has no member named ‘isFast’
     if(llvm::isa<llvm::FPMathOperator>(op) && op.getFastMathFlags().isFast())

SEGV when building with clang 5.0.1

there is crash in libigdccl.so when built with clang 5.0.1 on ArchLinux.

#0  0x00007f0585cd2c62 in llvm::MemoryBuffer::getMemBufferRef() const () from .../compute-runtime/build/bin/libigdccl.so
#1  0x00007f05850cf8ca in TC::TranslateBuild (pInputArgs=pInputArgs@entry=0x7ffdcd9729d0, pOutputArgs=pOutputArgs@entry=0x7ffdcd9729a0, 
    inputDataFormatTemp=<optimized out>, IGCPlatform=..., profilingTimerResolution=<optimized out>)
    at .../compute-runtime/igc/IGC/AdaptorOCL/dllInterfaceCompute.cpp:729
#2  0x00007f0585174408 in IGC::IgcOclTranslationCtx<0ul>::Impl::Translate (this=<optimized out>, outVersion=<optimized out>, src=<optimized out>, 
    options=<optimized out>, internalOptions=<optimized out>, tracingOptions=<optimized out>, tracingOptionsCount=<optimized out>)
    at .../compute-runtime/igc/IGC/AdaptorOCL/ocl_igc_interface/impl/igc_ocl_translation_ctx_impl.h:173
#3  0x0000557a3d0ceb45 in OCLRT::OfflineCompiler::buildSourceCode() ()
#4  0x0000557a3d0d43d2 in OCLRT::OfflineCompiler::build() ()
#5  0x0000557a3d0cd66c in main ()

original issue:
intel/compute-runtime#23

Clean up Buiding section in README about llvm patches

Can the Building section within README file be simplified?

Please explain which features are provided by using llvm patches.

IIUC, llvm patches shouldn't be needed on later versions of llvm. So in this case can README explain what is supported? i.e. llivm-7.x, llvm-8.x or llvm-9.x (master branch)

Then when user wants to compile against system llvm (i.e. llvm without igc instructed patches) it should compile as the following is enforced

#if !defined (SYSTEM_LLVM)
compile stuff as llvm 7.x is patched
# else
do not compile this feature
#endif 

This way you're letting the user decide if this feature is necessary or not.

Remove common_clang dependency

Please make sure that this dependency is fully removed for all versions of clang if possible. If only a newer version will be able to remove this dependency please clarify.

Eliminate "workspace layout" requirement to build the compiler: use dependencies

Please, eliminate workspace layout requirements to build the IGC. As of now you require the following folder structure:

workspace
      |- clang_source           https://github.com/llvm-mirror/clang
      |- common_clang           https://github.com/intel/opencl-clang
      |- llvm_patches           https://github.com/intel/llvm-patches
      |- llvm_source            https://github.com/llvm-mirror/llvm
      |- igc                    https://github.com/intel/intel-graphics-compiler
      |- opencl_headers         https://github.com/KhronosGroup/OpenCL-Headers

Please, remove this completely. It is expected that project will require steps similar to the following to build:

git clone https://github.com/intel/intel-graphics-compiler.git && cd intel-graphics-compiler
mkdir build && cd build
cmake ..
make -j8
make install

There are the following options to consider dealing with dependencies:

  1. Detect dependencies installed on the system via pkg-config and other standard tools. Error out if dependency is not satisfied: that's an end-user responsibility to satisfy the dependency.
  2. Pull in sources of the dependency inside your project via: 1) just copy - that's the usual case for gtest, your opencl headers is the obvious candidate, 2) use git submodule.

GenIsaIntrinsics dont build on GCC 7.2.1

It looks like warnings are treated as errors on the IGC build. Building with gcc 7.2.1 produces the following warning that causes the build to fail:

In file included from /home/raun/workspace/igc/IGC/common/Types.hpp:28:0,
                 from /home/raun/workspace/igc/IGC/common/Stats.hpp:38,
                 from /home/raun/workspace/igc/IGC/Compiler/CodeGenPublic.h:31,
                 from /home/raun/workspace/igc/IGC/GenISAIntrinsics/GenIntrinsics.cpp:28:
/home/raun/workspace/igc/IGC/../3d/common/iStdLib/types.h:91:32: error: ‘-pedantic’ is not an option that controls warnings [-Werror=pragmas]
 #pragma GCC diagnostic ignored "-pedantic" // warning: ISO C++ prohibits anonymous structs [-pedantic]
                                ^~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/build.make:63: GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/GenIntrinsics.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:332: GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
[raun@localhost build]$ Scanning dependencies of target GenISAIntrinsics
                 from /home/raun/workspace/igc/IGC/Compiler/CodeGenPublic.h:31,
                 from /home/raun/workspace/igc/IGC/GenISAIntrinsics/GenIntrinsics.cpp:28:
-bash: Scanning: command not found
/home/raun/workspace/igc/IGC/../3d/common/iStdLib/types.h:91:32: error: ‘-pedantic’ is not an option that controls warnings [-Werror=pragmas]
 #pragma GCC diagnostic ignored "-pedantic" // warning: ISO C++ prohibits anonymous structs [-pedantic]
[raun@localhost build]$ [  4%] Building CXX object GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/GenIntrinsics.cpp.o
-bash: [: missing `]'
[raun@localhost build]$ In file included from /home/raun/workspace/igc/IGC/common/Types.hpp:28:0,
-bash: In: command not found
[raun@localhost build]$                  from /home/raun/workspace/igc/IGC/common/Stats.hpp:38,
-bash: from: command not found
[raun@localhost build]$                  from /home/raun/workspace/igc/IGC/Compiler/CodeGenPublic.h:31,
-bash: from: command not found
[raun@localhost build]$                  from /home/raun/workspace/igc/IGC/GenISAIntrinsics/GenIntrinsics.cpp:28:
-bash: from: command not found
[raun@localhost build]$ /home/raun/workspace/igc/IGC/../3d/common/iStdLib/types.h:91:32: error: ‘-pedantic’ is not an option that controls warnings [-Werror=pragmas]
-bash: /home/raun/workspace/igc/IGC/../3d/common/iStdLib/types.h:91:32:: No such file or directory
[raun@localhost build]$  #pragma GCC diagnostic ignored "-pedantic" // warning: ISO C++ prohibits anonymous structs [-pedantic]
[raun@localhost build]$                                 ^~~~~~~~~~~
-bash: ^~~~~~~~~~~: command not found
[raun@localhost build]$ cc1plus: all warnings being treated as errors
-bash: cc1plus:: command not found


Error occurred while executing cmake in debug mode

Hello
I was install IGC as mentioned in the build instructions. However, I want to build the compiler in the debug. So first I downloaded all the dependencies and I have seen previous solution like this one and so I downloaded common clang using git clone -b ocl-open-40 https://github.com/intel/opencl-clang common_clang .
After downloading all the dependencies I executed the cmake command in the debug mode. The cmake command I used is cmake -DIGC_OPTION__OUTPUT_DIR=../igc-install/Debug -DCMAKE_BUILD_TYPE=Debug -DIGC_OPTION__ARCHITECTURE_TARGET=Linux64 ../igc/IGC

However I got a LLVM error while doing the cmake. The whole console log after executing the cmake command is provided below:

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:2050 (set):
Cannot set "IGC_LIBRARY_NAME": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:2059 (set):
Cannot set "FCL_LIBRARY_NAME": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.

================================ IGC Project ================================
-- Build type: Debug (single-configuration generator)
-- Build tools: OFF
-- LLVM dir:

-- Output directory:
-- "/home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/igc/igc-install/Debug"
-- Install root directory:
-- "/usr/local"
-- Architecture:
-- - target: Linux64 (detected: Linux64)
-- - host: Linux64 (detected: Linux64)

-- Cross-compilation needed: NO
-- Cross-compilation set: FALSE

-- Advanced:
-- - Link BiF resources: ON
-- - Building Windows Universal:
-- =============================================================================
CMake Warning at CMakeLists.txt:2196 (message):
not defined, defaulting to y: UFO_VK

-- [IGC] LLVM targets are not defined. Searching for LLVM.
CMake Warning at CMakeLists.txt:3271 (find_package):
Could not find a configuration file for package "LLVM" that is compatible
with requested version "7.0.0".

The following configuration files were considered but not accepted:

/usr/lib/llvm-4.0/cmake/LLVMConfig.cmake, version: 4.0.0

-- [IGC] LLVM compilation from /home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/igc/IGC/../../llvm_patches
-- LLVM_SOURCE_URL = /home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/llvm_patches/../llvm7.0.0_source
-- LLVM_OPTIONS = -DLLVM_TARGETS_TO_BUILD=;-DLLVM_BUILD_TOOLS=true;-DLLVM_INCLUDE_TOOLS=true;-DLLVM_INSTALL_UTILS=false;-DLLVM_INCLUDE_UTILS=false;-DLLVM_BUILD_EXAMPLES=false;-DLLVM_INCLUDE_EXAMPLES=false;-DLLVM_BUILD_TESTS=false;-DLLVM_INCLUDE_TESTS=false;-DLLVM_APPEND_VC_REV=false;-DLLVM_ENABLE_THREADS=true;-DLLVM_ENABLE_CXX1Y=false;-DLLVM_ENABLE_PIC=true;-DLLVM_ENABLE_WARNINGS=true;-DLLVM_ENABLE_PEDANTIC=true;-DLLVM_ENABLE_WERROR=false;-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF;-DLLVM_BUILD_RUNTIME=true;-DLLVM_ENABLE_TERMINFO=false;-DLLVM_ENABLE_EH=true;-DLLVM_ENABLE_RTTI=true;-DLLVM_BUILD_32_BITS=false
-- Copying stock LLVM sources to /home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/build/llvm/build/../src
Apply /home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/llvm_patches/releases/7.0.0/patches_external/fix-pointer-for-lifetime-intrinsic.patch file
patching file lib/Transforms/Scalar/SROA.cpp
-- LLVM_BUILD_TYPE = Debug
-- [LLVM] PYTHON_EXECUTABLE = /usr/bin/python2
-- [LLVM] Clearing build system compilation flags
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for link.h
-- Looking for link.h - found
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for malloc/malloc.h
-- Looking for malloc/malloc.h - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/param.h
-- Looking for sys/param.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - not found
-- Looking for zlib.h
-- Looking for zlib.h - found
-- Looking for fenv.h
-- Looking for fenv.h - found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Looking for mach/mach.h
-- Looking for mach/mach.h - not found
-- Looking for histedit.h
-- Looking for histedit.h - not found
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Looking for linux/magic.h
-- Looking for linux/magic.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_getspecific in pthread
-- Looking for pthread_getspecific in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for compress2 in z
-- Looking for compress2 in z - found
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
-- Looking for xar_open in xar
-- Looking for xar_open in xar - not found
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for setrlimit
-- Looking for setrlimit - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for posix_fallocate
-- Looking for posix_fallocate - found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Looking for lseek64
-- Looking for lseek64 - found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - not found
-- Looking for getrlimit
-- Looking for getrlimit - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for realpath
-- Looking for realpath - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dladdr
-- Looking for dladdr - not found
-- Looking for GLIBC
-- Looking for GLIBC - found
-- Looking for sched_getaffinity
-- Looking for sched_getaffinity - found
-- Looking for CPU_COUNT
-- Looking for CPU_COUNT - found
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG - Success
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG - Failed
-- Performing Test HAS_MAYBE_UNINITIALIZED
-- Performing Test HAS_MAYBE_UNINITIALIZED - Success
-- Native target X86 is not selected; lli will not JIT code
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings disabled.
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Performing Test CXX_SUPPORTS_CXX11
-- Performing Test CXX_SUPPORTS_CXX11 - Success
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Failed
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Failed
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.12")
-- Constructing LLVMBuild project information
-- Linker detection: GNU ld
-- [LLVM] Restoring build system compilation flags
CMake Error at /home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/llvm_patches/CMakeLists.txt:210 (message):
Expected LLVM version 7.0.0 but found 7.1.0.

-- Configuring incomplete, errors occurred!
See also "/home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/build/CMakeFiles/CMakeOutput.log".
See also "/home/duttasankha/Desktop/SANKHA_ALL/INTEL_GRAPHICS_COMPILER/IGC_1/build/CMakeFiles/CMakeError.log".

I am using ubuntu 16.04 and I would also like to mention that I have to use a debug or an internal version of the compiler. Also please let me know if you need any further information. Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.