并行计算范式-SIMD vs SIMT vs SMT: What’s the Difference Between Parallel Processing Models?

article/2025/9/1 22:12:21

Modern processor architectures utilize various execution models. Out of these, two are most popular: SIMD (Single Instruction Multiple Data) and SIMT (Single Instruction Multiple Threads). There’s also SMT (Simultaneous Multithreading), but that’s something else we’ll be checking at the end. In this post, we have a look at the SIMD and SIMT processor execution modes and see how they differ from one another.

SIMD: Single Instruction Multiple Data

Right off the bat, what is SIMD, and more importantly how does it work? SIMD is an execution model, meaning it’s method employed by processors to queue similar data sets in the pipeline and execute them in parallel. It’s one of the most popular EMs used by modern CPUs and GPUs. Single Instruction Multiple Data. As the name suggests, it works by employing a single instruction on multiple data sets simultaneously.

What that means is: One particular instruction is executed by multiple Execution units on multiple data sets. The EUs may be ALUs (Arithmetic Logic Units) or FPUs (Floating Point Units), but the key point here is that they all receive the same instruction from a shared Control Unit and then execute it on multiple different data sets.

在SIMD指令中,矢量寄存器倍划分为多个通道(lane),每个通道包含矢量中的一个元素。如下图所示,一个128位的矢量寄存器可以分成8个16位的数据通道。

PS:下图展示的是一个计算片段分别在标量计算单元和向量计算单元上不同的编程方法:

This improves data-level parallelism (not instruction level or concurrency) by letting the CPU perform identical tasks on different operands. In the above example, you can see that the lines of code include many functions that require the same operator. In the first column, all four lines basically involve the addition to two different matrices. SIMD allows all four to be executed in the same clock cycle. One important thing to note here is that SIMD uses execution units, not threads or cores.

如上图,指令会并行做4次OP操作,它们分别位于处理器内部的4个数据通道并且是相互独立的,任何一个通道中的溢出或者进位都不会影响其它通道

SIMD非常适合图像处理的场景,图像常用RGB565,RGBA8888,YUV422等格式的数据,这些格式的数据的特点是一个像素的一个分量(R,G,B,A,Y,U,V)使用一个字节来表示,如果使用传统的处理器做计算,虽然处理器的寄存器是32位或者64位,但是处理这些数据只能使用寄存器的低8位,这浪费了寄存器资源。如果把64位寄存器拆分成8个8位的数据通道,就能同时完成8个操作,计算效率是原来的8倍。

SIMT: Single Instruction Multiple Threads

SIMT is the thread equivalent of SIMD. While the latter uses Execution Units or Vector Units, SIMT expands it to leverage threads. In SIMT, multiple threads perform the same instruction on different data sets. The main advantage of SIMT is that it reduces the latency that comes with instruction prefetching.

SIMD is generally used in CPUs while SIMT is used in GPUs

SIMT is generally used in Super-scalar processors to implement SIMD. So technically, each core is scalar in nature but it still works similarly to an SIMD model by leveraging multiple threads to do the same task on various data sets.

Every time the GPU needs to execute a particular instruction, the data and instructions are fetched from the memory and then decoded and executed. In this case, all the data sets (up to a certain limit) that need the same instruction for execution are prefetched and executed simultaneously using the various threads available to the processor.

SMT: Simultaneous Multi-Threading

SMT or Simultaneous Multithreading allows a CPU core to leverage multiple threads at a time. Although theoretically, you can have up to 8 threads per core via SMT, it’s only feasible to have two. SMT is analogous to having two cargo belts at the airport luggage sorting, and one person sorting them.

There will be times when one belt is empty but the other still has pending work. In this instance, the person will switch to the other belt and continue sorting till the first belt gets more luggage. This is similar to how SMT operates in CPUs. There are times when there’s a memory delay or a cache miss, at this time, the CPU core would normally stay idle. SMT aims to take advantage of this to fully saturate the CPU time.

The CPU core architecture needs to be modified internally to support SMT. This usually involves increasing the register size (and in some cases the cache size as well) to allow the distribution of resources among the two threads equally, as well as to prevent contention.

Although modern CPUs leverage SMT quite well, there are still times when it’s redundant. That is mostly in latency intensive tasks where there is little to no delay in the pipeline. SMT can even hamper performance in applications that are resource intensive (register and cache). Here the two threads are forced to compete against one another for resources, leading to reduced performance.

总结    
  1. 在SIMD中,在一个vector中的多个element是完全同步并行计算的;
  2. 在SMT中,多个线程(thread)中的指令是并行执行的;
  3. 在SIMT中,多个thread共享一条指令并行执行(SMT是各个线程run各自的指令),每个thread处理一个scalar数据,使之看起来像SIMD,但是并不限制同时执行的thread之间的同步性。

