[Mesa-dev] Building error in android-x86

Mauro Rossi issor.oruam at gmail.com
Sat May 6 14:16:30 UTC 2017


2017-05-06 12:15 GMT+02:00 Marek Olšák <maraeo at gmail.com>:
>
> Hi,
>
> There are several options:
> - Use Mesa 17.1 instead of master
> - Drop support for radeonsi in Nougat if you have to use master
> - Revert the commit removing LLVM 3.8 support, resolve merge conflicts, and send it for review.
>
> I'd be OK with any but I recommend the first one.
>
> Marek


Thanks, I'd like to be able to test android build of radeonsi,
even by just keeping an HACK in my private repo/branches

May I just ask what is the risk in doing the following in our builds?


>From addb5cd258f849cd3ce78384623c96d2c027682d Mon Sep 17 00:00:00 2001
From: Mauro Rossi <issor.oruam at gmail.com>
Date: Sat, 6 May 2017 14:40:59 +0200
Subject: [!!!!HACK!!!!] HACK: radeonsi: workaround to llvm 3.9 constraints

Just to avoid the followinf building errors:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:4274:10:
error: incompatible integer to pointer conversion assigning to 'LLVMValueRef'
(aka 'struct LLVMOpaqueValue *') from 'int' [-Werror,-Wint-conversion]
                result = LLVMBuildAtomicCmpXchg(builder, ptr, arg, new_data,
                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:1223:20:
error: incompatible integer to pointer conversion initializing
'LLVMTargetDataRef'
(aka 'struct LLVMOpaqueTargetData *') with an expression of type 'int'
[-Werror,-Wint-conversion]
        LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
                          ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 src/gallium/drivers/radeonsi/si_shader.c            | 4 ++--
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c
b/src/gallium/drivers/radeonsi/si_shader.c
index cf4b83b9e7..7c2c8fee0a 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4270,12 +4270,12 @@ static void atomic_emit_memory(struct
si_shader_context *ctx,
                                        inst, 3, 0);

         new_data = LLVMBuildBitCast(builder, new_data, ctx->i32, "");
-
+#if HAVE_LLVM >= 0x0309
         result = LLVMBuildAtomicCmpXchg(builder, ptr, arg, new_data,
                                LLVMAtomicOrderingSequentiallyConsistent,
                                LLVMAtomicOrderingSequentiallyConsistent,
                                false);
-
+#endif
         result = LLVMBuildExtractValue(builder, result, 0, "");
     } else {
         LLVMAtomicRMWBinOp op;
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index f717299e78..c000f513dc 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -1219,13 +1219,13 @@ void si_llvm_context_init(struct si_shader_context *ctx,
     ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi",
                         ctx->gallivm.context);
     LLVMSetTarget(ctx->gallivm.module, "amdgcn--");
-
+#if HAVE_LLVM >= 0x0309
     LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
     char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
     LLVMSetDataLayout(ctx->gallivm.module, data_layout_str);
     LLVMDisposeTargetData(data_layout);
     LLVMDisposeMessage(data_layout_str);
-
+#endif
     bool unsafe_fpmath = (sscreen->b.debug_flags & DBG_UNSAFE_MATH) != 0;
     enum lp_float_mode float_mode =
         unsafe_fpmath ? LP_FLOAT_MODE_UNSAFE_FP_MATH :
-- 
2.11.0

>
>
>
> On May 6, 2017 11:39 AM, "Mauro Rossi" <issor.oruam at gmail.com> wrote:
>
> Hi,
>
> mesa-dev is about to be polished for marshmallow, nougat and O
> and radeonsi was working on both marshmallow-x86 and nougat-x86
>
> Now I see that llvm 3.8 is considered dropped,
> but commit "radeonsi: drop support for LLVM 3.8"
> does not mention that nougat is gone.
>
> Is there a chance that we can try to build even with llvm 3.8 if not all features supported?
>
> Are your really sure that there was no way to keep at least the possibility to build nougat-x86, support,considering that it is the current maintenance release of android?
>
> Thanks for informations
>
> Mauro
>
> external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:1223:34: warning: implicit declaration of function 'LLVMCreateTargetDataLayout' is invalid in C99 [-Wimplicit-function-declaration]
>         LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
>                                         ^
> external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:1223:20: error: incompatible integer to pointer conversion initializing 'LLVMTargetDataRef' (aka 'struct LLVMOpaqueTargetData *') with an expression of type 'int' [-Werror,-Wint-conversion]
>         LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
>                           ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning and 1 error generated.
> [ 12% 548/4306] target  C: libmesa_pipe_radeonsi_32 <= external/mesa/src/gallium/drivers/radeonsi/si_descriptors.c
> ninja: build stopped: subcommand failed.
> build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
> make: *** [ninja_wrapper] Error 1
>
> #### make failed to build some targets (03:45 (mm:ss)) ####
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>

BTW applying the !!!HACK!!! even if it may not work because we lack llvm 3.9,
I found another building error, probably due to picky compiler/cflags,
please would you like to check the following RFC?
Thanks

>From 2ac8fbbecb44ac92d6400d354fdfb34a953ad08c Mon Sep 17 00:00:00 2001
From: Mauro Rossi <issor.oruam at gmail.com>
Date: Sat, 6 May 2017 15:01:36 +0200
Subject: [RFC] radeonsi: fix building error in performance counters

Fixes the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_perfcounter.c:617:14:
error: address of array 'regs->counters' will always evaluate to
'true' [-Werror,-Wpointer-bool-conversion]
                        if (regs->counters)
                        ~~  ~~~~~~^~~~~~~~
1 error generated.
---
 src/gallium/drivers/radeonsi/si_perfcounter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_perfcounter.c
b/src/gallium/drivers/radeonsi/si_perfcounter.c
index fd28d1176e..322e8d4728 100644
--- a/src/gallium/drivers/radeonsi/si_perfcounter.c
+++ b/src/gallium/drivers/radeonsi/si_perfcounter.c
@@ -614,7 +614,7 @@ static void si_pc_emit_read(struct r600_common_context *ctx,
             reg_delta = -reg_delta;

         for (idx = 0; idx < count; ++idx) {
-            if (regs->counters)
+            if (regs->counters[idx])
                 reg = regs->counters[idx];

             radeon_emit(cs, PKT3(PKT3_COPY_DATA, 4, 0));
-- 
2.11.0


More information about the mesa-dev mailing list