每引擎 Bundle 槽位基址映射
本页中的每个 bundle 位位置、槽位基址和地址,均从
libtpu-0.0.40-cp314wheel(BuildID md589edbbe81c5b328a958fe628a9f2207d)内的libtpu.so逐字节读取而来 — 来源是各个每槽位Encoder::Encode中BitCopy的目标位立即数。其他版本会有所不同。
摘要
本页是三个 SparseCore sequencer-engine bundle 的统一槽位基址索引。每个 SparseCore VLIW bundle — SCS(32 字节 / 256 位)、TAC(64 字节 / 512 位)、TEC(64 字节 / 512 位)— 都是一组固定槽位,由单个小端位打包器打包。各引擎页面(SCS、TAC、TEC)完整记录了每个槽位的内部字段模板和 opcode 名册;本页合并它们共享且重实现者最需要集中查看的一项内容:每个槽位的绝对 bundle 位基址、槽位顺序以及每代差异。它是 TensorCore LLO bundle 槽位映射的 SparseCore 对应物 — 一个跨引擎分区表,而不是对每个 opcode 的重新推导。
三个引擎的恢复方法一致,也正是它让位位置成为绝对位置。每个引擎的 codec dispatcher(SparseCore{Scs,Tac,Tec}CodecBase<…>::Encode)会依次调用每个每槽位 <Slot>Encoder::Encode,并把同一个输出缓冲区 absl::Span<uchar> 传给每一个调用(rdx=buf.ptr、rcx=buf.len 这对参数在所有调用中保持不变;只有 rdi 的成员 encoder 指针不同)。随后每个槽位 encoder 使用通用打包器 BitCopy(dst, dst_bitoff, src, src_bitoff, nbits)(0x1fa0a900)写入字段,因此 dst_bitoff 立即数(mov esi, IMM)是绝对 bundle 位,而不是相对槽位的位。一个槽位的位范围是在其所有 BitCopy 调用上取 [min dst_bitoff, max dst_bitoff + width);opcode 位是槽位相对 +16(标量)或 +24(向量)的字段。bundle 字节大小来自 EncoderBase::BundleSizeBytes(codec-metadata vtable 槽 6,vtable[+0x30]):SCS 32,TAC 64,TEC 64。
三张映射共享一个公共低位区域。SCS、TAC 和 TEC 都在 bits 7..191 放置同一组槽位栈 — 四个 20-bit immediate、一个 24-bit vector-scalar bridge,以及三个 27-bit scalar slot(ScalarMisc/ScalarAlu1/ScalarAlu0,基址为 111/138/165,opcode 在 127/154/181)。bit 191 以上各引擎开始分化:SCS 填充到 256 位,TAC 将其余 320 位留空(没有向量路径),TEC 则填入向量计算区域(gfc 上 bits 195..474),这是另外两个引擎留空的部分。Dma 和 Stream “槽位”在任何引擎上都不是独立物理区域 — 它们是某个标量 lane 的 oneof 形式(opcode @181/@154),借用更低的 payload 位(并且在 TEC 上延伸到 bits 283/322)。本页给出统一分区;字段级模板和 opcode 名册位于各引擎页面以及 scalar/vector opcode-enum 页面。
这是一个参考索引页,而不是可直接重实现的算法;bundle 本身的重实现契约位于各引擎页面。本页保证:
- 每个引擎上每个槽位的绝对槽位位基址,集中在一张跨引擎表中,并由反编译锚定。
- 固定槽位顺序(三个引擎的低位区域相同;TEC 向量区域在 bit 191 以上)。
- 每代差异(VF/GL/GF):哪些槽位存在、TEC vector-ALU 宽度增长,以及引擎名册(TAC 是否存在)。
| 已映射引擎 | SCS(seq 3,32 B) · TAC(seq 4,64 B,仅 VF/GL) · TEC(seq 5,64 B) |
| 位打包器 | BitCopy(dst, dst_bitoff, src, src_bitoff, nbits) 0x1fa0a900(小端) |
| 位位置含义 | 绝对位置 — dispatcher 将同一个缓冲区 Span 传给每个槽位 encoder |
| 公共低位区域 | bits 7..191 — 4×20-bit immediates + VectorScalar + Misc/Alu1/Alu0,三个引擎完全相同 |
| 标量 opcode 位 | @127(Misc) · @154(Alu1) · @181(Alu0)— base+16;三个引擎相同 |
| TEC 向量 opcode 位(GF) | Result @239 · Load @283 · Store @353 · Alu2/1/0 @388/425/462 |
| Bundle 大小 | SCS 32 · TAC 64 · TEC 64(codec-metadata vtable[+0x30]) |
| 校验尾部 | 所有 SC bundle 都没有(无 0x55);全零 bundle = NOP |
统一槽位基址表
如何阅读
下表是跨引擎分区:每行一个槽位,每个引擎列给出绝对 bundle 位基址和结束位置(em-dash 表示该引擎上不存在该槽位)。三个引擎共享低位区域(bits 7..191),逐字节相同;各列只在 bit 191 以上分化。opcode 位(如果该槽位有)会显示在后续的每引擎映射中;在这张统一表中,标量槽位的 opcode 位是 base + 16,TEC 向量槽位则使用给出的值。
注意 — 位位置是绝对的,不是相对槽位的。 因为 dispatcher 把同一个缓冲区
Span传给每个槽位 encoder,本页的位号就是绝对 bundle 位:@181就是标量 lane 0 的 opcode 字段 bundle 位基址,仅此而已。重实现者组合 bundle 时,应在每个槽位的绝对基址写入;不存在需要额外相加的每槽位原点。
跨引擎映射
| Slot | SCS (32 B) | TAC (64 B, VF/GL) | TEC (64 B) | Width |
|---|---|---|---|---|
| (保留头部) | 0..6 | 0..6 | 0..6 | 7 |
Immediates(低) | 7..86 | 7..86 | 7..86 | 80 |
VectorScalar(bridge) | 87..110 | 87..110 | 87..110 | 24 |
ScalarMisc(op @127) | 111..137 | 111..137 | 111..137 | 27 |
ScalarAlu1(lane 1,op @154) | 138..164 | 138..164 | 138..164 | 27 |
ScalarAlu0(lane 0,op @181) | 165..191 | 165..191 | 165..191 | 27 |
Immediates(高,2×20-bit) | — | — | 195..234 | 40 |
VectorResult(op @239) | — | — | 239..260 | 22 |
VectorExtended(op @261) | — | — | 261..461 | ~201 |
VectorLoad(op @283) | — | — | 283..321 | 39 |
VectorStore(op @353) | — | — | 328..363 | 36 |
VectorAlu2(lane 2,op @388) | — | — | 364..400 | 37 |
VectorAlu1(lane 1,op @425) | — | — | 401..437 | 37 |
VectorAlu0(lane 0,op @462) | — | — | 438..474 | 37 |
| (保留 / 填充) | 192..255 | 192..511 | 475..511 | — |
Dma(lane 的 oneof) | 87..191 | 87..191 | 87..327 | — |
Stream(lane 的 oneof) | 99..191 | 99..191 | 99..327 | — |
特殊点 — Dma 和 Stream 不是独立槽位;它们是标量 lane 的 oneof 形式。 在每个引擎上,DMA 或 Stream 指令都会把 opcode 写入某个标量 lane 的 opcode 字段(
@181lane 0,@154lane 1),并把多字描述符溢出到更低的 payload 位(在 TEC 上还会溢出到更高位)。不存在物理上独立的“DMA 区域”。如果重实现者为它分配一个独立区域,就会重复占用 lane 和 immediate 位。SCS/TAC Dma 描述符保持在 bits 87..142;TEC Dma/Stream 会延伸到 bits 283/322(与向量 load/store 区域重叠 — 见 TEC map)。易错点 — 槽位位是引擎无关的;引擎由属性选择,而不是由 bundle 选择。
ScalarAlu0的 opcode@181在 SCS、TAC 和 TEC 上占用完全相同的位字段,并消费完全相同的SparseCoreScalarAluproto enum。bundle 位中没有任何内容命名引擎。引擎由外围 outlined function 上的sc.sequencer字符串属性("scs"/"execute")固定,再回读以选择每引擎 codec(TpuSequencerType{3=SCS, 4=TAC, 5=TEC})。见 Region → Sequencer Outliner。
SCS Bundle 映射(32 字节 / 256 位)
这是最窄的 bundle,也是三个 SC 世代(Viperfish/vfc、Ghostlite/glc、gfc)中唯一逐字节相同的 bundle。没有槽位 encoder 写入 bit 7 以下或 bit 191 以上;bits 0..6 是保留/头部前缀,192..255 是填充。完整文档见 SCS (Scalar) Engine;槽位基址如下:
SCS bundle — 32 bytes / 256 bits (VF / GL / GF identical)
bit: 0 7 87 111 138 165 192 255
┌────┬──────────────┬────────┬────────┬────────┬────────┬──────────┐
│rsvd│ Immediates │ Vector │ Scalar │ Scalar │ Scalar │ reserved │
│7b │ 4×20-bit │ Scalar │ Misc │ Alu1 │ Alu0 │ / pad │
│hdr │ @7/27/47/67 │ bridge │ op@127 │ op@154 │ op@181 │ 64 bits │
└────┴──────────────┴────────┴────────┴────────┴────────┴──────────┘
24-bit 27-bit 27-bit 27-bit
Dma (oneof of lane): opcode @181/@154, descriptor payload @87..142
Stream(oneof of lane): opcode @181/@154, descriptor payload @99..142| Slot | Base | End | Width | Opcode bit |
|---|---|---|---|---|
| (保留头部) | 0 | 6 | 7 | — |
ScalarImmediates | 7 | 86 | 80 | — |
VectorScalar | 87 | 110 | 24 | — |
ScsScalarMisc | 111 | 137 | 27 | 127 |
ScalarAlu1 | 138 | 164 | 27 | 154 |
ScalarAlu0 | 165 | 191 | 27 | 181 |
| (保留 / 填充) | 192 | 255 | 64 | — |
反编译交叉校验 — gfc SparseCoreScalarAlu0Encoder::Encode(0x1eb693c0)在 165(x0, w5)、170(ScalarY, w6)、176(x1, w5)、181(opcode, w6)以及 predication header 187/190/191 处写入其 BitCopy 目标位 — 正好是槽位基址 165 处的 27-bit 标量模板。encoder dispatcher 是 gfc SparseCoreScsCodecBase::Encode(0x1391ef60)。
TAC Bundle 映射(64 字节 / 512 位,仅 VF/GL)
这是一个 64-byte bundle,复用 SCS 低位区域(bits 7..191),并将上方 320 位留空 — TAC 没有向量路径,因此它的宽度用于并发标量地址操作并行,而不是向量计算。它只存在于 Viperfish(vxc.vfc)和 Ghostlite(gxc.glc);在 gfc 上不存在(TAC codec 在那里只作为独立 legacy 路径保留 — 见 Per-Generation Deltas)。完整文档见 TAC Engine;槽位基址如下:
| Slot | Base | End | Width | Opcode bit |
|---|---|---|---|---|
ScalarImmediates | 7 | 86 | 80 | — |
VectorScalar | 87 | 110 | 24 | — |
ScalarMisc | 111 | 137 | 27 | 127 |
TacScalarAlu1 | 138 | 164 | 27 | 154 |
TacScalarAlu0 | 165 | 191 | 27 | 181 |
Dma(lane 的 oneof) | 87 | 191 | — | 181 / 154 |
TacStream(lane 的 oneof) | 99 | 191 | — | 181 / 154 |
| (保留 / 填充) | 192 | 511 | 320 | — |
反编译交叉校验 — glc TacScalarAlu0Encoder::Encode(0x1ea17e40)在 165/170/176/181/187/191 处写入其 BitCopy 目标位,与 SCS ScalarAlu0 槽位逐字节相同。扫描 TacScalarAlu0(0x1ea17e40)、TacScalarAlu1(0x1ea2a7a0)、TacStream(0x1ea338e0)以及共享的 SparseCoreDmaEncoder(0x1ea09b40)中的 BitCopy 立即数后可见,任何 TAC 槽位写入的最高位都是 191 — 512-bit bundle 的上方 320 位纯粹是填充。
特殊点 — TAC 宽 64 字节但没有计算。 如果重实现者根据“是否为 64-byte bundle”来决定缓冲区大小,就会错误地假定 tile-fetch 程序拥有并不存在的向量能力,从而过度预留。这个宽度服务于标量地址操作并行,而不是 64-byte TEC bundle 所使用的向量槽位。
TEC Bundle 映射(64 字节 / 512 位,GF) {#tec-bundle-map-64-bytes--512-bits-gf}
这是唯一拥有向量路径的 SC 引擎。低位区域(bits 7..191)与 SCS 是同一套槽位栈;bit 191 以上是向量计算区域(gfc 上 bits 195..474),SCS 和 TAC 会将其留空:先是另外两个 20-bit immediate 槽位,随后是 VectorResult、VectorExtended、VectorLoad、VectorStore 和三个堆叠的 vector-ALU lane。完整文档见 TEC (Vector) Engine;槽位基址(gfc)如下:
TEC bundle — 64 bytes / 512 bits (gfc)
bit: 0 7 87 111 138 165 195 239 261 283 328 364 401 438 475 511
┌───┬──────────┬────┬───┬───┬───┬──────┬─────┬─────────┬──────┬─────┬────┬────┬───────┬──────┐
│rsv│Immed.(low│Vec │Sc │Sc │Sc │Immed.│Vec │ Vector │Vector│Vec │Vec │Vec │Vector │rsvd/ │
│ │4×20b │Scal│Mis│Al1│Al0│(high)│Resul│Extended │Load │Store│Alu2│Alu1│Alu0 │pad │
│ │@7/27/47..│brdg│@12│@15│@18│@195..│@239 │ scan/ │@283 │@353 │@388│@425│@462 │ │
└───┴──────────┴────┴───┴───┴───┴──────┴─────┴ sort────┴──────┴─────┴────┴────┴───────┴──────┘
◄──────── SCS low region (7..191, identical) ────────►◄──────── TEC vector region (195..474) ────────►
TecDma (oneof of lane): scalar opcode @181, high payload @283/@322
TecStream(oneof of lane): scalar opcode @181/@162, high payload @283/@322| Slot | Base | End | Width | Opcode bit |
|---|---|---|---|---|
| (保留头部) | 0 | 6 | 7 | — |
Immediates(低) | 7 | 86 | 80 | — |
VectorScalar | 87 | 110 | 24 | — |
ScalarMisc | 111 | 137 | 27 | 127 |
ScalarAlu1 | 138 | 164 | 27 | 154 |
ScalarAlu0 | 165 | 191 | 27 | 181 |
Immediates(高) | 195 | 234 | 40 | — |
VectorResult | 239 | 260 | 22 | 239 |
VectorExtended | 261 | 461 | ~201 | 261 |
VectorLoad | 283 | 321 | 39 | 283 |
VectorStore | 328 | 363 | 36 | 353 |
VectorAlu2 | 364 | 400 | 37 | 388 |
VectorAlu1 | 401 | 437 | 37 | 425 |
VectorAlu0 | 438 | 474 | 37 | 462 |
| (保留 / 填充) | 475 | 511 | 37 | — |
TecDma(lane 的 oneof) | 87 | 327 | — | 181; 283/322 |
TecStream(lane 的 oneof) | 99 | 327 | — | 181/162; 283/322 |
反编译交叉校验 — gfc TEC 槽位 encoder 将它们的 BitCopy 目标位精确写在上述基址:
SparseCoreImmediatesEncoder 0x1ecd1760 → 7, 27, 47, 67, 195, 215 (6 × 20-bit)
SparseCoreTecVectorResultEncoder 0x1ecbc9e0 → 239 (op), 245, 251, 253, 256, 259, 260
SparseCoreTecVectorLoadEncoder 0x1ecb9ee0 → 283 (op) .. 321
SparseCoreTecVectorStoreEncoder 0x1eccbe20 → 328 .. 353 (op) .. 363
SparseCoreTecVectorAlu2Encoder 0x1ec85ae0 → 364/370/376/382 (sel), 388 (op), 396/399/400 (pred)
SparseCoreTecVectorAlu0Encoder 0x1ec11100 → 438/444/450/456 (sel), 462 (op), 470/473/474 (pred)特殊点 — 六个 immediate 槽位被标量栈隔开,但组成同一个索引数组。 四个 20-bit 槽位位于标量 lane 下方(bits 7..86),另外两个位于上方(bits 195/215),中间隔着 81-bit 标量槽位栈。它们是单个 6-entry 数组(
EmitImmediate(slot_index 0..5, value)),按递减 bundle 位顺序打包(idx0→@67 … idx3→@7;idx4→@215,idx5→@195)。低四个也存在于 SCS;高两个仅 TEC 拥有。见 TEC §Immediate-Slot Indexing。特殊点 — TEC Dma/Stream 槽位会延伸到向量区域。 不同于 SCS/TAC(描述符局限在 bits 87..142),TEC Dma/Stream 槽位会把它的高位描述符字段溢出到 bits 283/322,与向量 load/store 区域重叠 — 这就是单个 TEC bundle 同时发出 tile-fetch DMA 和消费它的向量 load 的方式。
IndirectVregStream的 indirect-offset 字段落在 bundle bit 322。如果重实现者把 TEC Stream 描述符限制在低位区域,就会重复占用向量槽位。
槽位顺序和内部模板
槽位顺序
槽位栈从一个 7-bit 保留前缀开始向上增长。到 bit 191 为止,顺序固定并由三个引擎共享:
bit 0 reserved/header prefix (7 bits; no slot writes here)
bit 7 Immediates — 4 × 20-bit, packed descending (idx3@7, idx2@27, idx1@47, idx0@67)
bit 87 VectorScalar — 24-bit scalar→vector bridge
bit 111 ScalarMisc — 27-bit scalar slot (opcode @127)
bit 138 ScalarAlu1 — 27-bit scalar slot (opcode @154)
bit 165 ScalarAlu0 — 27-bit scalar slot (opcode @181)
─── above bit 191: engine-specific ───
SCS: 192..255 padding (bundle ends at 256 bits)
TAC: 192..511 padding (no vector path; bundle ends at 512 bits)
TEC: 195 Immediates (high) — 2 × 20-bit (idx5@195, idx4@215)
239 VectorResult (opcode @239)
261 VectorExtended (opcode @261; spans to ~461, overlapping Load/Store/Alu)
283 VectorLoad (opcode @283)
328 VectorStore (opcode @353)
364 VectorAlu2 (opcode @388)
401 VectorAlu1 (opcode @425)
438 VectorAlu0 (opcode @462)
475..511 padding注意 —
VectorExtended(261..461)按设计与 load/store/ALU 槽位重叠。 extended 槽位的位范围包含VectorLoad、VectorStore和三个 vector-ALU lane。这是一种 oneof 式共享:发出 scan/sort/uniquify op(embedding-reduce 原语)的 bundle 使用 extended 区域,而不是使用该范围中的常规向量 lane。261..461 内部的字段级绑定已作为槽位范围恢复,但尚未穷尽命名;见 VectorExtended (VEX)。
27-bit 标量槽位模板(三个引擎通用)
所有标量槽位 — SCS/TAC/TEC 上的 ScalarMisc、ScalarAlu1、ScalarAlu0,以及 Dma/Stream 的标量 lane 部分 — 共享一个内部模板;只有槽位基址不同。槽位相对偏移(绝对位置 = slot_base + offset):
27-bit scalar slot
+0 w5 operand x0 scalar-register selector
+5 w6 ScalarY scalar-register-or-immediate selector
+11 w5 operand x1 scalar-register selector
+16 w6 OPCODE 6-bit primary opcode (≤ 64 ops)
+22 w3 normal_predication (overlaps rotate_predication below)
+22 w4 rotate_predication 4-bit when is_rotate (16-entry ring)
+25 w1 predication_inversion
+26 w1 is_rotate_predicationopcode 位由 base + 16 得出:ScalarMisc @127,ScalarAlu1 @154,ScalarAlu0 @181。完整名册见 Scalar Opcode Enum;predication header 见 M-Register Predicate Word。
37-bit TEC vector-ALU 槽位模板(GF)
三个 TEC vector-ALU lane 共享一个模板;只有槽位基址不同。槽位相对偏移(gfc):
37-bit vector-ALU slot (gfc)
+0 w6 VREG operand selector 0
+6 w6 VREG operand selector 1
+12 w6 VREG operand selector 2
+18 w6 VREG operand selector 3
+24 w8 OPCODE 8-bit (≤ 256 — matches the 257-op gfc set)
+32 w3 normal_predication (overlaps rotate_predication below)
+32 w4 rotate_predication 4-bit when is_rotate
+35 w1 predication_inversion
+36 w1 is_rotate_predicationopcode 位由 base + 24 得出:VectorAlu2 @388,VectorAlu1 @425,VectorAlu0 @462。完整名册见 Vector Opcode Enum。
注意 — predication header 是 3-bit/4-bit 重叠,而不是两个不同字段。 在两个模板上,
normal_predication(3 位)和rotate_predication(4 位)共享同一个起始位;1-bitis_rotate_predication选择解释方式。应分配 4 个具有两种含义的位,而不是 3+4 个不同位。
每代差异 {#per-generation-deltas}
低位区域(bits 7..191)和标量模板在三个世代中逐字节相同。差异集中在引擎名册(TAC 是否存在)以及 TEC 向量区域的宽度。
| Mechanism | VF (vfc) | GL (glc) | GF (gfc) |
|---|---|---|---|
| SCS bundle size / layout | 32 B / fixed | 32 B / fixed | 32 B / fixed |
| TAC bundle | 64 B(仅低位区域) | 64 B(仅低位区域) | —(无 TAC) |
| TEC bundle size | 64 B | 64 B | 64 B |
| Scalar slot width / opcode width | 27 b / 6 | 27 b / 6 | 27 b / 6 |
| Scalar lane bases (Misc/Alu1/Alu0) | 111/138/165 | 111/138/165 | 111/138/165 |
| Stream/Dma opcode @ bundle bit | 181/154 | 181/154 | 181/154 |
| TEC immediate slots | 6 (4+2) | 6 (4+2) | 6 (4+2) |
| TEC VectorAlu slot width / opcode width | 36 b / 7 | 37 b / 8 | 37 b / 8 |
| TEC VectorAlu lane bases (v2/v1/v0) | (≈) 358/395/432 | 364/401/438 | 364/401/438 |
| TEC VectorAlu opcode count | 148 | 229 | 257 |
| TEC vector predication header | 单一(rotate + inversion) | 双通道 | 双通道 |
特殊点 — TEC vector-ALU 宽度在 Viperfish 和 Ghostlite 之间跨过了 7-bit 上限。 Viperfish 的 148-op vector-ALU 集合刚刚超过 128(最高 op 折入保留编码),因此它的 opcode 字段是 7 位,槽位为 36 位。Ghostlite 的 229-op 集合迫使该字段变为 8 位、槽位变为 37 位,使 GF 向量 lane 上移约 6 位(VF Alu0 base 432 → GF Alu0 base 438)。反编译交叉校验:vfc
VectorAlu0(0x1e954ae0)在432/438/444/450写入其 VREG selector,在456(= 432+24,7-bit)写入 opcode,并在463/467写入单通道 predication header — 这是较窄的 36-bit 形式。gfcVectorAlu0(0x1ec11100)在438/444/450/456写入 selector,在462(8-bit)写入 opcode,并在470/473/474写入 header — 这是较宽的 37-bit 形式。注意 — TAC bundle 布局由 legacy codec 路径生成,而不是由 outliner 生成。 region→sequencer outliner 在任何代上都不会发出
"access"(TAC)函数:它的每 op 回调(0x136066e0)无条件标记sc.sequencer="execute",而 lowering 链中不存在任何HasAccessSequencerTypeAttribute/ 长度为 6 的"access"谓词。TAC codec(SparseCoreTacCodecBase,TpuSequencerType=4,glc)只作为 legacyProgramWrapper.tacproto 字段的独立 encoder 保留下来;MLIR tile-task pipeline 永远不会到达它。上面的 TAC bundle 布局是真实的 glc/vfc TAC 槽位映射,但它由该 legacy codec 路径产生。完整字节级说明见 TEC engine。
未映射内容
- 每个 SC bundle 的 7-bit 保留前缀(bits 0..6) 没有被任何槽位 encoder 写入。codec 是否在 epilogue 中设置 version/valid nibble 尚未解码(SC bundle 不携带
0x55check trailer,不同于 TensorCore bundle)。gfc NOP-bundle 的最后一个字节0x50可能是一个 4-bit framing 字段 — 未确认。 - 尾部填充(SCS 192..255;TAC 192..511;TEC 475..511)没有被任何槽位 encoder 写入;codec epilogue 是否触碰它尚未确认。
VectorScalar(87..110)和VectorExtended(261..461)内部的逐位字段标签 — 槽位基址和范围已经恢复,但这些区域内每个 op 的 operand-to-selector 绑定尚未穷尽命名。- 完整的 VF TEC 向量区域槽位映射 — 只有
VectorAlu0在 VF 上经过位确认(0x1e954ae0,base 432,锁定 36-bit / 7-bit-opcode 差异);VF 的VectorLoad/Store/Extended/Result基址按 GF 的 −6-bit 偏移推得。 - decode 侧 struct→bundle 逆映射(
DecoderBase路径)没有重新抽取;这里的 encode 侧绝对位映射是权威的,decode-struct shift 与之保持一致。
函数映射
| Symbol | Address | Role |
|---|---|---|
BitCopy | 0x1fa0a900 | 小端位打包器(dst, dst_bitoff, src, src_bitoff, nbits) |
SparseCoreScsCodecBase::Encode (gfc) | 0x1391ef60 | SCS dispatcher;向每个槽位 encoder 传入共享 Span |
SparseCoreScalarAlu0Encoder::Encode (gfc) | 0x1eb693c0 | SCS lane 0;BitCopy bits 165/170/176/181/187/190/191 |
SparseCoreScsScalarMiscEncoder::Encode (gfc) | 0x1eb914a0 | SCS misc/sync,opcode @127 |
TacScalarAlu0Encoder::Encode (glc) | 0x1ea17e40 | TAC lane 0;BitCopy bits 165/170/176/181/187/191(= SCS) |
SparseCoreDmaEncoder::Encode (glc) | 0x1ea09b40 | TAC/SCS 共享的 Dma oneof-of-lane |
SparseCoreTecCodecBase::Encode (vfc) | 0x139328a0 | TEC dispatcher;向全部 14 个槽位 encoder 传入共享 Span |
SparseCoreImmediatesEncoder::Encode (gfc) | 0x1ecd1760 | 6 × 20-bit immediates @7/27/47/67/195/215 |
SparseCoreTecVectorResultEncoder::Encode (gfc) | 0x1ecbc9e0 | XRF-pop 槽位,opcode @239 |
SparseCoreTecVectorLoadEncoder::Encode (gfc) | 0x1ecb9ee0 | tile vector load,opcode @283 .. 321 |
SparseCoreTecVectorStoreEncoder::Encode (gfc) | 0x1eccbe20 | tile vector store,base 328,opcode @353 |
SparseCoreTecVectorAlu2Encoder::Encode (gfc) | 0x1ec85ae0 | vector lane 2,base 364,opcode @388/8 |
SparseCoreTecVectorAlu0Encoder::Encode (gfc) | 0x1ec11100 | vector lane 0,base 438,opcode @462/8;sel @438/444/450/456 |
SparseCoreTecVectorAlu0Encoder::Encode (vfc) | 0x1e954ae0 | 较窄的 VF lane 0,base 432,opcode @456/7 |
EncoderBase<…Scs…>::BundleSizeBytes (gfc) | 0x1e835260 | codec-metadata vtable[+0x30] → 32 |
EncoderBase<…Tec…>::BundleSizeBytes (gfc) | 0x1e8359e0 | codec-metadata vtable[+0x30] → 64 |
EncoderBase<…Tac…>::BundleSizeBytes (glc) | 0x1e832100 | codec-metadata vtable[+0x30] → 64 |
交叉引用
- SCS(标量)引擎 — 32-byte bundle、标量 opcode 名册,以及 SCS 列所依据的按属性发射模型。
- TAC 引擎 — 仅 VF/GL 的 64-byte bundle,它复用 SCS 低位区域;每代存在性以及 gfc 移除 TAC 的证据。
- TEC(向量)引擎 — 64-byte 向量 bundle、37-bit vector-ALU 模板、immediate-slot 索引,以及 access/execute 划分。
- 标量 Opcode Enum —
SparseCoreScalarAlu/SparseCoreScalarMisc名册,承载在@127/154/181处的 6-bit opcode 字段中。 - 向量 Opcode Enum — 每槽位、每代 TEC 向量 op 名册,承载在
@239/283/353/388/425/462处的 8-bit opcode 字段中。 - Region → Sequencer Outliner —
TileTaskOutliningPass,它标记sc.sequencer,从而选择某个函数要编码到哪个引擎 bundle(以及槽位映射)。 - SparseCore 概览 — 三个引擎类、每代存在性,以及
TpuSequencerTypecodec-template enum {3,4,5}。 - VectorExtended (VEX) — 宽
VectorExtended区域(bits 261..461)的字段级细节,本页只将其记录到槽位范围粒度。 - M-Register Predicate Word — 覆盖每个标量和向量槽位顶部的 predication header。
- Binary:
extracted/libtpu-0.0.40-cp314-cp314-manylinux_2_31_x86_64/libtpu/libtpu.so(build-id89edbbe81c5b328a958fe628a9f2207d) - Index entry: Part IX — SparseCore & BarnaCore / SparseCore engines — 返回索引