Re: llvm calling convention matters

2013-09-20 Thread John Lato
I think Geoffrey's suggestion is workable, but I wouldn't like it so much. The difficulty is that if you aren't aware of it, it's possible to build up a large system that you discover is unworkable the first time you try to compile it. In that sense it's not too different from Template Haskell

Re: llvm calling convention matters

2013-09-19 Thread Geoffrey Mainland
If you pass a constant, unboxed value to a primop, I assume GHC won't ever bind the argument to a value. So although we have no way to enforce static const argument in the type system, if this is a valuable (and experts-only?) operation, I'm not sure it matters that much if the user gets an error

Re: llvm calling convention matters

2013-09-18 Thread Simon Marlow
This is slightly problematic. What if we have a wonderful SIMD-enabled vector library that we compile with -fllvm, and then use it in a program that isn't compiled with -fllvm, and some of the wonderful SIMD-enabled functions get inlined? Presumably we get a panic in the NCG. Did we discuss

Re: llvm calling convention matters

2013-09-18 Thread Geoffrey Mainland
We did discuss this, but you may not have been present. If LLVM-only primops show up in a non-LLVM codegen, a sorry error is reported telling the user that they need to compile with -fllvm. Yes, this is not a fantastic solution. Options I see: 1) Live with the error message. 2) Remove all SIMD

Re: llvm calling convention matters

2013-09-18 Thread Simon Marlow
On 18/09/13 20:01, Geoffrey Mainland wrote: We did discuss this, but you may not have been present. If LLVM-only primops show up in a non-LLVM codegen, a sorry error is reported telling the user that they need to compile with -fllvm. Yes, this is not a fantastic solution. Options I see: 1)

Re: llvm calling convention matters

2013-09-18 Thread Carter Schonwald
I've some thoughts on how to have a better solution, but they are feasible only on a time scale suitable for 7.10, and not for 7.8. a hacky solution we could do for 7.8 perhaps is have a warning that works as follows: either a) throw a warning on functions that use the SIMD primops, if that

Re: llvm calling convention matters

2013-09-18 Thread Geoffrey Mainland
On 09/18/2013 04:49 PM, Carter Schonwald wrote: I've some thoughts on how to have a better solution, but they are feasible only on a time scale suitable for 7.10, and not for 7.8. a hacky solution we could do for 7.8 perhaps is have a warning that works as follows: either a) throw a

Re: llvm calling convention matters

2013-09-18 Thread Carter Schonwald
yup, i hit a gap in what we can currently express in haskell types. We don't have a way of expressing static data! I actually put ticket on trac noting this. http://ghc.haskell.org/trac/ghc/ticket/8107 (note that when i was initially writing the ticket, i incorrectly thought the int# arg to ghc's

Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
Geoff, a prosaic reason why there *might* be a fundamentally breaking change would be the following idea nathan howell suggested to me this afternoon: change the Sp and SPLim register so that the X86/x86_64 target can use the CPU's Push and (maybe) Pop instructions for the stack manipulations,

Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
that said it does occur to me that there is an alternative solution that may be acceptable for everyone! what about providing a pseudo compatible way called -fllvm-experimentalAVX (or something), and simply require that for it to be used, the user has an llvm Patched with the YMM simd in register

possible solution! Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
to repeat: I think no one would have object to having a clearly marked, experimental -fllvmExpermentalAVX flag that requires building LLVM with a specified patch, as a way to showcase your multivector work! that would evade all of my objections (provided avx is still exposed with normal -fllvm,

Re: possible solution! Re: llvm calling convention matters

2013-09-12 Thread Geoffrey Mainland
If users have to do a custom llvm build, we might as well ask them to build ghc from source too. Unless I misunderstood ticket #8033, you were originally quite gung-ho about changing the LLVM calling conventions to support passing SIMD vectors of all widths in registers on both x86-32 and -64,

Re: possible solution! Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
emphasis on very very clear warning On Thu, Sep 12, 2013 at 3:00 PM, Carter Schonwald carter.schonw...@gmail.com wrote: after a bit more reflection: as long as we provide a clear warning that 7.8 may at some point no longer work with llvm 3.4, i'm down for the change. We just need to make

Re: possible solution! Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
oh, i didn't realize you had already done the work! (bah, i'm sorry, i feel terrible) I thought i had communicated ~ a month ago that I was worried about release engineering interaction with making it impossible to then make a subsequent changes more thoughtfully because of the LLVM release

Re: possible solution! Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
after a bit more reflection: as long as we provide a clear warning that 7.8 may at some point no longer work with llvm 3.4, i'm down for the change. We just need to make it very very clear, that it may stop working. (and have AVX support via passing on the stack with = 3.3) before i go and

Re: possible solution! Re: llvm calling convention matters

2013-09-12 Thread Carter Schonwald
let me know before the weekend starts so i can make time to help if need be (unless Austin gives breathing room on merge window for such a thing) On Thu, Sep 12, 2013 at 3:03 PM, Carter Schonwald carter.schonw...@gmail.com wrote: emphasis on very very clear warning On Thu, Sep 12, 2013

Re: possible solution! Re: llvm calling convention matters

2013-09-12 Thread Geoffrey Mainland
The plan is as I wrote below: 7.8 will only support passing 128-bit SIMD vectors in registers on x86-64. Other vectors sizes, and all vectors on x86-32, will be passed on the stack. There is not enough time for anything else at his point. Geoff On 09/12/2013 10:40 PM, Carter Schonwald

Re: llvm calling convention matters

2013-09-11 Thread Carter Schonwald
hey all, first let me preface by saying I am in favor of breaking and updating/modernizing the GHC ABI. I just think that for a number of reasons, it doesn't make sense to do it for the 7.8 release, but rather start work on it in another month or so, so we can systematically have a better set of

Re: llvm calling convention matters

2013-09-11 Thread Geoffrey Mainland
Can you provide an example of the kind of ABI change you might want for 7.10? Is it mainly using more registers to pass arguments? We're already using 6 *mm* registers to pass arguments on x86_64. I don't know for sure, but I would be very surprised if there is code out there that would benefit

Re: llvm calling convention matters

2013-09-11 Thread Johan Tibell
On Wed, Sep 11, 2013 at 3:59 PM, Geoffrey Mainland mainl...@apeiron.netwrote: I don't see why we should limit ourselves by insisting that the gap between what the LLVM back-end and the native back-end not grow further. If we want SIMD, the gap is already quite large. Yes it would be nice to

Re: llvm calling convention matters

2013-09-11 Thread Geoffrey Mainland
On 09/11/2013 07:33 PM, Johan Tibell wrote: On Wed, Sep 11, 2013 at 3:59 PM, Geoffrey Mainland mainl...@apeiron.net wrote: I don't see why we should limit ourselves by insisting that the gap between what the LLVM back-end and the native back-end not grow further. If we want

Re: llvm calling convention matters

2013-09-11 Thread Johan Tibell
On Wed, Sep 11, 2013 at 4:40 PM, Geoffrey Mainland mainl...@apeiron.netwrote: Do you mean we need a reasonable emulation of the SIMD primops for the native codegen? Yes. Reasonable in the sense that it computes the right result. I can see that some code might still want to #ifdef (if the

Re: llvm calling convention matters

2013-09-11 Thread Geoffrey Mainland
We support compiling some code with -fllvm and some not in the same executable. Otherwise how could users of the Haskell Platform link their -fllvm-compiled code with native-codegen-compiled libraries like base, etc.? In other words, the LLVM and native back ends use the same calling convention.