Hi,

For "1": Yes, you can have tile_static scalar variables.

For "2": The addition/subtraction operations will need to be atomic for correctness. An addition/subtraction operation comprises a load, arithmetic add/subtract and a store and for correct results
it is necessary that these be performed atomically since if other thread’s (from the same tile) execution interleaves between the load and the store, you could end up with wrong results.

Consider a situation where a tile_static variable is initialized to “0” and 2 threads are concurrently trying to increment it by “1” and their execution interleaves as follows:

thread1_local_x = load tile_static var;
// (thread1_local_x = 0)

thread2_local_x = load tile_static var;
// (thread2_local_x = 0)

thread1_local_x = thread1_local_x + 1;
// (thread1_local_x = 1)

thread2_local_x = thread2_local_x + 1;
// (thread2_local_x = 1)

store thread1_local_x to tile_static var;
// (tile_static var = 1)

store thread2_local_x to tile_static var;
// (tile_static var = 1) Incorrect result (the increment by the other thread is lost)

-Amit

Amit K Agarwal