<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<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 CY,</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);">
that's right, there is a patch for this in review:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://reviews.llvm.org/D112110" id="LPNoLPOWALinkPreview">https://reviews.llvm.org/D112110</a></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);">
You can also file a bugzilla bug if you like, but it might be quicker to just finalize the review.</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,<br>
Anastasia<br>
</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
<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 Chuang-Yu Cheng via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> 13 October 2021 08:44<br>
<b>To:</b> cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> [cfe-dev] Compile OpenCL2.x kernel which declares “Other Data Types” with global address space in program scope</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Hi,<br>
<br>
In OpenCL2.x, I think it is not legal to declare/define “Other Data<br>
Types” (The OpenCL™ C 2.0 Specification) ndrange_t / queue_t / … etc,<br>
with global address space in program scope, for example:<br>
<br>
test.cl<br>
```c<br>
global ndrange_t nrt;<br>
global queue_t qt;<br>
<br>
kernel void test(global int *a) { a[0] = 0; }<br>
```<br>
<br>
Given the OpenCL2.x spec states:<br>
<a href="https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html">https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html</a><br>
<br>
In 6.5.1. __global (or global):<br>
“Variables defined at program scope and static variables inside a<br>
function can also be declared in the global address space. They can be<br>
defined with any valid OpenCL C data type except for those in Other<br>
Built-in Data Types. In particular, such program scope variables may<br>
be of any user-defined type, or a pointer to a user-defined type.”<br>
<br>
But I use clang-13 to compile the test case, it passes without any<br>
warning or error:<br>
<br>
clang-13 --target=amdgcn -cl-std=CL2.0 -S -O3 test.cl<br>
<br>
Should we add more checks in:<br>
<a href="https://clang.llvm.org/doxygen/SemaDecl_8cpp_source.html#l06825">https://clang.llvm.org/doxygen/SemaDecl_8cpp_source.html#l06825</a><br>
<br>
/// Returns true if there hasn't been any invalid type diagnosed.<br>
static bool diagnoseOpenCLTypes(Sema &Se, VarDecl *NewVD)<br>
<br>
Thanks,<br>
CY<br>
_______________________________________________<br>
cfe-dev mailing list<br>
cfe-dev@lists.llvm.org<br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</div>
</span></font></div>
</body>
</html>