Skip to content

内存存储槽

本页中的每个地址、位偏移、opcode 值和字符串都从 libtpu-0.0.40-cp314 wheel 中的 libtpu.so 逐字节读取(BuildID md5 89edbbe81c5b328a958fe628a9f2207d,未 strip,包含完整 C++ 符号)。.text/.rodata 映射满足 VA == file offset。其他 wheel 版本会有所不同。

摘要

内存存储槽是在单个 VLIW 发射字中把计算寄存器写出到片上内存的 bundle 槽,也就是 内存加载槽 的写侧镜像。它不同于片内 DMA:store slot 在一个 bundle 周期内把一个向量寄存器移入 VMEM(或把一个标量寄存器移入 SMEM),而 DMA 通过描述符移动 tier→tier 的块。与加载槽一样,它不携带 tier 选择位;目标 tier 由 (slot, sub-opcode) 决定。

存储槽是一个判别联合,其 sub-opcode 同时选择目标 tier 和寻址模式。每代的 <Bundle><Slot>StoreEncoder::Encode(<msg> const&, absl::Span<uint8_t>) 是规范字节编解码器;在 Pufferfish 以及所有 V5+ 代上,每个字段都通过一次通用位打包器 BitCopy(dst, bit_offset, src, 0, width) 写入。本页所有位位置均为 LSB-first(与 Bundle Model 一致):bit 0 是 byte 0 的最低有效位,字面量 bit_offset 参数就是绝对的、按 LSB 编号的 bundle 位,因此可直接从 encoder 反汇编读出 store-slot 字段图,而无需反向换算移位。store-data 源寄存器总是先写入;随后 sub-opcode 判别符(TensorCore store 中从 proto +0x50 读取,V5e/V6e SparseCore-TEC store 中从 +0x50/+0x58 读取)选择后续的寻址字段。

两个结构事实主导了各代差异。第一,store 槽是 load 槽的读写孪生体:相同的专用 bundle 槽、相同 TensorCoreCodecBase 模板中的成对 Encoder/Decoder、相同的寻址模式分类(base+offset、base-register NoOffset、strided、indexed/scatter),但带有三个仅写侧新增项:sublane/vmask 写使能、SparseCore reduce-add(读-改-写)家族,以及 vector-store fence 排序屏障。第二,各代增量是具体的:bundle 从 41 → 51 → 64 字节;Pufferfish 新增 CMEM-store 和 8 个硬件 vmask 寄存器;Viperfish 将 store-data 字段从 5 → 4 位缩小,同时将 base/offset 从 5 → 6 位扩大,并新增带 reduce-add 的 SparseCore TEC tile-SPMEM store;Ghostlite 将写端口从 1 → 2 翻倍;6acc60406 将 store-fence 移入 misc 槽,并达到包含 atomic SMEM stores 的 34-sub-op SparseCore store 家族。

对重新实现而言,契约是:LloOpcodeIsVectorStore opcode 窗口、各代 store Encoder/Decoder 地址表、PF/VF/GFC 的 BitCopy 绝对位字段图、slot-selects-tier 模型、两个正交的掩码机制(bundle predicate 与 vmask),以及各代差异。

槽作用将一个寄存器量的数据移入 VMEM/CMEM/SPMEM(向量)或 SMEM(标量)
Tier 选择(slot, sub-opcode) 决定(无 tier 位)
PXC store encoderpxc::isa::TensorCoreVectorStoreEncoder::Encode @ 0x1ee3b440(51-B bundle)
VXC store encodervxc::isa::TensorCoreVectorStoreEncoder::Encode @ 0x1f01ff60(64-B bundle)
GFC store encodergxc::gfc::isa::TensorCoreVectorStoreEncoder::Encode @ 0x1fa08920(64-B bundle)
JF store encoderjellyfish::isa::EncoderJf::EncodeVectorStoreInstruction @ 0x1e868c40(41-B,单体式)
位原语BitCopy(dst, abs_bit, src, 0, width)abs_bit == 绝对 bundle 位(PF/V5+)
Opcode 分类器xla::jellyfish::LloOpcodeIsVectorStore @ 0x14024920 → 窗口 {63,64,65,68,69,70} + 460
Store-data 字段JF/PF 上为 5-bit,VF/GL/GFC 上为 4-bit;base/offset 在 v5 从 5-bit → 6-bit
写端口MaxVectorStoreSlots = JF/PF/VF 上为 1,GL/GFC 上为 2

