cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rick_weber
Adept II

reduction kernel causes compilation hanging

Is instance() not supported in reduction kernels? I want to sum all the lower triangular elements in a matrix, so I do

reduce void reduction(float input<>, reduce float output)
{
int4 curDomainPt = instance()
if(curDomainPt.y > curDomainPt.x)
{
output += input;

When I run this in brcc, it hangs indefinitely and doesn't print anything. I'm using SDK version 1.3, as we haven't had time to upgrade yet as we have WIP that we don't want to accidently break.

0 Likes
2 Replies
Ceq
Journeyman III

No, you can't use "instance" neither "indexof" within reduction kernels. However you can use a normal kernel that makes a copy of the original stream but setting the upper elements to 0 and then apply the reduction.

 

kernel void lowerCopy(float input<>, out float output<> ) {
    int2 pos = instance().xy;
    float tmp = 0.0f;
    if(pos.y > pos.x) tmp = input;
    output = tmp;
}

 


From ATI Stream SDK User Guide (v1.4-beta):

A.6.3.6 Semantic Handling of indexof, instance...
...
instance:
- Always returns int4
- Cannot be used in a reduction kernel
...

0 Likes

That's what I'll do then. Thanks.

0 Likes