I tried --enable-llvmapi. I get this error when running the test suite:

+WARNING: Linking two modules of different target triples: 
/Users/eschnett/src/pocl-build-3.3/lib/kernel/host/kernel-x86_64-apple-darwin13.0.0.bc:
 'x86_64-apple-macosx10.9.0' and 'x86_64-apple-darwin13.0.0'

This means that the target architecture and CPU is not set correctly in all 
cases.

What is missing here is to "normalize" the target triple, as described in 
configure.ac:

# Normalise the triple. Otherwise, clang normalises it when
# passing it to llc, which is then different from the triple we
# pass to llc. This would lead to inconsistent bytecode files,
# depending on whether they are generated via clang or directly
# via llc.

That is, clang (front-end) and llvm (middle-end) use different names for the 
same target. (Don't ask why.) We need to pass the target name to clang, and ask 
it what (possibly) different target name it passes to llvm. That is the target 
name we need to use.

In configure.ac, this is done by taking $host and calculating $llc_triple from 
it, which is the one that should then be used as target triple when calling 
clang or llvm.

-erik

On Nov 21, 2013, at 3:27 , Pekka Jääskeläinen <[email protected]> wrote:

> On 11/21/2013 12:01 PM, Kalle Raiskila wrote:
>> Just a quick question (haven't read the source yet), how is the
>> fine-tuning of the codegen, i.e. march/mcpu/mtune options, handled now
>> in the API mode?
> 
> GetTargetMachine (borrowed from opt) handles the TargetMachine creation
> for the WG compilation phase (call_pocl_workgroup()).
> 
> The call_pobl_build() uses the cmdline parsing (so we
> can push also the user-defined options to it directly):
> 
>   ss << "-triple=" << device->llvm_target_triplet << " ";
>   if (device->llvm_cpu != NULL)
>     ss << "-target-cpu " << device->llvm_cpu << " ";
>   ss << user_options << " ";
> 
> those flags set up some machine defaults.
> 
> Later on it also sets processor info to TargetOptions:
> 
>  clang::TargetOptions &ta = pocl_build.getTargetOpts();
>   ta.Triple = device->llvm_target_triplet;
>   if (device->llvm_cpu != NULL)
>     ta.CPU = device->llvm_cpu;
> 
> The latter part might be redundant now, but I left it there so
> the places it can be changed are clearly visible and tweakable,
> predicting you might get some pains at least with getting
> ARM working.
> 
> -- 
> Pekka
> 
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing 
> conversations that shape the rapidly evolving mobile landscape. Sign up now. 
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> pocl-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pocl-devel

-- 
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu/.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to