Skip to content

Commit 3004f33

Browse files
randyh62neon60
authored andcommitted
add builtin-expect text
1 parent ae5adbc commit 3004f33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/how-to/performance_guidelines.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ For example, when the control condition depends on ``threadIdx`` or ``warpSize``
262262
warp doesn't diverge. The compiler might optimize loops, short ifs, or switch
263263
blocks using branch predication, which prevents warp divergence. With branch
264264
predication, instructions associated with a false predicate are scheduled but
265-
not executed, which avoids unnecessary operations.
265+
not executed, which avoids unnecessary operations. For control conditions where
266+
one outcome is significantly more likely than the other, use `__builtin_expect <https://clang.llvm.org/docs/LanguageExtensions.html#builtin-expect>`_
267+
or ``[[likely]]`` to indicate the likely condition result.
266268

267269
Avoiding divergent warps
268270
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)