<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Frank,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
By default clang compiles using OpenCL version 1.0, so you would need to add '-cl-std=CL2.0' flag (<a href="https://godbolt.org/z/PznaWrfnb" id="LPlnk">https://godbolt.org/z/PznaWrfnb</a>) as get_global_linear_id() is a function from OpenCL 2.0 onwards:</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#work-item-functions" id="LPlnk415498">https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#work-item-functions</a><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Anastasia<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of Frank Winter via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> 09 May 2021 19:11<br>
<b>To:</b> cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> [cfe-dev] OpenCL: get_global_linear_id() not supported?</font>
<div> </div>
</div>
<div dir="ltr">The follwing kernel doesn't compile with Clang (current upstream):
<div><br>
</div>
<div>__kernel void test()</div>
<div>{</div>
<div>  int i = get_global_linear_id();</div>
<div>}</div>
<div><br>
</div>
<div>clang  -emit-llvm -target amdgcn-amd-amdhsa -mcpu=gfx908 -Xclang -finclude-default-header -c test.cl -o test_amd.bc</div>
<div><br>
</div>
<div>test.cl:3:11: error: implicit declaration of function 'get_global_linear_id' is invalid in OpenCL</div>
<div>  int i = get_global_linear_id();</div>
<div>          ^</div>
<div>1 error generated.</div>
<div><br>
</div>
<div>Per Khronos OpenCL 2.0 specification this function is part of the standard.</div>
<div><br>
</div>
<div>What am I missing here?</div>
<div><br>
</div>
<span>Frank</span> </div>
</body>
</html>