8.3 Overall System Design
下面把论文 第 8.3 节 Overall System Design 拆开讲清楚。
这一节讲的是:SeGraM 整个系统在硬件层面是怎么搭起来的,包括主机怎么连接、HBM 怎么组织、32 个加速器怎么并行、流水线怎么隐藏延迟,以及容量不够时怎么分批处理。
一、整体架构概览
论文 Figure 14 展示了 SeGraM 的整体设计。
可以概括为:
主机(Host)
│
├── 负责预处理(生成图、建索引)
├── 负责把 query read 传给加速器
│
▼
SeGraM 硬件平台
├── 4 个 HBM2E 栈
│ ├── 每个栈 8 个内存通道
│ └── 每个栈旁边放 1 个 SeGraM 模块
│
└── 每个 SeGraM 模块
├── 8 个 SeGraM 加速器
└── 每个加速器 = 1 个 MinSeed + 1 个 BitAlign
所以总共:
- 4 个 HBM2E 栈;
- 每个栈 8 个通道,共 32 个通道;
- 每个通道对应 1 个 SeGraM 加速器;
- 总共 32 个 SeGraM 加速器并行工作。
二、主机与传输:双缓冲隐藏延迟
论文原文:
When the host transfers a single query read to SeGraM, the read is buffered before being processed. We employ a double buffering technique to hide the transfer latency of the query reads. Thus, this transfer is not on the critical path of SeGraM's execution, since the next query read to be processed has already been transferred and stored in the read scratchpad of the MinSeed accelerator when the current query read is being processed.
翻译并解释:
- 主机把 query read 传给 SeGraM 时,先放进缓冲区;
- 用双缓冲隐藏传输延迟;
- 当 SeGraM 正在处理当前 read 时,下一条 read 已经通过主机传进来,存进了 MinSeed 的 read scratchpad;
- 所以主机到 SeGraM 的传输不在关键路径上,不会成为瓶颈。
通俗理解:
就像流水线工人,手里做一个零件时,下一个零件已经放在旁边了,不用等。
这样 SeGraM 可以一直忙,不会因为等数据而空闲。
另外,论文强调:
For fair comparison, we exclude the time spent for generating and loading these structures to main memory for both our SeGraM design and for the baseline tools, as this is a one-time cost.
翻译:
为了公平比较,预处理(生成图、建索引、加载到主存)的时间不计入,因为这是一次性开销,不是端到端执行的瓶颈。
三、硬件平台布局:4 个 HBM2E 栈 + 4 个 SeGraM 模块
论文原文:
Our hardware platform includes four off-chip HBM2E stacks, each with eight memory channels. Next to each HBM2E stack, we place one SeGraM module. A single SeGraM module consists of 8 SeGraM accelerators, where each accelerator is a combination of one MinSeed accelerator and one BitAlign accelerator.
翻译:
- 硬件平台有 4 个片外 HBM2E 栈;
- 每个栈有 8 个内存通道;
- 每个 HBM2E 栈旁边放 1 个 SeGraM 模块;
- 每个 SeGraM 模块包含 8 个 SeGraM 加速器;
- 每个 SeGraM 加速器 = 1 个 MinSeed + 1 个 BitAlign。
所以:
- 4 个模块 × 8 个加速器 = 32 个 SeGraM 加速器;
- 每个加速器独占一个 HBM2E 通道。
论文原文:
Each SeGraM accelerator has exclusive access to one HBM2E channel to ensure low-latency and high-bandwidth memory access, without any interference from other SeGraM accelerators in each module.
翻译:
每个 SeGraM 加速器独占一个 HBM2E 通道,保证低延迟和高带宽,避免同一模块内其他加速器的干扰。
为什么独占通道?
因为 seeding 阶段有大量随机内存访问。
如果多个加速器共享通道,会互相干扰,延迟增加。
独占通道可以让每个加速器稳定地获得高带宽和低延迟。
论文还提到:
By placing SeGraM in the same package as the four HBM2E stacks, we mimic the configuration of current commercial devices such as GPUs and FPGA boards.
翻译:
把 SeGraM 和四个 HBM2E 栈放在同一个封装里,模仿了当前 GPU 和 FPGA 板的配置。
这样内存访问延迟低,带宽高。
四、数据复制与分布:32 个加速器并行
论文原文:
We replicate the graph-based reference and hash-table-based index across all 4 independent HBM2E stacks, which enables us to have 32 independent SeGraM accelerators running in parallel.
翻译:
把图参考和哈希索引复制到所有 4 个 HBM2E 栈上。
这样 32 个 SeGraM 加速器可以完全独立并行运行。
为什么复制?
因为每个加速器要处理不同的 read,都需要访问完整的图和索引。
如果只存一份,所有加速器都要抢同一个内存,带宽不够。
复制 4 份后,每个栈都有自己的完整数据,32 个加速器可以同时查,互不干扰。
论文原文:
Within each stack, to balance the memory footprint across all channels, we distribute the graph and index structures of all chromosomes (1-22, X, Y) based on their sizes across the eight independent channels.
翻译:
在每个栈内部,为了平衡 8 个通道的内存占用,根据染色体大小,把 24 条染色体的图和索引结构分布到 8 个通道上。
通俗理解:
一个栈有 8 个通道,每个通道对应一个加速器。
不能让某个通道存太多,某个通道太空。
所以按染色体大小均匀分配,让每个通道的内存负载大致平衡。
论文原文:
For the datasets we use, the graph and index structures require a total memory of 11.2 GB per stack, which is well within the capacity of a single HBM2E stack (i.e., 16 GB in current technology).
翻译:
实验数据中,每个栈需要约 11.2 GB 存图和索引,而单个 HBM2E 栈容量是 16 GB,完全放得下。
五、加速器内部流水线:隐藏 MinSeed 延迟
论文原文:
We design each SeGraM accelerator (MinSeed + BitAlign) to operate in a pipelined fashion, such that we can hide the latency of the MinSeed accelerator. While BitAlign is running, MinSeed finds the next set of minimizers, fetches the frequencies and seeds from the main memory, and writes them to their associated scratchpads.
翻译:
每个 SeGraM 加速器内部,MinSeed 和 BitAlign 以流水线方式工作。
当 BitAlign 正在跑 alignment 时,MinSeed 已经在找下一组 minimizer、查频率、取 seed,并写入对应的 scratchpad。
为什么要流水线?
因为 MinSeed 和 BitAlign 是串行的:先 seeding,再 alignment。
如果串行执行,BitAlign 跑的时候 MinSeed 闲着,浪费时间。
流水线后,两者可以重叠,MinSeed 的延迟被 BitAlign 的计算掩盖。
论文原文:
In order to enable pipelined execution of MinSeed and BitAlign, we employ the double buffering technique for the minimizer scratchpad and seed scratchpad (as we do for the read scratchpad).
翻译:
为了实现流水线,minimizer scratchpad 和 seed scratchpad 也采用双缓冲,和 read scratchpad 一样。
双缓冲怎么工作?
- 当 BitAlign 正在处理当前一批子图时,MinSeed 把下一批 minimizer 和 seed 写入另一个缓冲区;
- 当前一批处理完,BitAlign 直接切到新缓冲区,不用等。
六、容量不足时的分批处理
论文原文:
If the minimizers do not fit in the minimizer scratchpad, we can perform a batching approach, where not all of the minimizers will be found and stored together. Instead, a batch (i.e., a subset) of minimizers is found, stored, and used, and then the next batch will be generated out of the read. A similar optimization can be applied to the seed scratchpad if capacity issues arise.
翻译:
如果 minimizer 太多,minimizer scratchpad 装不下,就采用分批处理:
一次只找一部分 minimizer,存下来用掉,再找下一批。
seed scratchpad 如果容量不够,也可以类似处理。
为什么需要?
因为 scratchpad 是有限的(minimizer 40 kB,seed 4 kB)。
有些 read 可能产生很多 minimizer 或很多 seed。
分批可以避免溢出,同时不改变算法逻辑。
七、总结:第 8.3 节的核心逻辑
- 整体架构:主机 + 4 个 HBM2E 栈 + 4 个 SeGraM 模块 + 32 个 SeGraM 加速器。
- 主机传输:双缓冲隐藏延迟,传输不在关键路径。
- 内存通道:每个加速器独占一个 HBM 通道,避免干扰,保证带宽和低延迟。
- 数据复制:图和索引复制到 4 个栈,32 个加速器并行;每个栈内按染色体大小分布到 8 个通道,平衡负载。
- 加速器内部:MinSeed 和 BitAlign 流水线,双缓冲隐藏 MinSeed 延迟。
- 容量管理:scratchpad 不够时,分批处理 minimizer 和 seed。
一句话:
第 8.3 节讲的是 SeGraM 的系统级设计:用 4 个 HBM2E 栈、32 个独立加速器、每加速器独占一个内存通道来实现大规模并行;通过双缓冲、流水线和数据复制,隐藏传输和 seeding 延迟,让 BitAlign 全力做 alignment,从而高效完成 S2G 映射。