Store 操作列表(LLO Opcodes)

LloOpcode enum 中的 store 家族(内部 k 前缀名称;proto LloOpcodeProtoOPCODE_ 前缀名称):

LloOpcode internalLloOpcodeProto name目标 tier
kVectorStoreOPCODE_VECTOR_STOREVMEMVECTOR_STORE
kVectorStoreMaskedOPCODE_VECTOR_STORE_MASKEDVMEM(masked)VECTOR_STORE
kVectorStoreIndexedOPCODE_VECTOR_STORE_INDEXEDVMEM(scatter)VECTOR_STORE
kVectorStoreIndexedMaskedOPCODE_VECTOR_STORE_INDEXED_MASKEDVMEM(scatter+mask)VECTOR_STORE
kVectorStoreSublaneShuffleOPCODE_VECTOR_STORE_SUBLANE_SHUFFLEVMEM(shuffled)VECTOR_STORE
kVectorStoreEvenOddSublanesOPCODE_VECTOR_STORE_EVEN_ODD_SUBLANESVMEM(even/odd)VECTOR_STORE
kVectorStoreFenceOPCODE_VECTOR_STORE_FENCE(排序屏障)VECTOR_MISC(GFC)
kVectorCmemStoreOPCODE_VECTOR_CMEM_STORECMEMVECTOR_STORE
kVectorCmemStorePseudoOPCODE_VECTOR_CMEM_STORE_PSEUDOCMEM(pseudo)VECTOR_STORE
kBarnaCoreVectorStoreOPCODE_BARNA_CORE_VECTOR_STOREBarnaCore VMEM(BCS channel)
kScalarStoreOPCODE_SCALAR_STORESMEMSCALAR_0/1

分类器 xla::jellyfish::LloOpcodeIsVectorStore(@ 0x14024920)逐字节精确:当 (opcode - 63) <= 7 && _bittest(0xE7, opcode - 63) opcode == 460 时返回 true。0xE7 = 0b1110_0111 选择偏移 {0,1,2,5,6,7},即内部 opcodes {63,64,65,68,69,70}460。Scalar-store、CMEM-store 和 BarnaCore-store 由独立谓词分类。

注意 — vector-store fence 不是 store;它是排序屏障。在 6acc60406 上,它编码于 VectorMisc 槽(gxc::gfc::isa::TensorCoreVectorMisc0Compact::vector_store_fence accessor),而不是 store 槽。bundle packer 的 RequiresVectorStoreFence(@ 0x14020900)由 Target::SupportsVectorStoreFence() 门控。参见 各代差异


Store-Slot Encoder/Decoder 地址表

每代都有一个 <Bundle><Slot>StoreEncoder::Encode 和匹配的 <…>StoreDecoder::Decode。decoder 是 encoder 的对称逆 BitExtract

TensorCore vector-store 槽

NamespaceEncode @Decode @
Jellyfishjellyfish::isa::EncoderJf::EncodeVectorStoreInstruction0x1e868c40(在 DecoderJf 中成对)
Pufferfishpxc::isa::TensorCoreVectorStore{En,De}coder0x1ee3b4400x1ee2dae0
Viperfishvxc::isa::TensorCoreVectorStore{En,De}coder0x1f01ff600x1f01a560
Ghostlitegxc::glc::isa::TensorCoreVectorStore{En,De}coder0x1f3c32000x1f3bd780
6acc60406gxc::gfc::isa::TensorCoreVectorStore{En,De}coder0x1fa089200x1fa02f00

Jellyfish 的 TensorCore store 不是独立 codec 类;它是单体式 EncoderJf::EncodeVectorStoreInstruction(VectorStoreInstruction const&, Bundle const&)(@ 0x1e868c40),会内联填充槽位。

SparseCore TEC tile-SPMEM store 槽(仅 V5+)

NamespaceEncode @Decode @
Viperfishvxc::vfc::isa::SparseCoreTecVectorStore{En,De}coder0x1e9c27600x1e9bbf40
Ghostlitegxc::glc::isa::SparseCoreTecVectorStore{En,De}coder0x1eb50ac00x1eb42300
6acc60406gxc::gfc::isa::SparseCoreTecVectorStore{En,De}coder0x1eccbe200x1ecbd7a0

