jzarnett / ece459

ECE 459: Programming for Performance
436 stars 136 forks source link

Fixed minor issue in 'Branches in kernels' slide code in Lecture 22. #39

Closed armcburney closed 5 years ago

armcburney commented 5 years ago

Variables a and b on slide 16 of Lecture 22 aren't being used. I think x and y are supposed to be a and b instead.

kernel void contains_branch(global float *a, 
                            global float *b) {
    int id = get_global_id(0);
    if (cond) {
        x[id] += 5.0;
    } else {
        y[id] += 5.0;
    }
}

=>

kernel void contains_branch(global float *a, 
                            global float *b) {
    int id = get_global_id(0);
    if (cond) {
        a[id] += 5.0;
    } else {
        b[id] += 5.0;
    }
}