Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-14 Thread Jan Vesely
On Mon, 2016-03-14 at 10:19 +0800, Chih-Wei Huang wrote:
> 2016-03-11 11:50 GMT+08:00 Jan Vesely :
> > 
> > On Fri, 2016-03-11 at 10:09 +0800, Chih-Wei Huang wrote:
> > > 
> > > cc1: some warnings being treated as errors
> > > 
> > > 
> > > But I'm still not sure whether if it should be fixed on the mesa
> > > side.
> > > 
> > > So my question is, what kind of fix do we want (i.e., acceptable
> > > by
> > > the upstream)?
> > this is the result of using llvm without AMDGPU backend. the header
> > "llvm-c/Target.h" includes "llvm/Config/Targets.def" and declares
> > functions based on backends listed there (selected at llvm build
> > time).
> > 
> > Your "llvm/Config/Targets.def" needs to include this line:
> > LLVM_TARGET(AMDGPU)
> Ah, thank you for pointed it out.
> Originally I thought adding Android.mk for AMDGPU is enough.
> I'll try to add this.
> 
> Anything else we need to do to "enable" AMDGPU backend?

Enable it in cmake configure :) (LLVM_TARGETS_TO_BUILD).
on a more serious note, I don't really know the details of llvm build
system, much less how it's done on android.

Targets.def is generated from Targets.def.in that includes
@LLVM_ENUM_TARGETS@. this macro is constructed by cmake by iterating
through the LLVM_TARGETS_TO_BUILD variable. (CMakeLists.txt:508).

Other places generate code based on configure. There are 40+ .in file
in llvm/clang so you might need to dig deeper.

regards,
Jan

> 
> > 
> > otherwise the functions are not declared.
> > probably the only patch needed on mesa side is to detect this at
> > configure time.
> Android doesn't need configure.
> What we need is to detect Android version then
> we know the llvm version it uses and what backends it has.
> The patch is already in android-x86 codebase but
> probably not submited to mesa-dev yet.
> 
> 
-- 
Jan Vesely 


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-13 Thread Chih-Wei Huang
2016-03-11 11:50 GMT+08:00 Jan Vesely :
> On Fri, 2016-03-11 at 10:09 +0800, Chih-Wei Huang wrote:
>> cc1: some warnings being treated as errors
>>
>>
>> But I'm still not sure whether if it should be fixed on the mesa
>> side.
>>
>> So my question is, what kind of fix do we want (i.e., acceptable by
>> the upstream)?
>
> this is the result of using llvm without AMDGPU backend. the header
> "llvm-c/Target.h" includes "llvm/Config/Targets.def" and declares
> functions based on backends listed there (selected at llvm build time).
>
> Your "llvm/Config/Targets.def" needs to include this line:
> LLVM_TARGET(AMDGPU)

Ah, thank you for pointed it out.
Originally I thought adding Android.mk for AMDGPU is enough.
I'll try to add this.

Anything else we need to do to "enable" AMDGPU backend?

> otherwise the functions are not declared.
> probably the only patch needed on mesa side is to detect this at
> configure time.

Android doesn't need configure.
What we need is to detect Android version then
we know the llvm version it uses and what backends it has.
The patch is already in android-x86 codebase but
probably not submited to mesa-dev yet.


-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-11 Thread Emil Velikov
Hi Chih-Wei,

On 11 March 2016 at 02:09, Chih-Wei Huang  wrote:
> 2016年3月10日 下午6:47於 "Marek Olšák" 寫道:
>>
>> Those functions are only supported by LLVM 3.7 and later, and if you
>> have such a version, the AMDGPU backend must be enabled in your LLVM
>> build.
>
> Yes, I knew that.
> But seems you misunderstood my question.
>
> It's a compile time error instead of a linking time error:
>
The answer was actually spot on. If you don't build llvm with the
amdgpu backend (iirc the r600 backend just got renamed with llvm 3.7)
you will see compilation errors as the ones you reported.

Ideally one would wire up a check for android similar to the one we
have in configure.ac. Namely:


radeon_llvm_check() {
if test ${LLVM_VERSION_INT} -lt 307; then
amdgpu_llvm_target_name='r600'
else
amdgpu_llvm_target_name='amdgpu'
fi

if test true && $LLVM_CONFIG --targets-built | grep -iqvw
$amdgpu_llvm_target_name ; then
AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in
your LLVM build.])

}



if test -n "$with_gallium_drivers"; then
gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
for driver in $gallium_drivers; do


xr600)

radeon_llvm_check "r600g"

   ;;
xradeonsi)

   radeon_llvm_check "radeonsi"



