Quoting Jan Vesely (2018-01-05 14:16:41)
> Hi,
> 
> 
> sorry for the delay. I was mostly traveling during the holidays.

No worries, I was also away over the holidays and didn't look at this until
today.

> 
> On Fri, 2017-12-15 at 10:54 -0800, Dylan Baker wrote:
> > This has only been compile tested.
> > 
> > v2: - Have a single option for opencl (Eric E)
> >     - fix typo "tgis" -> "tgsi" (Curro)
> >     - Don't add "lib" to pipe loader libraries, which matches the
> >       autotools behavior
> > v3: - Remove trailing whitespace
> >     - Make PIPE_SEARCH_DIR an absolute path
> > 
> > cc: Curro Jerez <curroje...@riseup.net>
> > cc: Jan Vesely <jan.ves...@rutgers.edu>
> > cc: Aaron Watry <awa...@gmail.com>
> > Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> > ---
> >  include/meson.build                           |  19 ++++
> >  meson.build                                   |  29 +++++-
> >  meson_options.txt                             |   7 ++
> >  src/gallium/auxiliary/pipe-loader/meson.build |   3 +-
> >  src/gallium/meson.build                       |  12 ++-
> >  src/gallium/state_trackers/clover/meson.build | 122 
> > ++++++++++++++++++++++++++
> >  src/gallium/targets/opencl/meson.build        |  73 +++++++++++++++
> >  src/gallium/targets/pipe-loader/meson.build   |  77 ++++++++++++++++
> >  8 files changed, 336 insertions(+), 6 deletions(-)
> >  create mode 100644 src/gallium/state_trackers/clover/meson.build
> >  create mode 100644 src/gallium/targets/opencl/meson.build
> >  create mode 100644 src/gallium/targets/pipe-loader/meson.build
> > 
> > diff --git a/include/meson.build b/include/meson.build
> > index e4dae91cede..a2e7ce6580e 100644
> > --- a/include/meson.build
> > +++ b/include/meson.build
> > @@ -78,3 +78,22 @@ if with_gallium_st_nine
> >      subdir : 'd3dadapter',
> >    )
> >  endif
> > +
> > +# Only install the headers if we are building a stand alone implementation 
> > and
> > +# not an ICD enabled implementation
> > +if with_gallium_opencl and not with_opencl_icd
> > +  install_headers(
> > +    'CL/cl.h',
> > +    'CL/cl.hpp',
> > +    'CL/cl_d3d10.h',
> > +    'CL/cl_d3d11.h',
> > +    'CL/cl_dx9_media_sharing.h',
> > +    'CL/cl_egl.h',
> > +    'CL/cl_ext.h',
> > +    'CL/cl_gl.h',
> > +    'CL/cl_gl_ext.h',
> > +    'CL/cl_platform.h',
> > +    'CL/opencl.h',
> > +    subdir: 'CL'
> > +  )
> > +endif
> > diff --git a/meson.build b/meson.build
> > index 842d441199e..74b2d5c49dc 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -583,6 +583,22 @@ if with_gallium_st_nine
> >    endif
> >  endif
> >  
> > +_opencl = get_option('gallium-opencl')
> > +if _opencl !=' disabled'
> > +  if not with_gallium
> > +    error('OpenCL Clover implementation requires at least one gallium 
> > driver.')
> > +  endif
> > +
> > +  # TODO: alitvec?
> > +  dep_clc = dependency('libclc')
> > +  with_gallium_opencl = true
> > +  with_opencl_icd = _opencl == 'icd'
> > +else
> > +  dep_clc = []
> > +  with_gallium_opencl = false
> > +  with_gallium_icd = false
> > +endif
> > +
> >  gl_pkgconfig_c_flags = []
> >  if with_platform_x11
> >    if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
> > @@ -930,7 +946,7 @@ dep_thread = dependency('threads')
> >  if dep_thread.found() and host_machine.system() != 'windows'
> >    pre_args += '-DHAVE_PTHREAD'
> >  endif
> > -if with_amd_vk or with_gallium_radeonsi or with_gallium_r600 # TODO: clover
> > +if with_amd_vk or with_gallium_radeonsi or with_gallium_r600 or 
> > with_gallium_opencl
> >    dep_elf = dependency('libelf', required : false)
> >    if not dep_elf.found()
> >      dep_elf = cc.find_library('elf')
> > @@ -972,12 +988,19 @@ if with_amd_vk or with_gallium_radeonsi or 
> > with_gallium_r600
> >      llvm_modules += 'asmparser'
> >    endif
> >  endif
> > +if with_gallium_opencl
> > +  llvm_modules += [
> > +    'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 
> > 'irreader',
> > +    'lto', 'option', 'objcarcopts', 'profiledata',
> > +  ]
> > +  # TODO: optional modules
> > +endif
> >  
> >  _llvm = get_option('llvm')
> >  if _llvm == 'auto'
> >    dep_llvm = dependency(
> >      'llvm', version : '>= 3.9.0', modules : llvm_modules,
> > -    required : with_amd_vk or with_gallium_radeonsi or with_gallium_swr,
> > +    required : with_amd_vk or with_gallium_radeonsi or with_gallium_swr or 
> > with_gallium_opencl,
> >    )
> >    with_llvm = dep_llvm.found()
> >  elif _llvm == 'true'
> > @@ -1154,8 +1177,6 @@ else
> >    dep_lmsensors = []
> >  endif
> >  
> > -# TODO: clover
> > -
> >  # TODO: gallium tests
> >  
> >  # TODO: various libdirs
> > diff --git a/meson_options.txt b/meson_options.txt
> > index 4f4db5b7d26..894378985fd 100644
> > --- a/meson_options.txt
> > +++ b/meson_options.txt
> > @@ -120,6 +120,13 @@ option(
> >    value : false,
> >    description : 'build gallium "nine" Direct3D 9.x state tracker.',
> >  )
> > +option(
> > +  'gallium-opencl',
> > +  type : 'combo',
> > +  choices : ['icd', 'standalone', 'disabled'],
> > +  value : 'disabled',
> > +  description : 'build gallium "clover" OpenCL state tracker.',
> > +)
> >  option(
> >    'd3d-drivers-path',
> >    type : 'string',
> > diff --git a/src/gallium/auxiliary/pipe-loader/meson.build 
> > b/src/gallium/auxiliary/pipe-loader/meson.build
> > index 9b12432aea0..869a2935149 100644
> > --- a/src/gallium/auxiliary/pipe-loader/meson.build
> > +++ b/src/gallium/auxiliary/pipe-loader/meson.build
> > @@ -60,7 +60,8 @@ libpipe_loader_dynamic = static_library(
> >    ],
> >    c_args : [
> >      c_vis_args, libpipe_loader_defines, '-DHAVE_PIPE_LOADER_DRI',
> > -    '-DPIPE_SEARCH_DIR="@0@"'.format(join_paths(get_option('libdir'), 
> > 'gallium-pipe')
> > +    '-DPIPE_SEARCH_DIR="@0@"'.format(
> > +      join_paths(get_option('prefix'), get_option('libdir'), 
> > 'gallium-pipe')
> >      )
> >    ],
> >    link_with : [libloader, libxmlconfig],
> > diff --git a/src/gallium/meson.build b/src/gallium/meson.build
> > index fc21dcf03e1..6330c7514af 100644
> > --- a/src/gallium/meson.build
> > +++ b/src/gallium/meson.build
> > @@ -145,7 +145,17 @@ endif
> >  if with_gallium_st_nine
> >    subdir('state_trackers/nine')
> >  endif
> > -# TODO: clover
> > +if with_gallium_opencl
> > +  # TODO: this isn't really clover specific, but ATM clover is the only
> > +  # consumer
> > +  subdir('targets/pipe-loader')
> > +
> > +  if meson.version().version_compare('< 0.44.0')
> > +    error('OpenCL requires meson 0.44.0 or greater.')
> > +  endif
> > +  subdir('state_trackers/clover')
> > +  subdir('targets/opencl')
> > +endif
> >  if with_dri
> >    subdir('state_trackers/dri')
> >    subdir('targets/dri')
> > diff --git a/src/gallium/state_trackers/clover/meson.build 
> > b/src/gallium/state_trackers/clover/meson.build
> > new file mode 100644
> > index 00000000000..accc090d31f
> > --- /dev/null
> > +++ b/src/gallium/state_trackers/clover/meson.build
> > @@ -0,0 +1,122 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a 
> > copy
> > +# of this software and associated documentation files (the "Software"), to 
> > deal
> > +# in the Software without restriction, including without limitation the 
> > rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included 
> > in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> > OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
> > THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> > FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
> > IN THE
> > +# SOFTWARE.
> > +
> > +clover_cpp_args = []
> > +clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux]
> > +
> > +if with_opencl_icd
> > +  clover_cpp_args += '-DHAVE_CLOVER_ICD'
> > +endif
> > +
> > +libcltgsi = static_library(
> > +  'cltgsi',
> > +  files('tgsi/compiler.cpp', 'tgsi/invocation.hpp'),
> > +  include_directories : clover_incs,
> > +  cpp_args : [cpp_vis_args],
> > +)
> > +
> > +libclllvm = static_library(
> > +  'clllvm',
> > +  files(
> > +    'llvm/codegen/bitcode.cpp',
> > +    'llvm/codegen/common.cpp',
> > +    'llvm/codegen/native.cpp',
> > +    'llvm/codegen.hpp',
> > +    'llvm/compat.hpp',
> > +    'llvm/invocation.cpp',
> > +    'llvm/invocation.hpp',
> > +    'llvm/metadata.hpp',
> > +    'llvm/util.hpp',
> > +  ),
> > +  include_directories : clover_incs,
> > +  cpp_args : [
> > +    cpp_vis_args,
> > +    
> > '-DLIBCLC_INCLUDEDIR="@0@"'.format(dep_clc.get_pkgconfig_variable('includedir')),
> > +    
> > '-DLIBCLC_LIBEXECDIR="@0@"'.format(dep_clc.get_pkgconfig_variable('libexecdir')),
> 
> The above directories need to have '/' appended otherwise loading of
> libclc fails:
> fatal error: cannot open file '/home/vesely/.local/lib/clcturks-r600
> --.bc': No such file or directory
> 
> for some reason the fedora libclc package libexecdir ends with '/'
> while the upstream does not. Other packages that I checked also 
> providevariables without the last slash. 
> clover/Makefile.am:47/48 appends '/' for autotools build.
> 
> After fixing these I can run clinfo and a simple piglit using meson
> build clover.
> so with those fixed:
> Tested-by: Jan Vesely <jan.ves...@rutgers.edu>
> 
> remaining differences from autotools:
> libdir is $prefix/lib64 instead of $prefix/lib, it might be just my old
> autotools configuration.
> as mentioned before, llvm-config $PATH and PKG_CONFIG_PATH need to be
> set on every invocation, meson now at least warns when PKG_CONFIG_PATH
> is different.

That is a meson issue, I'm sorta the defacto meson llvm guy (I wrote the code
and I seem to get all of the bug reports, lol) so if adding support for directly
passing the path to llvm-config is okay with the maintainers I'll add support.
So, please file a bug about the llvm-config :)

Dylan

> 
> thanks,
> Jan
> 

Attachment: signature.asc
Description: signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to