可以这样说:SIMT相比SIMD更加灵活,而SMT相比SIMT又更加灵活,SIMD在损失灵活性的前提下提升了运算效率。所以对于灵活性而言,SIMD<SIMT<SMT;而对于计算效率而言,SIMD>SIMT>SMT,但是仅仅在那些SIMD灵活性足以处理的任务中进行比较。

        SIMT和SIMD都是通过广播同一条指令到多个执行单元的并行机制。因此多个执行单元可以共享同一套指令装载/指令译码逻辑。

        那么,“单指令多线程(SIMT)” 和 “单指令多数据(SIMD)”之间的区别究竟在哪里呢?在NVIDIA GPU的模型里面,有3个特征是SIMD并不具备的:

  1. 单指令,多套寄存器组(SIMD是并行的元素都在同一个寄存器内);
  2. 单指令,多个数据访问单元;
  3. 单指令,多种运算逻辑路径;
  4. SIMT数据路径独立,访存地址是线程ID的函数,但是SIMD的数据必须按照预先设计的形状分布。

Reference

SIMD<SIMT<SMT: NVIDIA GPU的并行机制_积小流哥的博客-CSDN博客_simd latency and throughput
SIMD < SIMT < SMT: parallelism in NVIDIA GPUs


结束

http://chatgpt.dhexx.cn/article/gnrCTPLO.shtml

相关文章

SIMD<SIMT<SMT: NVIDIA GPU的并行机制

原文出处&#xff1a; SIMD < SIMT < SMT: parallelism in NVIDIA GPUs 目录 1、概述 1.1、SIMD 2、SIMD vs SIMT 2.1 单指令、多套寄存器组 2.2 单指令、多个数据访问单元 2.3 单指令、多种运算逻辑路径 3、SIMD vs SIMT 3.1 GPU通过多thread来实现高thro…

关于GPU一些笔记(SIMT方面)

GPU组成 《计算机组成原理 — GPU 图形处理器》已经大概说明出GPU一般都是由比CPU多的core组成&#xff0c;而每个core 相当于一个单独线程进行计算&#xff0c;并且可以同时触发执行相同的单一指令但是每个计算单元数据不同(称之为SIMD)的指令执行。在英伟达GPU中 core一般称…

如何理解GPU中的SIMT(单指令流多线程模型)

随着设备尺寸逐渐变小&#xff0c;使得时钟频率很难有大的提升&#xff0c;人们开始寻找更有效的架构。为了提高能源效率&#xff0c;需要引入支持向量运算的硬件和减少数据的移动。 当下的架构通常是CPUGPU的&#xff0c;CPU在未来一段时间不会完全被GPU所取代&#xff0c;因…

mysql怎么设置主键唯一性约束_MySQL主键约束和唯一性约束

MySQL主键约束和唯一性约束都是索引&#xff0c;它们的区别是&#xff1a; 主键字段可以确保唯一性&#xff0c;但主键字段不能为NULL. 唯一性约束可以确保唯一性&#xff0c;但唯一性约束的字段可以为NULL 唯一性约束对含有NULL的记录不起作用&#xff0c;即可以重复加入含有N…

mysql唯一性约束的作用_sql唯一约束有什么用

SQL中唯一约束的作用是保证每个记录中都有一个唯一的标识&#xff0c;使得该列上没有相同的两个记录值&#xff1b;其中表的主键就是一个唯一性约束&#xff0c;不过主键只能有一个&#xff0c;所以如果其他列的数据不允许重复的话&#xff0c;就可以建立唯一性约束。 SQL中唯一…

mysql多字段唯一约束_mysql多字段唯一约束

MySQL唯一约束(Unique Key)要求该列唯一,允许为空,但只能出现一个空值。唯一约束可以确保一列或者几列不出现重复值。 在创建表时设置唯一约束 在定义完列之后直接使用 UNIQUE 关键字指定唯一约束,语法规则如下: UNIQUE 创建数据表 tb_dept2,指定部门的名称唯一,输入的 S…

mysql 修改唯一约束_mysql如何修改唯一性约束跟主键约束

一、如何添加主键约束和唯一性约束 1、添加主键约束 执行语法: alter table tableName add primarykey(column_name);#千万别忘了加(),同时要保证表结构中没有其他的主键,因为一个表中只能有一个主键。 2、添加唯一性约束 执行语法: alter table tableName addunique(colum…

在mysql中怎么样添加唯一约束_mysql怎么添加唯一约束?