Cheers,
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-11 Thread Marek Olšák
On Fri, Mar 11, 2016 at 4:50 AM, Jan Vesely  wrote:
> On Fri, 2016-03-11 at 10:09 +0800, Chih-Wei Huang wrote:
>> 2016年3月10日 下午6:47於 "Marek Olšák" 寫道:
>> >
>> >
>> > Those functions are only supported by LLVM 3.7 and later, and if
>> > you
>> > have such a version, the AMDGPU backend must be enabled in your
>> > LLVM
>> > build.
>> Yes, I knew that.
>> But seems you misunderstood my question.
>>
>> It's a compile time error instead of a linking time error:
>>
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c: In
>> function 'init_r600_target':
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:106:2:
>> error: implicit declaration of function
>> 'LLVMInitializeAMDGPUTargetInfo'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUTargetInfo();
>>   ^
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:107:2:
>> error: implicit declaration of function 'LLVMInitializeAMDGPUTarget'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUTarget();
>>   ^
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:108:2:
>> error: implicit declaration of function
>> 'LLVMInitializeAMDGPUTargetMC'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUTargetMC();
>>   ^
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:109:2:
>> error: implicit declaration of function
>> 'LLVMInitializeAMDGPUAsmPrinter'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUAsmPrinter();
>>   ^
>>
>> cc1: some warnings being treated as errors
>>
>>
>> Some proposed patches on the mesa side:
>>
>> https://sourceforge.net/p/android-x86/external_mesa/ci/f6611f58cf89a4
>> 0e013b20180604f65707b6e73e/
>> (add a header to declare the functions)
>>
>> https://github.com/maurossi/mesa/commit/deb3a6ebb7fdba688b0331bd0e4b2
>> 7acfc9d869f
>> (disable implicit declaration warnings)
>>
>> But I'm still not sure whether if it should be fixed on the mesa
>> side.
>>
>> So my question is, what kind of fix do we want (i.e., acceptable by
>> the upstream)?
>
> this is the result of using llvm without AMDGPU backend. the header
> "llvm-c/Target.h" includes "llvm/Config/Targets.def" and declares
> functions based on backends listed there (selected at llvm build time).
>
> Your "llvm/Config/Targets.def" needs to include this line:
> LLVM_TARGET(AMDGPU)
>
> otherwise the functions are not declared.
> probably the only patch needed on mesa side is to detect this at
> configure time.

I think Mesa does detect this at configure time, but this thread is
about Android (not using configure).

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


Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-10 Thread Jan Vesely
On Fri, 2016-03-11 at 10:09 +0800, Chih-Wei Huang wrote:
> 2016年3月10日 下午6:47於 "Marek Olšák" 寫道:
> > 
> > 
> > Those functions are only supported by LLVM 3.7 and later, and if
> > you
> > have such a version, the AMDGPU backend must be enabled in your
> > LLVM
> > build.
> Yes, I knew that.
> But seems you misunderstood my question.
> 
> It's a compile time error instead of a linking time error:
> 
> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c: In
> function 'init_r600_target':
> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:106:2:
> error: implicit declaration of function
> 'LLVMInitializeAMDGPUTargetInfo'
> [-Werror=implicit-function-declaration]
>   LLVMInitializeAMDGPUTargetInfo();
>   ^
> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:107:2:
> error: implicit declaration of function 'LLVMInitializeAMDGPUTarget'
> [-Werror=implicit-function-declaration]
>   LLVMInitializeAMDGPUTarget();
>   ^
> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:108:2:
> error: implicit declaration of function
> 'LLVMInitializeAMDGPUTargetMC'
> [-Werror=implicit-function-declaration]
>   LLVMInitializeAMDGPUTargetMC();
>   ^
> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:109:2:
> error: implicit declaration of function
> 'LLVMInitializeAMDGPUAsmPrinter'
> [-Werror=implicit-function-declaration]
>   LLVMInitializeAMDGPUAsmPrinter();
>   ^
> 
> cc1: some warnings being treated as errors
> 
> 
> Some proposed patches on the mesa side:
> 
> https://sourceforge.net/p/android-x86/external_mesa/ci/f6611f58cf89a4
> 0e013b20180604f65707b6e73e/
> (add a header to declare the functions)
> 
> https://github.com/maurossi/mesa/commit/deb3a6ebb7fdba688b0331bd0e4b2
> 7acfc9d869f
> (disable implicit declaration warnings)
> 
> But I'm still not sure whether if it should be fixed on the mesa
> side.
> 
> So my question is, what kind of fix do we want (i.e., acceptable by
> the upstream)?

this is the result of using llvm without AMDGPU backend. the header
"llvm-c/Target.h" includes "llvm/Config/Targets.def" and declares
functions based on backends listed there (selected at llvm build time).

