<div class="gmail_quote">On Sat, Jul 7, 2012 at 8:35 PM, Dmitry N. Mikushin <span dir="ltr"><<a href="mailto:maemarcus@gmail.com" target="_blank">maemarcus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
OK, thanks.<br>
<br>
For our project I implemented a similar workaround: extend each i1<br>
memory item to i8 and load/store i1 to i8 with a type cast. Still, the<br>
issue in NVPTX remains. I don't know whether NVIDIA or community<br>
fellows have any reasonable priority to fix it (or at least put an NYI<br>
assertion!). It seems to be quite more complex, than implementing<br>
custom lowering handler, that's why I'm not trying myself. So for now<br>
I filled a bug, just for record:<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=13291" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=13291</a></blockquote><div><br></div><div>Thanks for posting the bug.  You're right that a bit of implementation effort will be required to fix this.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
- Dima.<br>
<br>
2012/7/3 Yuan Lin <<a href="mailto:yulin@nvidia.com">yulin@nvidia.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> In our (NVIDIA’s) NVVM IR spec, we define i1 having a memory size of 8 bit.<br>
><br>
><br>
><br>
>   setOperationAction(ISD::LOAD, MVT::i1, Custom);<br>
><br>
>   setOperationAction(ISD::STORE, MVT::i1, Custom);<br>
><br>
><br>
><br>
> is the right way to go.<br>
><br>
><br>
><br>
> Yuan<br>
><br>
><br>
><br>
><br>
><br>
> From: <a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a>] On<br>
> Behalf Of Justin Holewinski<br>
><br>
><br>
> Sent: Monday, July 02, 2012 9:55 AM<br>
> To: Dmitry N. Mikushin<br>
> Cc: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
> Subject: Re: [LLVMdev] [NVPTX] Backend failure in LegalizeDAG due to<br>
> unimplemented expand in target lowering<br>
><br>
><br>
><br>
> Okay, few issues here:<br>
><br>
><br>
><br>
> First, i1 is used in the NVPTX back-end to map to the predicate (.pred)<br>
> type.  We definitely do not want to declare this type as illegal.  The real<br>
> issue is lack of complete support for this type.  The PTX language places<br>
> restrictions on what can be done with .pred registers, and it looks like the<br>
> failure is here:<br>
><br>
><br>
><br>
> kernelgen_hostcall.exit228:                       ; preds = %while.cond.i226<br>
><br>
>   store i1 false, i1 addrspace(1)* undef, align 8<br>
><br>
><br>
><br>
> Ignoring for a second that you're storing to an undefined address (???), the<br>
> back-end does not yet handle up-casting an i1 to an appropriate type for<br>
> storage.  The memory space is not bit-addressable, so a direct store of an<br>
> i1 does not make sense.  In the short term, I would recommend that you<br>
> manually zext from/to i8 and load/store those.<br>
><br>
><br>
><br>
> On Sun, Jul 1, 2012 at 10:14 AM, Dmitry N. Mikushin <<a href="mailto:maemarcus@gmail.com">maemarcus@gmail.com</a>><br>
> wrote:<br>
><br>
> Hi Duncan,<br>
><br>
> Sorry I don't understand your point, could you please explain a little bit<br>
> more?<br>
> Why i1 should be declared illegal? Operations on byte-wide types like<br>
> char or bool are pretty legal, according to PTX spec:<br>
><br>
> "Registers may be typed (signed integer, unsigned integer, floating<br>
> point, predicate) or untyped. Register size is restricted; aside from<br>
> predicate registers which are 1-bit, scalar registers have a width of<br>
> 8-, 16-, 32-, or 64-bits, and vector registers have a width of 16-,<br>
> 32-, 64-, or 128-bits. The most common use of 8-bit registers is with<br>
> ld, st, and cvt instructions, or as elements of vector tuples."<br>
><br>
> Thanks,<br>
> - D.<br>
><br>
><br>
> 2012/6/30 Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>>:<br>
>> Hi Dmitry,<br>
>><br>
>>>> did you declare i1 to be an illegal type?<br>
>>><br>
>>><br>
>>> No. How?<br>
>><br>
>><br>
>> I think it will be considered illegal if you don't add it to any<br>
>> register class.<br>
>><br>
>> Ciao, Duncan.<br>
>><br>
>><br>
>>><br>
>>> 2012/6/30 Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>>:<br>
>>>><br>
>>>> Hi Dmitry,<br>
>>>>><br>
>>>>> So instead of setOperationAction(ISD::STORE, MVT::i1, Expand); one<br>
>>>>> should probably do setOperationAction(ISD::STORE, MVT::i1, Custom);<br>
>>>>> and implement it in NVPTXTargetLowering::LowerOperation.<br>
>>>>><br>
>>>>> But this issue makes a good point about the code efficiency: I suspect<br>
>>>>> such expansion will be very ugly in terms of performance. Probably we<br>
>>>>> can do much better if bool would use i32 instead of i1. I don't know<br>
>>>>> how to do that, though. Is it possible?<br>
>>>><br>
>>>><br>
>>>> did you declare i1 to be an illegal type?  If so, you shouldn't get any<br>
>>>> stores of i1 at this stage (you may get trunc stores to i1, but that is<br>
>>>> different).<br>
>>>><br>
>>>> Ciao, Duncan.<br>
>>>><br>
>>>>><br>
>>>>> Anyway, if this is a defect, then it's a blocker for us, and we'd much<br>
>>>>> appreciate a fix.<br>
>>>>><br>
>>>>> - D.<br>
>>>>><br>
>>>>> 2012/6/29 Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>>:<br>
>>>>>><br>
>>>>>> On Fri, Jun 29, 2012 at 2:11 PM, Dmitry N. Mikushin<br>
>>>>>> <<a href="mailto:maemarcus@gmail.com">maemarcus@gmail.com</a>> wrote:<br>
>>>>>>><br>
>>>>>>> Hi again,<br>
>>>>>>><br>
>>>>>>> Kind people on #llvm helped me to utilize bugpoint to reduce the<br>
>>>>>>> previously submitted test case. For record, it code be done with the<br>
>>>>>>> following command:<br>
>>>>>>><br>
>>>>>>> $ bugpoint -llc-safe test.ll<br>
>>>>>>><br>
>>>>>>> The resulting IR is attached, and it is crashing in the same way. Is<br>
>>>>>>> it a valid code?<br>
>>>>>><br>
>>>>>><br>
>>>>>> Looks like a bug in the NVPTXISelLowering.cpp: it has<br>
>>>>>> "setOperationAction(ISD::STORE, MVT::i1, Expand);", but the legalizer<br>
>>>>>> doesn't know how to handle that.<br>
>>>>>><br>
>>>>>> -Eli<br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> LLVM Developers mailing list<br>
>>>>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>>>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>>>>><br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> LLVM Developers mailing list<br>
>>>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>><br>
>><br>
>><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
><br>
> Thanks,<br>
><br>
><br>
><br>
> Justin Holewinski<br>
><br>
><br>
><br>
> ________________________________<br>
> This email message is for the sole use of the intended recipient(s) and may<br>
> contain confidential information.  Any unauthorized review, use, disclosure<br>
> or distribution is prohibited.  If you are not the intended recipient,<br>
> please contact the sender by reply email and destroy all copies of the<br>
> original message.<br>
> ________________________________<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>