<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><base href="x-msg://2080/"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I agree with Micah and Guy that the sampler type should be an opaque type.  The i32 solution has too many cons, and the pros are not clear-cut either.  (For example, I don’t quite understand why constant propagation on samplers should even work.)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The problem with renaming of opaque types should better be solved by extending LLVM to disallow renaming given types.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Without seeing a follow-up patch, I cannot comment on the use of functions to initialize samplers.  In our implementation, we use both opaque types and metadata, which works fine.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Anton.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Villmow, Micah [mailto:Micah.Villmow@amd.com] <br><b>Sent:</b> 12 October 2012 00:02<br><b>To:</b> Tanya Lattner<br><b>Cc:</b> Benyei, Guy; cfe-dev@cs.uiuc.edu; Anton Lokhmotov<br><b>Subject:</b> RE: [cfe-dev] OpenCL & SPIR specific types - proposal and patch<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div><p class=MsoNormal><span lang=EN-US>If the type gets renamed, how are you going to identify what is a sampler?<o:p></o:p></span></p><p class=MsoNormal><b><i><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>[Villmow, Micah] Usage.</span></i></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>See my comment above about linking and opaque types as it doesn't solve that problem for you either.<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>Can you please share your list of pros and cons of pointer to opaque type versus int? <o:p></o:p></span></p><p class=MsoNormal><b><i><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>[Villmow, Micah] Sure, here is what I view as the pros and cons.<o:p></o:p></span></i></b></p><p class=MsoNormal><b><i><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Opaque type:<o:p></o:p></span></i></b></p><p class=MsoNormal><b><i><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Pros:<o:p></o:p></span></i></b></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Implementation details are target dependent<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>No confusion with valid i32 type<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Utilizes the type system instead of metadata<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Can be materialized to i32 if needed<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>No operations can occur on the type.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Easier to track through stack.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Cons:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Can be renamed and loose information<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Requires initialization function<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Requires global variables<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I32:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Pros:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Can be initialized inline and constant propagated.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Already works(for AMD at least).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Metadata can make for easy identification if it exists.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Maps 1-1 to initializers<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Cons:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Optimizers don’t know the differences between sampler and other i32<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Harder to track through stack<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>An integer i32 and a sampler_t i32 is only determined by usage and not type.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Operations can work on the type, which is illegal.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Metadata can be lost requiring extensive analysis which cannot always be determined.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>-Tanya<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></div></div></div></div></body></html>