Your "llvm/Config/Targets.def" needs to include this line:
LLVM_TARGET(AMDGPU)

otherwise the functions are not declared.
probably the only patch needed on mesa side is to detect this at
configure time.

regards,
Jan


> 
> > 
> > On Thu, Mar 10, 2016 at 10:04 AM, Chih-Wei Huang
> >  wrote:
> > > 
> > > Hi devs,
> > > On building 64-bit Android-x86 mesa with amdgpu support,
> > > we got some errors about the symbols LLVMInitializeAMDGPU*
> > > are not defined. (missing prototypes)
> > > 
> > > It's easy to fix the errors by adding the definition of
> > > the function prototypes.
> > > However, I'm curious in which side it should be fixed?
> > > The mesa or llvm?
> > > 
> > > Does the llvm forgot to provide a header for these functions?
> > > Or the functions are internal APIs of llvm that should not be
> > > used
> > > by mesa directly?
> > > 
> > > Any comment?
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-10 Thread Chih-Wei Huang
2016年3月10日 下午6:47於 "Marek Olšák" 寫道:
>
> Those functions are only supported by LLVM 3.7 and later, and if you
> have such a version, the AMDGPU backend must be enabled in your LLVM
> build.

Yes, I knew that.
But seems you misunderstood my question.

It's a compile time error instead of a linking time error:

external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c: In
function 'init_r600_target':
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:106:2:
error: implicit declaration of function
'LLVMInitializeAMDGPUTargetInfo'
[-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUTargetInfo();
  ^
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:107:2:
error: implicit declaration of function 'LLVMInitializeAMDGPUTarget'
[-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUTarget();
  ^
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:108:2:
error: implicit declaration of function 'LLVMInitializeAMDGPUTargetMC'
[-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUTargetMC();
  ^
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:109:2:
error: implicit declaration of function
'LLVMInitializeAMDGPUAsmPrinter'
[-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUAsmPrinter();
  ^

cc1: some warnings being treated as errors


Some proposed patches on the mesa side:

https://sourceforge.net/p/android-x86/external_mesa/ci/f6611f58cf89a40e013b20180604f65707b6e73e/
(add a header to declare the functions)

https://github.com/maurossi/mesa/commit/deb3a6ebb7fdba688b0331bd0e4b27acfc9d869f
(disable implicit declaration warnings)

But I'm still not sure whether if it should be fixed on the mesa side.

So my question is, what kind of fix do we want (i.e., acceptable by
the upstream)?

> On Thu, Mar 10, 2016 at 10:04 AM, Chih-Wei Huang
>  wrote:
> > Hi devs,
> > On building 64-bit Android-x86 mesa with amdgpu support,
> > we got some errors about the symbols LLVMInitializeAMDGPU*
> > are not defined. (missing prototypes)
> >
> > It's easy to fix the errors by adding the definition of
> > the function prototypes.
> > However, I'm curious in which side it should be fixed?
> > The mesa or llvm?
> >
> > Does the llvm forgot to provide a header for these functions?
> > Or the functions are internal APIs of llvm that should not be used
> > by mesa directly?
> >
> > Any comment?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-10 Thread Marek Olšák
Those functions are only supported by LLVM 3.7 and later, and if you
have such a version, the AMDGPU backend must be enabled in your LLVM
build.

Marek

On Thu, Mar 10, 2016 at 10:04 AM, Chih-Wei Huang
 wrote:
> Hi devs,
> On building 64-bit Android-x86 mesa with amdgpu support,
> we got some errors about the symbols LLVMInitializeAMDGPU*
> are not defined. (missing prototypes)
>
> It's easy to fix the errors by adding the definition of
> the function prototypes.
> However, I'm curious in which side it should be fixed?
> The mesa or llvm?
>
> Does the llvm forgot to provide a header for these functions?
> Or the functions are internal APIs of llvm that should not be used
> by mesa directly?
>
> Any comment?
>
>
> --
> Chih-Wei
> Android-x86 project
> http://www.android-x86.org
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] LLVMInitializeAMDGPU* undefined?

2016-03-10 Thread Chih-Wei Huang
Hi devs,
On building 64-bit Android-x86 mesa with amdgpu support,
we got some errors about the symbols LLVMInitializeAMDGPU*
are not defined. (missing prototypes)

It's easy to fix the errors by adding the definition of
the function prototypes.
However, I'm curious in which side it should be fixed?
The mesa or llvm?

Does the llvm forgot to provide a header for these functions?
Or the functions are internal APIs of llvm that should not be used
by mesa directly?

Any comment?


-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev