<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 14 (filtered medium)"><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:0in;
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;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
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-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>In ptx, variables need to be defined before referenced. NVPTX emits the global variables in the order as in the LLVM IR and does not sort them. It is a bug in the NVPTX backend.<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'>Thanks.<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'>Yuan<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><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Dmitry N. Mikushin [mailto:maemarcus@gmail.com] <br><b>Sent:</b> Wednesday, July 18, 2012 7:44 AM<br><b>To:</b> LLVM-Dev<br><b>Cc:</b> Justin Holewinski; Yuan Lin<br><b>Subject:</b> [NVPTX] PTXAS - Unimplemented feature: labels as initial values<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Dear NVPTX community,<br><br>PTXAS fails to compile the ptx code generated by NVPTX. Is it an issue of backend or an issue of PTXAS or a known reasonable restriction?<br><br>Thanks,<br>- Dima.<br><br>> cat test.ll<br>; ModuleID = '__kernelgen_main_module'<br>target datalayout = "e-p:64:64-i64:64:64-f64:64:64-n1:8:16:32:64"<br>target triple = "ptx64-unknown-unknown"<br><br>%struct.__st_parameter_dt.0.4 = type { %struct.__st_parameter_common.1.5, i64, i64*, i64*, i8*, i8*, i32, i32, i8*, i8*, i32, i32, i8*, [256 x i8], i32*, i64, i8*, i32, i32, i8*, i8*, i32, i32, i8*, i8*, i32, i32, i8*, i8*, i32, [4 x i8] }<br>%struct.__st_parameter_common.1.5 = type { i32, i32, i8*, i32, i32, i8*, i32* }<br>%"struct.kernelgen::kernel_t.2" = type opaque<br>%struct.kernelgen_callback_data_t.3 = type opaque<br><br>@.cst = hidden constant [11 x i8] c"reduce.f90\00", align 4096<br>@z = unnamed_addr global i8* getelementptr inbounds ([3 x i8]* @.cst1, i64 0, i64 0), align 4096<br>@.cst1 = hidden constant [3 x i8] c"zz\00", align 4096<br>@a = unnamed_addr global i8* getelementptr inbounds ([3 x i8]* @.cst12, i64 0, i64 0), align 4096<br>@.cst12 = hidden constant [3 x i8] c"aa\00", align 4096<br>@.cst2 = hidden constant [26 x i8] c"Usage: %s <nx> <ny> <nz>\0A\00", align 4096<br><br>> llc -march=nvptx64 test.ll -o test.ptx<br>> cat test.ptx<br>//<br>// Generated by LLVM NVPTX Back-End<br>//<br><br>.version 3.0<br>.target sm_10, texmode_independent<br>.address_size 64<br><br>.visible .global .align 4096 .b8 _2E_cst[11] = {114, 101, 100, 117, 99, 101, 46, 102, 57, 48, 0};<br>.visible .global .align 4096 .u64 z = _2E_cst1;<br>.visible .global .align 4096 .b8 _2E_cst1[3] = {122, 122, 0};<br>.visible .global .align 4096 .u64 a = _2E_cst12;<br>.visible .global .align 4096 .b8 _2E_cst12[3] = {97, 97, 0};<br>.visible .global .align 4096 .b8 _2E_cst2[26] = {85, 115, 97, 103, 101, 58, 32, 37, 115, 32, 60, 110, 120, 62, 32, 60, 110, 121, 62, 32, 60, 110, 122, 62, 10, 0};<br><br>> ptxas test.ptx -o test.cubin<br>ptxas test.ptx, line 10; error : Unimplemented feature: labels as initial values<br>ptxas test.ptx, line 12; error : Unimplemented feature: labels as initial values<br>ptxas test.ptx, line 10; error : Label expected for forward reference of '_2E_cst1'<br>ptxas test.ptx, line 12; error : Label expected for forward reference of '_2E_cst12'<br>ptxas fatal : Ptx assembly aborted due to errors<o:p></o:p></p></div>
<DIV>
<HR>
</DIV>
<DIV>This email message is for the sole use of the intended recipient(s) and may
contain confidential information. Any unauthorized review, use, disclosure
or distribution is prohibited. If you are not the intended recipient,
please contact the sender by reply email and destroy all copies of the original
message. </DIV>
<DIV>
<HR>
</DIV>
<P></P>
</body></html>