"'** Like other types in ispc, pointers are varying by default, if an
explicit uniform qualifier isn't provided. However, the default variability
of the pointed-to type is uniform. "

Thank you Deepak, this was the bit I was missing.

Cheers,

Pete

On Wed, Jan 13, 2021 at 9:46 PM Deepak Rajendrakumaran <
[email protected]> wrote:

> Hi guys,
>
> If I understand correctly, we are discussing 2 different things here. Feel
> free to point out and correct me if I understand either incorrectly.
>
> *Issue 1 - Reason for warning getting added*
> This was mainly to avoid confusion for the user since varying is an ISPC
> feature and generally forbidden from exporting to cpp side outside of
> exceptions like this.
> We decided to add it, looking at the function signatures created for
> c-side header files by ispc for varying types and possibility of users
> finding it confusing.
> Note : To create header to check - ispc <input_file.ispc> *-h*
> <header_file.h>
>
> For eg.
> Ispc function: export void test2( varying float *uniform src, varying
> float *uniform dst ) { .. }
> exported function signature in Header created : extern void test2(float( *
> src)[8], float( * dst)[8]);  // the [8] here is because is 8 wide(varying)
> since i compiled for avx2-i32x8 .
> Varying though represented as vectors internally in ispc IR is represented
> as arrays in headers.
>
>
> Similarly array
> Ispc Function : export void test3(float src[20], float  dst[20])
> exported function signature in  Header created : extern void test3(float(
> * src)[8], float( * dst)[8]); // the [8] here is because is 8 wide(varying)
> since i compiled for avx2-i32x8.
>
> Reference to compare IR for ISPC and corresponding function signature in
> header
> Ispc - https://ispc.godbolt.org/z/TPhv5n
> header : https://godbolt.org/z/brod78
>
> If you prefer to remove the warning, one option is to use 'pragma ignore
> warning ' before the function. See perfbench.ispc here -
> https://github.com/ispc/ispc/commit/761de37d076c64dbf8f74226a3b1f88fcb8fdc1e
>
>
> *Issue 2 - variability of pointer type*
>
> Looking at Pete's code - https://ispc.godbolt.org/z/76dajK
>
> The below excerpt is from the ispc documentation -
> https://ispc.github.io/ispc.html#pointer-types
> '** Like other types in ispc, pointers are varying by default, if an
> explicit uniform qualifier isn't provided. However, the default
> variability of the pointed-to type is uniform. ** This rule will be
> illustrated and explained in examples below.'
>
> So ,
> int * uniform var = uniform int *uniform var
> int * var =             uniform int * varying var
>
> Considering the above, you are right that default Variability is 'varying'
> but pointed-to type for pointers is an exception.
> So, the current behaviour seems correct to me.
>
> Note - we do have a typecast buf for Variability now-
> https://github.com/ispc/ispc/pull/1978 . But, that's not immediately
> related to this.
>
>
> Regards,
> Deepak
>
>
> On Wed, Jan 13, 2021 at 7:00 PM Pete Brubaker <[email protected]> wrote:
>
>> I'm fairly certain this warning was added because varying is the default
>> specifier for types and can possibly confuse people new to the language.
>> However it doesn't look like it's working as intended.
>>
>> https://ispc.godbolt.org/z/76dajK
>>
>> It looks like pointer parameters on exported functions aren't
>> automatically promoted varying.  However pass by value types are.
>>
>> Cheers,
>>
>> Pete
>>
>>
>>
>> On Wed, Jan 13, 2021 at 3:22 PM Marianna Neubauer <
>> [email protected]> wrote:
>>
>>> Hello,
>>>
>>> Since uniform pointers to varying types are permitted for an exported
>>> function, I don't understand why this warrants a warning. What was the
>>> motivation for adding this warning?
>>>
>>> Thank you,
>>> Marianna
>>>
>>> On Monday, November 9, 2020 at 5:36:42 PM UTC-8 Deepak Rajendrakumaran
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> Yes, this was an expected change -
>>>> https://github.com/ispc/ispc/commit/761de37d076c64dbf8f74226a3b1f88fcb8fdc1e
>>>>
>>>> Functionally there is not change but a warning got added. You should
>>>> still be able to compile and run your code, but it'll print the warning .
>>>> 'Warning: Exported function parameter "ptr" points to varying type' merely
>>>> lets the user know they are dealing with a varying type.
>>>>
>>>> -Deepak
>>>>
>>>> On Monday, November 9, 2020 at 2:33:16 PM UTC-8 [email protected]
>>>> wrote:
>>>>
>>>>>
>>>>> An exported function (at least up to 1.12) happily accepted parameters
>>>>> of the form:
>>>>>
>>>>> varying TYPE * uniform ptr
>>>>>
>>>>> I am trying out 1.14.1 and get the following error:
>>>>>
>>>>> test.ispc:2:19: Warning: Exported
>>>>>         function parameter "ptr" points
>>>>>         to varying type
>>>>> run(varying float * uniform ptr)
>>>>>
>>>>> From this code:
>>>>>
>>>>> export void
>>>>> run(varying float * uniform ptr)
>>>>> {
>>>>> }
>>>>>
>>>>> The code compiles as expected at least up to 1.12.
>>>>>
>>>>> Is this an expected change?  I didn't see anything about it in the
>>>>> release notes.
>>>>>
>>>>> Cheers,
>>>>> -Brian
>>>>>
>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Intel SPMD Program Compiler Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ispc-users/3240f3c9-1fc2-462e-b3de-6f07ffc61a93n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ispc-users/3240f3c9-1fc2-462e-b3de-6f07ffc61a93n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Intel SPMD Program Compiler Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ispc-users/CAH0mFKAD4XqeHkVe_C0958oTeVo38ZZvQYHaGPL_u1vRWmJ5kQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ispc-users/CAH0mFKAD4XqeHkVe_C0958oTeVo38ZZvQYHaGPL_u1vRWmJ5kQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Intel SPMD Program Compiler Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ispc-users/CAAV9i%3D4gZThb%2Boeo70jYiDmTPcXkyo2P9g9Tk7KfY%3DWrY%3DSzVg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ispc-users/CAAV9i%3D4gZThb%2Boeo70jYiDmTPcXkyo2P9g9Tk7KfY%3DWrY%3DSzVg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Intel SPMD Program Compiler Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ispc-users/CAH0mFKCSnHnGg%3DRs8C%2B5CV%3D9WBCEvO%2BwhTKF%2BYM%3D8tgTeobEUg%40mail.gmail.com.

Reply via email to