[Beignet] porting beignet to FreeBSD

Johannes Dieterich dieterich.joh at gmail.com
Wed Nov 19 13:22:03 PST 2014


Hi,

I am currently looking into porting beignet over to FreeBSD. My motivation
is strictly based on wanting to use my preferred system for OpenCL
development so please bear with me that I am a bit shaky in some stuff
especially in the grittier C++ details...

I should start by saying in general the "graphics" support within FreeBSD
is currently lagging behind Linux a bit but we are fortunate to have a few
talented and driven developers working on that and hopefully changing that
eventually (I am not one of them :-) ).

Please find attached a few patches that enable configuring and the first
few compilations on FreeBSD. Namely, those are:

* FindLLVM.patch: adds FreeBSD names of llvm-config to the search list
(both llvm 3.4 and 3.5).

* alloc.patch: for backend/src/sys/alloc.cpp , adds a FreeBSD clause to the
alignedMalloc function, using the POSIX standard function posix_memalign.

My next issue is the hash_map.hpp. You use std::tr1::unordered_map while
FreeBSD (according to my research) requires the use of std::unordered_map
instead (see a patch to that extend attached as hash_map.patch). However, I
am uncertain as I get the following errors at compile time:

[  8%] Building CXX object backend/src/CMakeFiles/gbe.dir/ir/unit.cpp.o
cd /usr/home/sid/software/beignet/build/backend/src &&
/usr/local/bin/clang++34   -DEMULATE_GEN=0
-DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND -DUSE_FULSIM=0 -Dgbe_EXPORTS
-funroll-loops -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -fPIC -Wall
-mfpmath=sse -Wcast-align -Wl,-E -std=c++0x -Wno-invalid-offsetof -fno-rtti
-I/usr/local/llvm34/include  -DNDEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-DGBE_DEBUG_MEMORY=0  -DGBE_COMPILER_AVAILABLE=1 -fvisibility=hidden -O2 -g
-DGBE_DEBUG=1 -fPIC -I/usr/home/sid/software/beignet/build
-I/usr/home/sid/software/beignet -I/usr/local/include
-I/usr/local/include/libdrm -I/usr/home/sid/software/beignet/build/backend
-I/usr/home/sid/software/beignet/backend/src/.    -D__sid__ -DLLVM_34 -o
CMakeFiles/gbe.dir/ir/unit.cpp.o -c
/usr/home/sid/software/beignet/backend/src/ir/unit.cpp
clang: warning: -Wl,-E: 'linker' input unused
In file included from
/usr/home/sid/software/beignet/backend/src/ir/unit.cpp:24:
In file included from
/usr/home/sid/software/beignet/backend/src/./ir/unit.hpp:27:
In file included from
/usr/home/sid/software/beignet/backend/src/./ir/constant.hpp:28:
In file included from
/usr/home/sid/software/beignet/backend/src/./sys/vector.hpp:28:
In file included from
/usr/home/sid/software/beignet/backend/src/./sys/platform.hpp:26:
In file included from /usr/include/c++/v1/iostream:38:
In file included from /usr/include/c++/v1/ios:216:
In file included from /usr/include/c++/v1/__locale:15:
In file included from /usr/include/c++/v1/string:439:
In file included from /usr/include/c++/v1/algorithm:627:
/usr/include/c++/v1/memory:1568:28: error: cannot initialize a parameter of
type 'pointer' (aka
'std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char,
std::__1::char_traits<char>,
      std::__1::allocator<char> >, gbe::ir::Function *>, void *> *') with
an lvalue of type 'gbe::ir::Function **'
            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
                           ^~~
/usr/include/c++/v1/memory:1449:14: note: in instantiation of function
template specialization
'std::__1::allocator_traits<gbe::Allocator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> >,
gbe::ir::Function *>, void *> > >::__construct<gbe::ir::Function *>'
requested here
            {__construct(__has_construct<allocator_type, pointer,
_Args...>(),
             ^
/usr/include/c++/v1/tr1/unordered_map:1340:20: note: in instantiation of
function template specialization

'std::__1::allocator_traits<gbe::Allocator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function
*>, void *> >
      >::construct<gbe::ir::Function *>' requested here
    __node_traits::construct(__na,
_VSTD::addressof(__h->__value_.__cc.second));
                   ^
/usr/include/c++/v1/tr1/unordered_map:1363:25: note: in instantiation of
member function 'std::__1::unordered_map<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function
*,
      std::__1::hash<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::equal_to<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
      gbe::Allocator<std::__1::pair<const std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, gbe::ir::Function
*> > >::__construct_node_with_key' requested here
    __node_holder __h = __construct_node_with_key(__k);
                        ^
/usr/home/sid/software/beignet/backend/src/ir/unit.cpp:45:14: note: in
instantiation of member function
'std::__1::unordered_map<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >,
      gbe::ir::Function *, std::__1::hash<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>,
      std::__1::allocator<char> > >, gbe::Allocator<std::__1::pair<const
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, gbe::ir::Function *> > >::operator[]'
requested here
    functions[name] = fn;
             ^
/usr/home/sid/software/beignet/backend/src/./sys/alloc.hpp:159:35: note:
passing argument to parameter 'p' here
    INLINE void construct(pointer p, const T& t = T()) { ::new(p) T(t); }
                                  ^
1 error generated.
*** Error code 1

Stop.
make[2]: stopped in /usr/home/sid/software/beignet/build
*** Error code 1

Stop.

I hope somebody can shed some light on what the cause of this is and where
I can look to fix this! :-)

Thanks a lot!

Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141119/9eb6baf6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindLLVM.patch
Type: text/x-patch
Size: 1069 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141119/9eb6baf6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc.patch
Type: text/x-patch
Size: 854 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141119/9eb6baf6/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hash_map.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141119/9eb6baf6/attachment-0002.bin>


More information about the Beignet mailing list