This application provides a
branch execution method under a single-instruction multithreaded architecture and a general-purpose
graphics processor. The method is applied to a general-purpose
graphics processor (GPGPU), which includes a
processing unit and a circuit unit. The method includes: the
processing unit identifies a thread
branch and acquires
branch information, including a convergence point thread
mask, a first branch count, a first branch thread
mask, a second branch count, and a second branch thread
mask; the
processing unit inputs the branch information to the circuit unit, causing the circuit unit to complete a first setting, which includes saving the convergence point thread mask, the second branch count, and the second branch thread mask to a first stack layer, setting the
program counter to the first branch count, and setting the thread mask to the first branch thread mask; the processing unit executes a first target branch program; after the first target branch program is executed, the processing unit triggers the circuit unit to complete a second setting, which includes setting the
program counter to the second branch count and the thread mask to the second branch thread mask based on the data saved in the first stack layer; the processing unit executes a second target branch program. By utilizing this branch execution method under the single instruction multithreaded architecture and the general-purpose
graphics processor, good processing performance can still be maintained under the SIMT architecture with the low
hardware complexity of GPGPU.