[Mesa-dev] [PATCH 5/5] clover: Dynamically calculate __OPENCL_VERSION__ and CLC language version

Aaron Watry awatry at gmail.com
Wed Mar 21 19:52:37 UTC 2018


On Wed, Mar 21, 2018 at 2:37 PM, Mark Janes <mark.a.janes at intel.com> wrote:
> Aaron, this patch breaks the meson build-test in our CI:
>
>  ../src/gallium/state_trackers/clover/llvm/invocation.cpp:88:36: error: ‘lang_opencl10’ is not a member of ‘clang::LangStandard’
>          { 100, clang::LangStandard::lang_opencl10},
>
> configured with:
>
> meson -Dbuild-tests=true -Dgallium-drivers=r300,r600,radeonsi,nouveau,swrast,swr,freedreno,vc4,pl111,etnaviv,imx,svga,virgl -Dgallium-vdpau=true -Dgallium-xvmc=true -Dgallium-xa=true -Dgallium-va=true -Dgallium-nine=true -Dgallium-opencl=standalone -Dgallium-omx=bellagio

I've seen issues with building clover in the past when an incomplete
set of clang headers is installed. This happens to be the case with at
least Ubuntu's stock packaged clang. I'm not really sure what your CI
system is running, but I did just verify that I was able to build my
full mesa stack in meson with the following build configuration (what
my normal build script uses when I tell it to use its meson path):

CXXFLAGS=' -O2' CFLAGS=' -O2 -march=native' LD='ld.gold' LDFLAGS=''
CC='gcc' CXX='g++' meson --prefix /usr/local -D dri-drivers=
--sysconfdir /etc --libdir /usr/local/lib --buildtype release
--buildtype release -D gallium-opencl=icd -D gles1=true -D gles2=true
-D texture-float=true -D gallium-va=true -D gallium-xvmc=false -D
build-tests=true -D gallium-drivers=radeonsi,r600,swrast -D
vulkan-drivers=radeon ../

That being said, I'm building against an llvm/clang 7.0 build
installed in /usr/local which meson picks up in preference to the
system headers.

--Aaron

>
> Pierre Moreau <pierre.morrow at free.fr> writes:
>
>> Oops, sorry.
>>
>> Reviewed-by: Pierre Moreau <pierre.morrow at free.fr>
>>
>> Thanks again for the series!
>> Pierre
>>
>> On 2018-03-20 — 20:23, Aaron Watry wrote:
>>> ping.
>>>
>>> This is the last of the series that still needs review.
>>>
>>> --Aaron
>>>
>>> On Thu, Mar 1, 2018 at 1:39 PM, Aaron Watry <awatry at gmail.com> wrote:
>>> > Use get_language_version to calculate default cl standard based on
>>> > device capabilities and -cl-std specified in build options.
>>> >
>>> > v4: Squash the __OPENCL_VERSION__ and CLC language version patches
>>> > v3: (Jan) Allow device_version up to 2.2 while device_clc_version
>>> >     only goes to 2.0
>>> >     Use get_cl_version to calculate version instead
>>> > v2: Split out from the previous patch (Pierre)
>>> >
>>> > Signed-off-by: Aaron Watry <awatry at gmail.com>
>>> > CC: Pierre Moreau <pierre.morrow at free.fr>
>>> > CC: Jan Vesely <jan.vesely at rutgers.edu>
>>> > ---
>>> >  src/gallium/state_trackers/clover/llvm/invocation.cpp | 6 ++++--
>>> >  1 file changed, 4 insertions(+), 2 deletions(-)
>>> >
>>> > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
>>> > index 8d76f203de..f146695585 100644
>>> > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
>>> > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
>>> > @@ -194,7 +194,7 @@ namespace {
>>> >        compat::set_lang_defaults(c->getInvocation(), c->getLangOpts(),
>>> >                                  compat::ik_opencl, ::llvm::Triple(target.triple),
>>> >                                  c->getPreprocessorOpts(),
>>> > -                                clang::LangStandard::lang_opencl11);
>>> > +                                get_language_version(opts, device_clc_version));
>>> >
>>> >        c->createDiagnostics(new clang::TextDiagnosticPrinter(
>>> >                                *new raw_string_ostream(r_log),
>>> > @@ -225,7 +225,9 @@ namespace {
>>> >        c.getPreprocessorOpts().Includes.push_back("clc/clc.h");
>>> >
>>> >        // Add definition for the OpenCL version
>>> > -      c.getPreprocessorOpts().addMacroDef("__OPENCL_VERSION__=110");
>>> > +      c.getPreprocessorOpts().addMacroDef("__OPENCL_VERSION__=" +
>>> > +              std::to_string(get_cl_version(
>>> > +                                  dev.device_version()).version_number));
>>> >
>>> >        // clc.h requires that this macro be defined:
>>> >        c.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");
>>> > --
>>> > 2.14.1
>>> >
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list