没有 Jellyfish/Pufferfish SparseCore TEC store;SparseCore TEC sequencer 仅从 Viperfish 开始存在。BarnaCore channel vector-store(仅 Pufferfish)是 pxc::pfc::isa::BarnaCoreChannelVectorStore{En,De}coder(Encode 0x1e8c5640,Decode 0x1e8c4d40)。

Scalar-store 槽(SREG → SMEM)

通过 scalar-slot encoder 路由,而非 vector-store 槽。Jellyfish:ScalarStoreOperands proto,由 EncoderJf::EncodeScalarInstruction(@ 0x1e862060)发出。Pufferfish:TensorCoreScalar1_ScalarStoreSmemAbsolute 经由 ScalarYEncode(@ 0x1c471c60)+ SetImmOrDie(@ 0x1c550660);BarnaCore-sequencer 变体经由 0x1c471fc0/0x1c550e00。Viperfish/Ghostlite:…ScalarAlu_ScalarStoreXToSmemY6acc60406 新增 …ScalarStoreXToSmemSumDestAndY(atomic add)、…ScalarStoreCircularBufferSmemFetchAndAdd(通过 EmitFetchAndAddOp @ 0x13a3a300)。


Store 槽在 Bundle 中的位置

store 槽是各代 VLIW bundle 中的一个固定槽;槽顺序是各代 TensorCoreCodecBase<…> 模板参数顺序:

text
ScalarAlu0 / ScalarAlu1 / [Predicates] / Immediates / VectorScalar /
Dma / VectorAlu0 / VectorAlu1 / [VectorAlu2 / VectorAlu3] /
**VectorStore** / VectorLoad0 / [VectorLoad1] / VectorMisc /
VectorExtended0 / [VectorExtended1] / VectorResult0 / [VectorResult1]

(Pufferfish 携带 VectorAlu0/1 + VectorStore + VectorLoad + CmemLoad + …。)槽枚举常量对其命名:isa::SLOT_VECTOR_STORE(TC)、isa::SLOT_SCALAR_0/1SLOT_SCALAR_ALU_0/1(scalar stores)、isa::SLOT_VECTOR_MISC(overlay 目标 / store fence)、llvm::TPU::SparseCoreMCSlot::SLOT_VSTSLOT_SST(SparseCore vector/scalar store)。Bundle 宽度:Jellyfish/Dragonfish 41 B,Pufferfish 51 B,V5+ TensorCore 64 B;SparseCore SCS 32 B,TEC 64 B。

在 Pufferfish 上,vector_store 槽占据绝对 bundle 位 142..166(见 Pufferfish 51B Bundle),与 119..140 的 vector_load 槽不重叠,因此一个 bundle 中可以同时存在 load 和 store。约束 "SCALAR_STORE_ABSOLUTE not allowed in slot 0." 强制 Jellyfish/Pufferfish 上的 scalar-store absolute 进入 SCALAR_1,绝不进入 SCALAR_0。计数谓词 store_and_misc_slots == module.target().MaxVectorStoreSlots() 将承载 store 的槽数量绑定到各代写端口数。


位字段布局(BitCopy 字段图)

每个 per-slot Encoder 都通过 BitCopy(dst, abs_bit, src, 0, width) 填充槽;store-data 源寄存器先写入,然后 sub-opcode 判别符选择寻址字段。下面的图直接采集自反编译 encoder 中的 BitCopy(a3, …) 调用点;第二个参数是绝对 bundle 位。

Pufferfish (PXC) TensorCoreVectorStore — Encode @ 0x1ee3b440(51-B bundle)

从 encoder 主体逐字节精确读取(BitCopy(a3, 162, …, 5) 等):

