Control Flow Opteration:
Instruction cycle for anthimetic aritinstruction:
Fetch | Decode | Execute | Memory
control Divergence Exampls
---Example with divergence:
IF (threadIdx.x >2) {}
1. This creates two different control paths for threads in a
block.
2. Branch granularity(颗粒度) < wrap size; thread 0, 1 and 2
follow different path than the rest of the threads in the first
warp.
threadIdx.x >2 所以0, 1, 2都是失败的。
---Example without divergence:
IF (threadIdx.x /WARP_SIZE) {}
1. Also creates two different control paths for threads in a
block.
2. Branch granularity is a whole multiple of warp size, all
threads in any given warp follow the same path.
cuda variable Type Qualifiers
Variable declaration memory scope(范围) lifetime