Predication (computer architecture): Difference between revisions

Content deleted Content added
Those are all branch instructions; no need to list them all individually. (Yes, a subroutine call or return is a branch, and a "branch table" is something that contains targets of branches.) This makes it a bit clearer that predication isn't implemented with branches, it's an *alternative* to branches. (And, yes, the next sentence needs to be fixed to make it clearer that it replaces branches.)
First try at making it clearer that predication *removes* branches. This probably needs more work.
Line 1:
{{More citations needed|date=March 2014}}
{{Distinguish|Branch prediction}}
In [[computer science]], '''predication''' is an [[computer architecture|architectural]] feature that provides an alternative to conditional transfer of [[control flow|control]], as implemented by conditional [[branch (computer science)|branch]] [[instruction (computer science)|machine instructions]]. Predication works by executinghaving conditional (''predicated'') non-branch instructions fromassociated bothwith pathsa of''predicate'', thea branch[[Boolean anddata onlytype|Boolean permittingvalue]] thoseused instructionsby fromthe instruction to control whether the takeninstruction pathis allowed to modify the architectural state or not. If the predicate specified in the instruction is true, the instruction modifies the architectural state; otherwise, the architectural state is unchanged. For example, a predicated move instruction (a conditional move) will only modify the destination if the predicate is true. Thus, instead of using a conditional branch to select an instruction or a sequence of instructions to execute based on the predicate that controls whether the branch occurs, the instructions to be executed are associated with that predicate, so that they will be executed, or not executed, based on whether that predicate is true or false.<ref name="rvinyard">{{cite web
|url= https://www.cs.nmsu.edu/~rvinyard/itanium/predication.htm
|title= Predication
|date= 2000-04-26 |accessdate= 2014-04-22
|author= Rick Vinyard |website= cs.nmsu.edu
}}</ref>
}}</ref> The instructions from the taken path are permitted to modify architectural state because they have been associated (''predicated'') with a ''predicate'', a [[Boolean data type|Boolean value]] used by the instruction to control whether the instruction is allowed to modify the architectural state or not. If the predicate specified in the instruction is true, the instruction modifies the architectural state; otherwise, the architectural state is unchanged. For example, a predicated move instruction (a conditional move) will only modify the destination if the predicate is true.
 
[[Vector processors]], some [[SIMD]] ISAs (such as [[AVX2]] and [[AVX-512]]) and [[GPU]]s in general make heavy use of predication, applying one bit of a conditional ''mask Vector'' to the corresponding elements in the Vector registers being processed, whereas scalar predication in scalar instruction sets only need the one predicate bit. Where Predicate Masks become particularly powerful in [[Vector processing]] is if an ''array'' of [[Condition_code_register|Condition Codes]], one per Vector element, may feed back into Predicate Masks that are then applied to subsequent Vector instructions.