字段abs bitwidth含义
source vreg1625store-data vreg(proto +28);= 31 ⇒ NOOP(kNeverExecute
sub-opcode1575VmemStore=0 / CmemStore≠0 判别符
base address / Vmem offset1525VregNumber base
offset1493immediate-offset 槽索引
stride1472stride 选择
sublane-mask / vmask1452sublane/vmask 选择
(CMEM full-address words)304 / 288 / 27216CMEM 16-bit immediate address(仅 CmemStore)
(CMEM address regs)251 / 246 / 2415shared Y-register 选择器

PF store 槽区域(abs 142..166)与 Pufferfish 51B Bundle 页面完全一致。Sub-opcode dispatch(proto +0x50):0=Noop,5=NoopAlt,6=CmemStore,7=CmemStoreNoOffset,8=VmemStore,9=VmemStoreNoOffset,0xA-0x11=VmemStoreVmsk0..7,0x12=VmemStoreIndexed,0x13=VmemStoreIndexedNoOffset,0x14-0x1B=VmemStoreIndexedVmsk0..7,0x1C=SetIarLane,0x1D=SetIarSublane,0x1E=SetIarRaw,0x1F=PushV2s。共 32 个 sub-ops。

Viperfish (VXC) TensorCoreVectorStore — Encode @ 0x1f01ff60(64-B bundle)

逐字节精确(BitCopy(a3, 170, …, 4) 等):

字段abs bitwidth含义
source vreg1704store-data vreg(proto +28
sub-opcode discriminator1673addr-mode/family
secondary opcode / vmsk1634mask / sub-variant
base address / offset1576VregNumber base
stride (Base variants)1534stride 选择
(Base-variant field)1512
(trailing field)1483Vs select / mask
address / mask field1444

data-vreg @170 w4 和 base @157 w6 与 Viperfish 64B Bundle 页面完全一致。Sub-opcode dispatch(proto +0x50):0=Noop,5=VectorStore,6=VectorStoreBase,7=VectorStoreMasked,8=VectorStoreBaseMasked,9=VectorStoreShuffled,0xA=VectorStoreShuffledBase,0xB=VectorStoreShuffledMasked,0xC=VectorStoreShuffledBaseMasked,0xD=VectorStoreIndexed0,0xE=VectorStoreIndexed1,0xF=VectorStoreIndexed0Masked,0x10=VectorStoreIndexed1Masked,0x11-0x16=SetLaneIar0/1·SetSublaneIar0/1·SetRawIar0/1,0x17=PushV2s,0x18=SetPrng。共 25 个 sub-ops。

6acc60406 (GFC) TensorCoreVectorStore — Encode @ 0x1fa08920(64-B bundle)

逐字节精确(BitCopy(a3, 169, …, 2) 等):

字段abs bitwidth
sub-opcode top field1692
sub-opcode1663
secondary opcode1624
base address / offset1566
stride / mask1524
(Base-variant field)1502
(field)1473
(field)1434

Sub-opcode dispatch 与 Viperfish 相同。Ghostlite 的 TensorCoreVectorStoreEncoder(@ 0x1f3c3200)在结构上与 VXC/GFC 相同(相同 sub-op 集、相同模板),仅位偏移随代变化;其字段图未单独 dump — HIGH,基于模板一致性。

6acc60406 (GFC) SparseCoreTecVectorStore — Encode @ 0x1eccbe20(64-B TEC bundle)

逐字节精确(BitCopy(a3, 359, …, 3) 等),store 槽位于高位区域,是最丰富的 store 家族:

字段abs bitwidth
opcode3593(4 alt)
normal-predication3621
rotate-predication3631
base / source3536
offset3476
stride3403
mask3373
(field)3334

Sub-opcode dispatch(proto +0x4c,34 个 case):0=Noop,8=TileSpmemStore,9=TileSpmemStoreCircularBuffer,随后是 reduce-add 矩阵 — TileSpmemStoreAdd{S32,S16,F32,Bf16}*CircularBufferAdd**CircularBufferPostUpdateAdd*TileSpmemIndexedStore*IndexedCircularBuffer**IndexedAdd{S32,S16,F32,Bf16}**IndexedReturnValueAdd**IndexedCircularBufferReturnValueAdd{S32,S16,F32,Bf16}*。除上述共享位置外,每个变体内部字段宽度未穷尽 dump(HIGH)。

Jellyfish EncodeVectorStoreInstruction — @ 0x1e868c40(41-B bundle)

逐字节精确 dispatch:先编码 predication(switch 前调用 EncodePredication<VectorStoreInstruction>),然后 switch(*((_DWORD*)a2 + 12)),即 proto +12 处的 sub-opcode:

  • family A {0,6,0x10-0x17}:sublane-mask + stride store(EncodeVectorSublaneMaskEncodingEncodeVectorStrideEncoding)。
  • family B {1,7,0x18-0x1F}:offset + base + sublane-mask + stride store(EncodeVectorOffsetEncodingEncodeVectorBaseAddressEncoding,再加上上述两个)。
  • family C {2,3,4}:indexed store(SetIndexedAddressOperands,由 v36[3]&1 路由)。
  • case 5:NOOP。default"Not implemented yet." fatal。

per-field encoder 写入共享 immediate 槽:内部 switch(v12[8]) 的 case 0-3 选择 6 个 immediate 槽中的哪一个保存 5-bit register number,写在 Bundle bytes 31..39。store-data vreg 打包在 byte 22(5-bit)/ byte 13;TTU operand 位于 byte 19/63。41-byte bundle 内的绝对槽基址来自 Bundle byte map(LOW — 此处未钉住)。


寻址模式

四种寻址模式,由 sub-opcode 选择,与加载槽使用相同分类:

  • (a) base + immediate-offset(带 offset 的 VmemStore / VectorStore):base 是按粒度缩放的 VMEM 字节偏移;offset 是放入 immediate 槽的立即数。
  • (b) base + register-offsetVmemStoreNoOffset / VectorStoreBase):base 保存在 Vs 寄存器中,没有 immediate-offset 字段。Pufferfish PlaceVsRegister<BaseAddress, VmemStore> 会把 base 放入 3 个 Vs 槽之一。
  • (c) strided:每个 store 都携带 stride 字段。Pufferfish StrideToSyU32<VmemStore>(@ 0x1d2970a0)将 stride 编码为 Sreg number 或 U32 immediate(variant<SregNumber, ImmediateValueU32>);目标地址在各 sublane 之间按 stride 粒度移动。
  • (d) indexed / scatter(PXC 的 VmemStoreIndexed / VXC/GXC 的 VectorStoreIndexed0/1 / SC-TEC 的 TileSpmemIndexedStore):每 lane 目标地址来自通过 SetIar* 暂存的 index-address register(IAR);store 将 vector lanes scatter 到逐 lane 地址。VXC/GXC 有两个 index 端口(Indexed0/Indexed1)以支持两个共存 scatter 流;PXC 有一个。

IAR 由专用 store-slot sub-ops 设置:PXC 的 SetIarLane/SetIarSublane/SetIarRaw(cases 0x1C-0x1E);VXC/GXC 的 SetLaneIar0/1/SetSublaneIar0/1/SetRawIar0/1(cases 0x11-0x16)。保护条件 kVectorStoreEvenOddSublanesIar < target.IarsPerTensorCore() 确认 IAR 数量按代变化。


Memory-Tier 目标编码

目标 tier 由单个 VectorStore 槽内的具体 sub-opcode 选择(不是 tier 位):

目标 tierSub-op family / path
VMEMVmemStore*(PXC 8-0x1B)/ VectorStore*(VXC/GXC 5-0x10)
CMEMCmemStore/CmemStoreNoOffset(PXC cases 6-7;16-bit imm address @304/288/272)
SPMEMTileSpmemStore*(SparseCore TEC 槽)
SMEMScalarStoreSmemAbsolute/ScalarStoreXToSmemY(SCALAR/SCALAR_ALU 槽,不是 vector-store)
BarnaCore VMEMBarnaCoreChannelVectorStore(Pufferfish PFC channel 槽)

LLO opcode(kVectorStore vs kVectorCmemStore vs kScalarStore)从 IR 向下携带 tier 选择;各代 lowering 将其映射到匹配槽中的匹配 sub-opcode。这与加载槽使用的 slot-selects-tier 模型相同,基于运行时 MemorySpace Enum;SMEM tier 由 buffer-assignment 不变量 dest_address->memory_space() == MemorySpace::kSmem 断言。CMEM-store sub-ops 仅存在于 Pufferfish;更高代将 CMEM 折入 VMEM 类寻址,或通过 kVectorCmemStorePseudo lowering。


Store 粒度

store 每周期移动一个完整向量寄存器,并由以下机制调制:

  • SublaneMasksublane_mask proto 字段):逐 sublane 写使能。在 VXC/GXC 上,Masked sub-op 变体增加显式 mask;在 PXC 上,8 个 VmemStoreVmsk0..7 变体选择 8 个硬件 vector-mask 寄存器之一。
  • Even/odd-sublane splitkVectorStoreEvenOddSublanes):只存储偶数或奇数 sublanes(sublane-stride 2)— VXC/GXC 通过 sublane-stride 字段实现,Jellyfish 通过 family A 的 stride encoder 实现。
  • Indexed/scatter(逐 lane):最细粒度;每个 lane 从 IAR 写入独立地址。
  • Reduce-add(仅 SparseCore TEC,V5+):TileSpmemStoreAdd{S32,S16,F32,Bf16} — store-with-accumulate(SPMEM[addr] += vector),加上 circular-buffer post-update 和 return-value 变体。这是唯一会读取目标(读-改-写)的 store 家族。

