Question about OpenCL language standard option
jingu
jingu at codeplay.com
Sat Nov 30 00:49:03 PST 2013
Hi Arthur, Joey,
I appreciate your response. As Arthur mentioned, I assumed this is not
VLA because there is 'const' qualifier and this example is included in
one OpenCL test-suite and clang folded this with 'GNUMode' not VLA. I am
sorry it was my mistake. Thank you for your response, again.
Sincerely,
JinGu Kang
2013-11-30 오전 10:59, Arthur O'Dwyer 쓴 글:
> Joey, JinGu,
>
> I believe JinGu was expecting the array to be not-a-VLA, because its
> size is "const". In C++ JinGu would be correct; that array's size *is*
> a compile-time constant in C++, but in C (and therefore in OpenCL)
> it's not constant, because it depends on the value of a variable. (The
> variable's type happens to be const-qualified, but that doesn't matter
> in C.)
>
> If this test case came from an official OpenCL test suite, IMHO the
> right course of action is almost certainly to contact the maker of
> that test suite and get them to change their test, rather than add an
> extension to Clang just for this one special case. (Alternatively, is
> there such a thing as OpenCL++? Should this test be compiled in that
> mode?)
>
> HTH,
> –Arthur
>
>
> On Fri, Nov 29, 2013 at 5:32 PM, Joey Gouly <Joey.Gouly at arm.com> wrote:
>> Hi JinGu,
>>
>> I'm not sure I understand.. VLAs are *not* supported in OpenCL. See Restrictions 6.9.d.
>>
>> Thanks,
>> Joey
>> ________________________________________
>> From: cfe-commits-bounces at cs.uiuc.edu [cfe-commits-bounces at cs.uiuc.edu] On Behalf Of JinGu Kang [jingu at codeplay.com]
>> Sent: 29 November 2013 17:32
>> To: cfe-dev at cs.uiuc.edu; cfe-commits at cs.uiuc.edu
>> Subject: Question about OpenCL language standard option
>>
>> Hi all,
>>
>> I got a error from a opencl test. The test code is as following:
>>
>> source code:
>> __kernel void test_fn(__global uint *src, __global uint4 *results) {
>> const size_t SIZE = 128;
>> int tid = get_global_id(0);
>> if (tid*4 >= SIZE)
>> return;
>> __private uint sPrivateStorage[SIZE];
>> for (size_t i=0 ; i<SIZE ; i++)
>> sPrivateStorage[i] = src[i];
>> results[tid] = vload4(tid, sPrivateStorage);
>> }
>>
>> and the error message is as following:
>>
>> "error: variable length arrays are not supported in OpenCL
>> __private uint sPrivateStorage[SIZE];"
>>
>> The problem is that 'isArraySizeVLA' function calls
>> 'VerifyIntegerConstantExpression' with 'S.LangOpts.GNUMode'. The OpenCL
>> Language standard option does not have this option. It causes a error
>> because 'AllowFold' is not set to 1. In order to fix this error, I think
>> that we need to insert 'GNUMode' to OpenCL LANGSTANDARD or modify
>> sligtly checking code. How do you feel about this? I can not guarantee
>> the side effect of 'GNUMode' with OpenCL. I have attached a simple patch
>> as reference. If there is something wrong, please let me know.
>>
>> Thanks,
>> JinGu Kang
>>
>> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>>
>> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
>> ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list