When bank conflicts in shared memory, serialized request is the order fixed?

on this example:

the console result is always :
out_h: 0
out_h: 32

My question is, when bank conflicts occur, the result seems to be certain.
Can I rely on this phenomenon to write actual engineering code?

There is no bank conflict in the code you have shown.

You seem to be asking about what happens when multiple threads write to the same location in shared memory (although you also have a situation where multiple threads are writing to the same location in global memory).

In any event, the order is undefined. That is to say, when multiple threads in a warp write to the same location, one of the threads will actually write, but which one is undefined. Relying on it is by definition broken code.

1 Like

hat is a little different from my understanding.
From your statement:
If you access the same address of the same bank, it is not considered a bank conflict.
If you access different addresses of the same bank, it is considered a bank conflict.

thank for your help.

As only one thread is successfully writing its value and the others are only trying to write there, but are not successful, it is no bank conflict, as only a single write is actually done to that bank.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.