除 sublane mask 和 stride 外,没有逐元素计数字段;store 总是处理完整 SIMD 宽度。验证字符串 "VectorStore mask length is not equal to target SIMD width." 强制 mask 覆盖准确的 lane/sublane 数量。


Masked / Predicated Store

两个正交的掩码机制:

  1. Bundle predication — 每个 store 槽都携带 predicate-register 引用(Jellyfish 上经 EncodePredication<VectorStoreInstruction> 为 5-bit;V5+ 上为 predication enum)。值 0..14 = predicate register,15 = kAlwaysExecute,31 = kNeverExecute(NOP);false predicate 抑制整个 store。proto 字段是 predication(PXC 上为 TensorcorePredication,glc/gfc 上为 Predication;SparseCore TEC 还额外拆分 normal_predication @362 和 rotate_predication @363)。
  2. Vector write-mask(sublane/vmask)— 逐 sublane(或逐 lane)写使能,独立于 bundle predicate。PXC 有 8 个硬件 vmask 寄存器(Vmsk0..7,sub-ops VmemStoreVmsk0..7VmemStoreIndexedVmsk0..7)。VXC/GXC 携带显式 mask 字段(TEC 上为 SparsecoreVectorMask)以及 Masked sub-op 变体。

Predicated store = bundle-predicate 门控;masked store = vmask/sublane 写使能。两者可同时应用(例如 predicated VmemStoreVmsk3)。