方法:1、创建表时,使用“CREATE TABLE 表名(字段名 数据类型 UNIQUE);”语句来添加;2、修改表时,使用“ALTER TABLE 表名 ADD CONSTRAINT 唯一约束名 UNIQUE(列名);”语句来添加。 (推荐教程:mysql视频教程) MySQL 唯一约束(Unique Key)是指所有记录中字段的值不能重复出现…

添加唯一约束

– 1.添加唯一约束 – 方式1&#xff1a;创建表时指定 use mydb1; create table user1( id int, phone_number varchar(20)unique – 指定唯一约束 ); insert into user1 values(1001,‘123’); – insert into user1 values(1001,‘123’); --不是唯一会报错 – 在MySQL中&…

SQL Server 2012 唯一约束(定义唯一约束、删除唯一约束)

文章目录 准备知识定义唯一约束使用SSMS工具定义唯一约束使用SQL方式定义唯一约束方式一&#xff1a;在创建数据表的时候定义唯一约束方式二&#xff1a;修改数据表定义唯一约束 删除唯一约束使用SSMS工具删除唯一约束方式一&#xff1a;在对象资源管理器中删除唯一约束方式二&…

数据库----------唯一约束、默认约束、零填充约束

目录 1.唯一约束&#xff08;Unique&#xff09; 1.概念 2.语法 3.添加唯一约束 4.删除唯一约束 2.默认约束(default) 1.概念 2.语法 3.添加默认约束 4.删除默认约束 3.零填充约束&#xff08;zerofill&#xff09;了解即可 1.概念 2.操作 3.删除 1.唯一约束&…

window连接远程桌面快捷键

1、使用window R 打开运行界面&#xff0c;输入mstsc按回车 2、或者按window键打开开始界面&#xff0c;在搜索框输入mstsc按回车 3、效果

远程桌面快捷键的使用

AltPage Up 从左到右切换程序。   AltPage Down从右到左切换程序。   AltInsert按照程序的打开顺序&#xff0c;依次切换程序。   AltHome 显示“开始”菜单。   CtrlAltEnd 跳转到“window 安全”界面&#xff0c; 类似于本地机器的CtrlAltDelete   Alt Delete 相当…

Windows常用快捷键,打开记事本,打开我的电脑,屏幕投影扩展,远程桌面快捷键

网上很多windows快捷键的说明&#xff0c;这里不多记录&#xff0c;本文主要记录开发者使用windows比较常用的快捷键&#xff0c;尤其是多个显示器或者打开多个应用。 切到桌面 ------点击最右下叫可以一键切到桌面或者wind 打开记事本 记事本打开没有快捷键&#xff0c;这…

计算机开启远程桌面服务,远程桌面服务 教您开启远程桌面服务

远程桌面服务是两台电脑通过互联网建立连接的一种系统必要服务&#xff0c;可以用电脑A控制电脑B的桌面&#xff0c;还可以利用电脑B还控制电脑A的桌面&#xff0c;如果远程桌面服务没有开启就会无法连接到远程计算机&#xff0c;下面玉米系统小编教大家远程桌面服务开启方法。…

树莓派4B Ubuntu 远程桌面 步骤

文章目录 准备更换国内源更新软件列表和软件安装SSH安装ubuntu-desktopxrdp方法VNC方法问题故障解决花屏蓝屏/黑屏无法修正错误&#xff0c;因为您要求某些软件包保持现状&#xff0c;就是它们破坏了软件包间的依赖关系 参考 准备 Ubuntu Mate / Ubuntu Desktop版本为22.04 官…

android远程桌面源码,ARDC Android远程桌面助手 简介(示例代码)

我的GitHub 我的博客 我的微信 我的邮箱 bqt20094 baiqiantao@sina.com 目录 界面功能与快捷键 依赖adb,无需root,画面显示清晰且可调,支持自动保存截图,支持Ctrl+C复制画面到剪贴板,画面显示可缩放可全屏,支持拖拽文件到/sdcard/Download目录,Ctrl+拖拽APK可直接安装ap…

远程桌面按键失效变成快捷键

一直在使用远程桌面连接Windows 2008操作系统&#xff0c;发现一个很烦的问题&#xff0c;经常发现某些时间&#xff0c;输入的按键变成了快捷键。 如弹出“辅助功能选项”、某些程序被快捷启动、按e出现资源管理器等。 又如按L键就直接回到登录界面要求重新登录&#xff1a;…

windows开启远程桌面

现在的远程桌面工具很丰富&#xff0c;向日葵&#xff0c;ToDesk,TeamViewer 都是很简单易用的。但是在没有外网的场景下这些软件就不太好用了。今天来简单讲一下如果开启windows自带的远程桌面功能。 环境 我这里以windows 2008 R2做演示&#xff0c;其他的操作系统版本也是…