summaryrefslogtreecommitdiff
path: root/README.html
blob: c5fcba8e776bac2ce92f1ddfb7c0779e609c71b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<h1>Beignet</h1>

<p>Beignet is an open source implementaion of the OpenCL specification - a generic
compute oriented API. This code base contains the code to run OpenCL programs on
Intel GPUs which bsically defines and implements the OpenCL host functions
required to initialize the device, create the command queues, the kernels and
the programs and run them on the GPU. The code base also contains the compiler
part of the stack which is included in <code>backend/</code>. For more specific information
about the compiler, please refer to <code>backend/README.md</code></p>

<h2>How to build</h2>

<p>There are two ways to build Beignet.</p>

<p>The first one uses a simple Makefile. Just type <code>make</code> and the project will
build if everything is properly installed.</p>

<p>The project also uses CMake with three profiles:</p>

<ol>
<li>Debug (-g)</li>
<li>RelWithDebInfo (-g with optimizations)</li>
<li>Release (only optimizations)</li>
</ol>

<p>Basically, from the root directory of the project</p>

<p><code>&gt; mkdir build</code></p>

<p><code>&gt; cd build</code></p>

<p><code>&gt; cmake ../ # to configure</code></p>

<p>Choose whatever you want for the build.</p>

<p>Then press 'c' to configure and 'g' to generate the code.</p>

<p><code>&gt; make</code></p>

<p>The project depends on several external libraries:</p>

<ul>
<li>Several X components (XLib, Xfixes, Xext)</li>
<li>libdrm libraries (libdrm and libdrm_intel)</li>
<li>Various LLVM components</li>
<li>The compiler backend itself (libgbe)</li>
<li>Mesa git master version built with gbm enabled to support extension cl_khr_gl_sharing.</li>
</ul>

<p>CMake will check the dependencies and will complain if it does not find them.</p>

<p>The cmake will also build the backend project. Please refer to:
<a href="backend/README.html">OpenCL Gen Backend</a> to get more dependencies.</p>

<p>Once built, the run-time produces a shared object libcl.so which basically
directly implements the OpenCL API. A set of tests are also produced. They may
be found in <code>utests/</code>.</p>

<p>Note that the compiler depends on LLVM (Low-Level Virtual Machine project).
Right now, the code has been compiled with LLVM 3.1/3.2. It will not compile
with any thing older. </p>

<p><a href="http://llvm.org/releases/">http://llvm.org/releases/</a></p>

<p>LLVM 3.1 and 3.2 are supported.</p>

<p>Also note that the code was compiled on GCC 4.6 and GCC 4.7. Since the code uses
really recent C++11 features, you may expect problems with older compilers. Last
time I tried, the code breaks ICC 12 and Clang with internal compiler errors
while compiling anonymous nested lambda functions.</p>

<h2>How to run</h2>

<p>Apart from the OpenCL library itself that can be used by any OpenCL application,
this code also produces various tests to ensure the compiler and the run-time
consistency. This small test framework uses a simple c++ registration system to
register all the unit tests.</p>

<p>You need to set the variable <code>OCL_KERNEL_PATH</code> to locate the OCL kernels. They
are with the run-time in <code>./kernels</code>.</p>

<p>Then in <code>utests/</code>:</p>

<p><code>&gt; ./utest_run</code></p>

<p>will run all the unit tests one after the others</p>

<p><code>&gt; ./utest_run some_unit_test0 some_unit_test1</code></p>

<p>will only run <code>some_unit_test0</code> and <code>some_unit_test1</code> tests</p>

<h2>Supported Hardware</h2>

<p>As an important remark, the code was only tested on IVB GT2 with a rather
minimal Linux distribution (ArchLinux) and a very small desktop (dwm). If you
use something more sophisticated using compiz or similar stuffs, you may expect
serious problems and GPU hangs.</p>

<p>Only IVB is supported right now. Actually, the code was only run on IVB GT2. You
may expect some issues with IVB GT1.</p>

<h2>TODO</h2>

<p>The run-time is far from being complete. Most of the pieces have been put
together to test and develop the OpenCL compiler. A partial list of things to
do:</p>

<ul>
<li><p>Support dynamic sampler assignment in kernel. We now only support user to use
clCreateSampler at host side and then pass the sampler to kernel.</p></li>
<li><p>Complete cl_khr_gl_sharing support. We lack of some APIs implementation such
as clCreateFromGLBuffer,clCreateFromGLRenderbuffer,clGetGLObjectInfo... Currently,
the working APIs are clCreateFromGLTexture,clCreateFromGLTexture2D.</p></li>
<li><p>Support for events.</p></li>
<li><p>Check that NDRangeKernels can be pushed into <em>different</em> queues from several
threads.</p></li>
<li><p>Support for nonblocking mode Enqueue*Buffer. Now we only use the map extension to
implement those Enqueue*Buffer functions. </p></li>
<li><p>No state tracking at all. One batch buffer is created at each "draw call"
(i.e. for each NDRangeKernels). This is really inefficient since some
expensive pipe controls are issued for each batch buffer</p></li>
<li><p>Valgrind reports some leaks in libdrm. It sounds like a false positive but it
has to be checked. Idem for LLVM. There is one leak here to check.</p></li>
<li><p>Support image/samplers in C++ simulator.</p></li>
</ul>

<p>More generally, everything in the run-time that triggers the "FATAL" macro means
that something that must be supported is not implemented properly (either it
does not comply with the standard or it is just missing)</p>

<p>Project repository</p>

<p>Right now, we host our project on fdo at: git://anongit.freedesktop.org/beignet.</p>

<h2>The team</h2>

<p>This project was created by Ben Segovia when he was working for Intel. Now we
have a team in China OTC graphics department continue to work on this project.
We haven't set up a public mail list for this project, but we will do so in
the near furture. Before that, the contact is as below:
Zou Nanhai (<a href="&#x6D;&#x61;&#x69;&#108;&#x74;&#111;:&#x6E;&#97;&#x6E;&#104;&#x61;&#105;&#x2E;&#122;&#x6F;&#x75;&#64;&#x69;&#x6E;&#x74;&#101;&#x6C;&#x2E;&#x63;&#111;&#109;">&#x6E;&#97;&#x6E;&#104;&#x61;&#105;&#x2E;&#122;&#x6F;&#x75;&#64;&#x69;&#x6E;&#x74;&#101;&#x6C;&#x2E;&#x63;&#111;&#109;</a>).</p>