各代差异

属性JF (v2)PF (v4)VF (v5p)GL (v6e)GFC (TPU7x)
TC bundle width (B)4151646464
MaxVectorStoreSlots(写端口)11122*
NumVsSlots(读/base 端口)33444*
Store-data vreg 字段宽度55444
Base/offset 字段宽度55666
CanOverlayInMiscSlotfalse(n/a)a2==1truetrue*
硬件 vmask 寄存器仅 sublane8(Vmsk0..7mask fieldmask fieldmask field
Indexed/scatter 端口112(Idx0/1)22
CMEM store sub-opsnoyesnonono
SparseCore TEC tile-SPMEM storen/an/ayesyesyes(+RMW)
SPMEM reduce-add(S32/S16/F32/Bf16)n/an/ayesyesyes(34 sub-ops)
Scalar-store SMEM atomic addnonononoyes(SumDestAndY / FetchAndAdd)
SupportsVectorStoreFencefalsefalsefalsefalsemisc-slot

已验证的 target overrides:JellyfishTarget::MaxVectorStoreSlots=1(@0x1d4916a0),Pufferfish=1(@0x1d495be0),Viperfish=1(@0x1d49c0a0),Ghostlite=2(@0x1d498ca0)。CanOverlayInMiscSlot:Jellyfish=false(@0x1d491680),Ghostlite=true(@0x1d498c80)。SupportsVectorStoreFence 在 JF/PF/VF/GL 上为 false(@0x1d48f660/0x1d493fa0/0x1d499f00/0x1d497060)。Dragonfish (v3) 共享 Jellyfish codec。

结构差异:

  • v2→v4(JF→PF):bundle 41→51 B;新增 CMEM-store sub-ops;新增 8 个显式硬件 vmask 寄存器(VmemStoreVmsk0..7)。
  • v4→v5p(PF→VF):bundle 51→64 B;store-data 字段 5→4 位,同时 base/offset 5→6 位;TC 槽中移除 CMEM-store;新增 sublane-shuffle store;2 个 scatter index 端口;引入 SparseCore TEC tile-SPMEM store 家族(带 reduce-add)。
  • v5p→v6e(VF→GL)MaxVectorStoreSlots 1→2(两个 VMEM 写端口);CanOverlayInMiscSlot 完全为 true — store 槽可以 overlay misc 槽,共享 vmask(TensorCoreCodecBase 中的 CheckVectorStoreSlotAndMiscSlotShareVmsk)。
  • v6e→TPU7x(GL→GFC):store-fence 移入 VectorMisc compact message;scalar SMEM stores 获得 atomic add(ScalarStoreXToSmemSumDestAndYSmemFetchAndAdd);SparseCore TEC store 达到 34 个 sub-ops(完整 reduce-add + circular-buffer + indexed + return-value 矩阵)。

(*) 6acc60406(gfc)store 复用 gxc EncoderBase 模板;标记为 * 的 V5+ 属性值已通过 VF/GL 的 Target overrides 确认,gfc 专有值来自共享模板加已验证的 gfc store-encoder 位图(0x1fa08920)。


Load / Store 槽对称性与非对称性

store 槽是 内存加载槽 的结构镜像:

  • 镜像:两者都占用专用 bundle 槽(TC 上 SLOT_VECTOR_STORE/SLOT_VECTOR_LOAD;SparseCore 上 SLOT_VST/SLOT_VLD),通过相同 per-gen TensorCoreCodecBase 模板中的成对 Encoder/Decoder 类解码,并共享寻址模式分类(base+immediate-offset、base+register-offset NoOffset、strided、indexed)。SetIar* sub-ops 位于 store 槽,但其设置的 IAR 可被后续 indexed load 消耗,反之亦然。kVectorLoadkVectorStore 在内部 LloOpcode enum 中相邻(store 窗口从内部 opcode 63 开始)。
  • 非对称 1 — 端口数:load 有 NumVsSlots 读端口(3/3/4/4),store 有 MaxVectorStoreSlots 写端口(1/1/1/2)。VMEM 在 Ghostlite 将写端口翻倍前,一直是读宽、写窄。
  • 非对称 2 — 写使能:store 槽新增 sublane-mask/vmask 写使能,这是写侧概念,没有 load 对应物。
  • 非对称 3 — RMW:只有 store 侧拥有 SparseCore TEC reduce-add(读-改-写)家族。
  • 非对称 4 — fence:到同一 VMEM 区域的 store→load 排序由 vector-store fence 保护(RequiresVectorStoreFence @ 0x14020900IsVmemReadPrecededByVmemStoreFence @ 0x14020820)— store 后的 load 需要 fence;反向则不需要。

尚未钉住的内容

  • Jellyfish 41-B bundle 中 store 槽的绝对字节偏移。 V5+ BitCopy 偏移是 bundle 绝对位;Jellyfish per-field encoder 路由到共享 immediate 槽(Bundle bytes 31..39),其绝对基址需要完整 Jellyfish Bundle byte map。LOW。
  • 34 个 SparseCore-TEC reduce-add 内部字段宽度。 dispatch 和共享位置(359/353/347/340/337/333)已 CONFIRMED;每个 Add/CircularBuffer/ReturnValue 变体的内部宽度未穷尽 dump。HIGH。
  • Ghostlite glc store BitCopy 字段图 — 结构上与 vxc/gfc 相同(相同 sub-ops、相同模板),未单独 dump。HIGH。
  • kScalarStore/kVectorCmemStore/kBarnaCoreVectorStore/kVectorStoreFence 的完整 LloOpcode internal→proto 整数kVectorStore* 窗口 {63,64,65,68,69,70,460} 已 CONFIRMED;其他需要 ProtoToLloOpcode switch decode)。
  • 各代 Target::IarsPerTensorCore() 数值(门控 indexed-store IAR 数量)。LOW。

交叉引用

  • 内存加载槽 — 读侧镜像;共享寻址模式分类、IAR 共享以及上述 load/store 非对称性。
  • MemorySpace Enum — store 槽选择 tier 所基于的 17 值运行时 enum,以及 proto↔enum 重映射。
  • Bundle Model — 各代 bundle 宽度(41/51/64)以及此槽接入的槽分类。
  • Pufferfish 51B Bundle — PXC 上 vector_store 槽的绝对 bundle 位(142..166)。
  • Viperfish 64B Bundle — VXC/GLC/GFC store 槽所遵循的 V5+ per-slot Encoder::Encode + BitCopy 模型(data-vreg @170,base @157)。
  • MC-Emitter — MC 层 store mnemonics 和寄存器编码表。
  • Memory Subsystem Overview — store 槽写入的 tier 模型(HBM/VMEM/SMEM/CMEM/SPMEM)。