libocca / occa-transpiler

Working directory for new transpiler project
MIT License
7 stars 1 forks source link

no "{}" brackets when using an atomic one-liner if/for statements cause errors #176

Closed jrosn85 closed 6 months ago

jrosn85 commented 6 months ago

the following kernel:


@kernel void buggy_kernel() {
    for (int i = 0; i < 100; ++i; @outer) {
        @shared float shared_val;
        for (int j = 0; j < 100; ++j; @inner) {
            if( j<100 )
               @atomic shared_val += j;
        }
    }
}

causes transpilation error: expected unqualified-id, but putting the @atomic line in "{}" brackets makes it transpile without errors. So this works fine:


@kernel void working_kernel() {
    for (int i = 0; i < 100; ++i; @outer) {
        @shared float shared_val;
        for (int j = 0; j < 100; ++j; @inner) {
            if( j<100 ){
               @atomic shared_val += j;
            }
        }
    }
}

the same goes for loops.

IuriiKobein commented 6 months ago

@jrosn85 please open separate issue for loops with input and expected behavior.