Qualcomm Hexagon NPU · Module 1
Hexagon SoC Architecture Internals
PhD-level reference on the Qualcomm Hexagon processor: scalar VLIW core, HVX vector unit, HTA/HMX tensor accelerators, hardware threading, memory hierarchy, ISA, SoC integration, and generational evolution from v65 to v75.
PhD-Level Reference Document Target Audience: Advanced engineers with C/C++ and computer architecture background Prerequisite Knowledge: VLIW processors, cache hierarchies, memory systems, DSP concepts
Table of Contents#
- Full Hexagon Processor Anatomy
- Hardware Threading Model
- Memory Hierarchy
- The Hexagon ISA
- Hexagon NPU within Snapdragon SoC
- Generational Differences (v65-v75)
- Self-Assessment Questions
1. Full Hexagon Processor Anatomy#
1.1 Processor Core Overview#
The Qualcomm Hexagon processor is a 32-bit very long instruction word (VLIW) digital signal processor with specialized vector and tensor acceleration units. The microarchitecture consists of multiple distinct execution pipelines and specialized compute engines operating in parallel under a unified instruction dispatch system.
Core Components:
Scalar Execution Engine (32-bit integer/floating-point)
- 6-stage integer pipeline
- Separate floating-point pipeline (IEEE 754 compliant)
- ALU, multiplier, shifter, logic units
HVX (Hexagon Vector eXtensions)
- 128-bit or 256-bit SIMD vector unit (generation dependent)
- Dual-port access to unified L2 cache
- Dedicated vector registers (32/64 128-bit registers)
HTA (Hexagon Tensor Accelerator) / HMX (Matrix eXtensions)
- Introduced in v68 and later
- Hardware acceleration for matrix operations
- INT8/FP16/TF32 support
1.2 Scalar Core Pipeline Architecture#
The scalar execution core implements a 6-stage pipeline with support for out-of-order execution within packet boundaries.
Stage 1: FETCH - Fetch 128-bit packet from I-cache
Stage 2: DECODE - Decode up to 4 instructions, check dependencies
Stage 3: DISPATCH - Assign instructions to execution units
Stage 4: EXECUTE - Integer/logic operations, address generation
Stage 5: MEMORY - L1 cache access
Stage 6: WRITEBACK - Register file updateDetailed Pipeline Stages:
| Stage | Operation | Duration | Notes |
|---|---|---|---|
| FETCH | I-cache access, I-TLB translation | 1 cycle | 128-bit aligned packets only |
| DECODE | Instruction parsing, immediate extraction | 1 cycle | Parallel decoding of 4 instructions |
| DISPATCH | Slot assignment, register renaming prep | 1 cycle | Resolves instruction class conflicts |
| EXECUTE | Computation, branch resolution | 1-3 cycles | Variable latency (MUL takes 2-3) |
| MEMORY | L1 D-cache or LSU operations | 2-3 cycles | Load latency = 2 cycles hit |
| WRITEBACK | Register file commit | 1 cycle | Synchronized across threads |
ASCII Block Diagram of Scalar Pipeline:
Loading…1.3 HVX (Hexagon Vector eXtensions) Architecture#
HVX provides SIMD acceleration for digital signal processing tasks. The unit operates at the same clock as the scalar core but with independent execution pipelines.
HVX Specifications by Generation:
| Generation | Width | Registers | Peak Throughput | Ops/Cycle |
|---|---|---|---|---|
| v65/v66 | 128b | 32×128b | 256 bits/cycle | 8 FP32 ops |
| v68+ | 256b | 32×256b | 512 bits/cycle | 16 FP32 ops |
HVX Register File Organization:
Loading…HVX Execution Pipelines:
The HVX unit contains multiple independent execution paths:
- Vector ALU Path: Arithmetic, logic, shift operations (1 cycle latency)
- Vector Multiply Path: 256-bit multiply-accumulate (3 cycle latency)
- Vector Memory Path: Cache access, streaming loads (2-3 cycle latency)
- Vector Permute Path: Shuffles, rotations, interleaves (1 cycle latency)
HVX Instruction Encoding (Dual-Issue):
Loading…1.4 HTA (Hexagon Tensor Accelerator) / HMX Architecture#
The Hexagon Tensor Accelerator (HTA), also known as HMX in later generations, provides dedicated hardware for matrix multiplication and tensor operations critical to deep learning inference.
HMX Specifications (v68+):
Loading…HMX vs HVX Comparison:
| Aspect | HVX | HMX |
|---|---|---|
| Type | SIMD Vector | Tensor Array |
| Ops/Cycle | 16 (256b, FP32) | 16,000 (INT8 MAC) |
| Throughput | 512 bits | 16 KB (aggregated) |
| Latency | 1-3 cycles | 50-100 cycles |
| Prime Use | DSP, filters | MatMul, convolution |
| Data Width | 8/16/32/64 bits | 8-bit (INT8), 16-bit (FP16) |
HMX Instruction Format:
HMX is controlled via specialized tensor instructions that encode matrix dimensions and operation types:
// Pseudocode HMX instruction structure
struct HMX_MatMul {
uint32_t opcode : 6; // Operation type
uint32_t m : 8; // Rows in A (A is m×k)
uint32_t k : 8; // Common dimension
uint32_t n : 8; // Cols in B (B is k×n)
uint32_t data_type : 2; // INT8=0, FP16=1, TF32=2
};
// Max matrix: 256×256×256 INT8 MatMul in ~1000 cycles1.5 Interrelationship Between Processing Units#
Loading…1.6 Functional Units and Execution Resources#
Complete Execution Resource Summary:
Loading…2. Hardware Threading Model#
2.1 4-Way Hardware Multi-Threading Overview#
The Hexagon core implements a fine-grained hardware threading model where up to 4 independent threads share a single physical core. This is distinct from simultaneous multi-threading (SMT) in that threads are not executing instructions simultaneously — rather, the VLIW engine interleaves instruction packets from different threads in round-robin fashion.
Threading Architecture:
Loading…2.2 VLIW Packet Interleaving and Round-Robin Scheduling#
Instructions are fetched in 128-bit packets containing up to 4 instructions. The scheduler cycles through threads in round-robin order, issuing one packet per cycle (when available and not stalled).
Interleaving Timeline:
Loading…2.3 Register File Sharing and Banking#
The register file is physically partitioned into 4 banks (one per thread), but there is also shared state for control flow and special registers.
Register File Layout (v68 generation):
Loading…2.4 Resource Sharing: Execution Units and Functional Units#
While threads have separate register files, they share all execution units. The dispatcher must resolve:
Conflict Types:
-
Functional Unit Conflicts: Two threads trying to use same ALU
- Solution: Stall one thread, let other execute
- Priority: Lower thread ID typically has priority
-
Cache Port Conflicts: Multiple threads accessing L1 cache
- L1 D-cache: 2 read ports, 1 write port per cycle
- Thread 0: priority for port 0
- Thread 1: priority for port 1
- Threads 2-3: share remaining port, time-division
-
Memory Bus Conflicts: L2/L3 access serialization
- Single memory port to L2
- Arbitration: Round-robin with priority boost for waiting threads
Execution Unit Allocation Policy:
Dispatch Decision Matrix:
Thread T wants to issue packet at cycle C:
1. Check if functional units are free:
if (ALU.free && LSU.free) → Can issue up to 2 instructions
if (ALU.free XOR LSU.free) → Can issue 1 instruction
if (NEITHER.free) → STALL thread
2. Check for L1 cache conflicts:
if (port0.free) → T0,T1 high priority
if (port1.free) → T0,T1 high priority
if (multiple threads want same port) → arbitrate by thread_id
3. Check for resource hazards:
if (instruction uses M0/M1 and another thread is using) → STALL
if (instruction uses branch prediction state) → check prediction table
4. Update scheduling state:
current_thread = (current_thread + 1) % 42.5 Thread Priority and Fairness#
Dynamic Thread Prioritization:
// Simplified scheduling algorithm (pseudo-C)
struct ThreadState {
uint32_t pc; // Program counter
uint32_t stall_cycles; // Remaining stall time
uint32_t priority; // 0=highest, 3=lowest
bool valid; // Thread active?
};
void schedule_packet() {
// Rotate priority every 4 cycles
static int round_robin_id = 0;
// Find next non-stalled thread
for (int i = 0; i < 4; i++) {
int tid = (round_robin_id + i) % 4;
if (thread[tid].valid && thread[tid].stall_cycles == 0) {
// Check if functional units available
if (can_dispatch(tid)) {
dispatch_packet(tid);
round_robin_id = (tid + 1) % 4;
return;
}
}
}
// No thread ready; insert NOP cycle (rare)
insert_nop_packet();
}Stall Cycle Accounting:
| Event | Stall Duration | Why |
|---|---|---|
| L1 cache miss | 10-20 cycles | Memory hierarchy traversal |
| L2 cache miss | 30-100 cycles | Off-core access |
| Memory read dependency | 2 cycles | Load-to-use hazard |
| Branch misprediction | 3-5 cycles | Pipeline flush |
| Functional unit not ready | 1-3 cycles | Operand not available |
| Lock contention | Variable | Inter-thread synchronization |
2.6 Thread-Local Storage and Register Isolation#
Each thread maintains complete state isolation:
Loading…3. Memory Hierarchy#
3.1 Cache System Overview#
The Hexagon processor implements a two-level (L1/L2) cache hierarchy with separate instruction and data caches at L1, unified L2, and optional tightly-coupled memories.
Cache Hierarchy Diagram:
Loading…3.2 L1 Instruction Cache (I-Cache)#
Specifications by Generation:
| Aspect | v65/v66 | v68 | v69/v73 | v75 |
|---|---|---|---|---|
| Size | 32 KB | 32 KB | 32 KB | 32 KB |
| Associativity | 4-way | 4-way | 4-way | 4-way |
| Line Size | 32 B | 32 B | 32 B | 32 B |
| Fetch Width | 128 b | 128 b | 128 b | 128 b |
| Hit Latency | 1 cycle | 1 cycle | 1 cycle | 1 cycle |
| I-TLB Entries | 64 | 64 | 64 | 64 |
I-Cache Organization:
Loading…I-Cache Access Path:
// I-Cache hit scenario (1 cycle)
Cycle N: PC[31:10] → I-TLB lookup (parallel with cache)
PC[9:2] → Set selection
PC[1:0] = 00 (128-bit aligned)
Cycle N: Compare tags in 4-way set
Mux out matching way (128-bit data)
Update LRU replacement state
Cycle N+1: Instruction decoder receives 128-bit packet3.3 L1 Data Cache (D-Cache)#
D-Cache Specifications:
| Aspect | Configuration |
|---|---|
| Size | 32 KB |
| Associativity | 4-way |
| Line Size | 32 B |
| Access Width | 64-bit (dual-bank) |
| Hit Latency | 2 cycles (address generation in E4, hit in M5) |
| Write-Through/Back | Write-back |
| Victim Buffer | Yes, 4-entry |
| D-TLB | 32 entries, fully associative |
D-Cache Dual-Bank Organization:
Loading…D-Cache Access Latency Details:
Loading…3.4 L2 Unified Cache#
The L2 cache serves both instruction and data accesses, with an 8-way set-associative organization.
L2 Specifications by Generation:
| Generation | Size | Assoc | Line | Hit Latency | Bandwidth |
|---|---|---|---|---|---|
| v65 | 256 KB | 8-way | 64 B | 2 cyc | 128 bits |
| v66 | 256 KB | 8-way | 64 B | 2 cyc | 128 bits |
| v68 | 512 KB | 8-way | 64 B | 2 cyc | 128 bits |
| v69/v73 | 512 KB | 8-way | 64 B | 2 cyc | 128 bits |
| v75 | 512 KB | 8-way | 64 B | 2 cyc | 128 bits |
L2 Cache Structure:
Loading…L2 Hit/Miss Path:
Loading…3.5 TCM (Tightly Coupled Memory) and VTCM (Vector TCM)#
TCM Purpose: Fast, predictable access for critical code/data. No cache miss latency.
TCM Specifications by Generation:
| Generation | TCM Size | VTCM Size | Purpose |
|---|---|---|---|
| v65/v66 | 0 KB | 0 KB | N/A |
| v68 | 0-32 KB | 0-128 KB | Optional |
| v69/v73 | 0-32 KB | 0-128 KB | Optional |
| v75 | 0-32 KB | 0-256 KB | Optional |
TCM vs VTCM Distinction:
Loading…TCM Access Example:
// TCM access - fixed 1 cycle latency
// Must use specific intrinsics/pragmas
#pragma TCM // Place function in TCM
void fast_kernel() {
volatile uint32_t *tcm_ptr = (uint32_t*)0xa0000000;
uint32_t data = *tcm_ptr; // 1 cycle guaranteed
// No cache miss possible
data += 1;
*tcm_ptr = data; // 1 cycle guaranteed
}
// VTCM access - predictable for vector operations
#pragma VTCM_DATA // Place data in VTCM
__attribute__((aligned(256)))
int8_t weight_matrix[128][128]; // 16 KB in VTCM
void vector_kernel() {
HVX_Vector *v0 = (HVX_Vector*)&weight_matrix[0][0];
HVX_Vector result = Q6_V_vmem_AV(*v0); // 1 cycle hit
}3.6 Cache Coherence and Consistency#
Hexagon is a single-threaded core (cache-coherence semantics apply within threads only). Inter-thread synchronization is explicit.
Memory Barrier Instructions:
// Hexagon memory fence operations
// MEMORY_BARRIER (full fence)
// Blocks until all prior memory operations complete
__asm__ volatile ("MEMORY_BARRIER" ::: "memory");
// SYNCH (lightweight sync)
// Ensures instruction ordering
__asm__ volatile ("SYNCH" ::: "memory");
Usage:
Lock Acquire:
acquire_lock() // Atomic
MEMORY_BARRIER // Ensure writes before are visible
read_shared_data()
Lock Release:
write_shared_data()
MEMORY_BARRIER // Ensure writes before release visible
release_lock() // Atomic4. The Hexagon ISA#
4.1 Instruction Format and Packet Structure#
The Hexagon ISA is structured around 128-bit packets containing up to 4 instructions, all executed in the same cycle (or stalled together if dependencies exist).
Packet Structure:
Loading…Instruction Encoding (32-bit):
Loading…4.2 Instruction Slot Assignment Rules#
Critical to understanding Hexagon code generation: instructions must be assigned to valid slots based on their type and resource requirements.
Slot Assignment Table:
| Slot | Resources | Valid Instruction Types |
|---|---|---|
| 0 | ALU, MUL | ADD, SUB, AND, OR, MUL, compare, shift, move |
| 1 | ALU, MUL | Same as Slot 0 (ALU can dual-issue) |
| 2 | LSU | LOAD, STORE, prefetch, atomic |
| 3 | ALU, MUL, Branch | Same as 0/1, or branch, call, return |
Dual-Issue Constraints:
Valid dual-issue combinations within a packet:
✓ ALU + ALU (Slot 0 + Slot 1)
✓ ALU + LSU (Slot 0/1 + Slot 2)
✓ ALU + ALU + LSU (Slot 0 + Slot 1 + Slot 2)
✓ ALU + LSU + Branch (Slot 0/1 + Slot 2 + Slot 3)
✗ ALU + ALU + ALU (at most 2 ALUs per cycle due to resources)
✗ LSU + LSU (only 1 LSU per cycle... mostly)
✗ Multiple branches (only 1 branch per packet)
✗ Store + Store (dual-store in v68+ only)
Dual-Store (v68+, Slot 2 only):
{
memw(r0) = r1
memh(r2) = r3 // DUAL-STORE allowed if non-overlapping
}
Store + Load prohibition:
{
memw(r0) = r1 // STORE
r2 = memw(r3) // LOAD - CONFLICT (only 1 LSU)
} // INVALID packet - assembler error4.3 Register Operand Format and Addressing Modes#
Register Operands:
Integer registers: R0 - R31 (32 × 32-bit)
Register pairs: R1:R0, R3:R2, ..., R31:R30 (64-bit)
Predicate regs: P0 - P3 (each 8 bits)
Addressing modes:
1. Register direct:
r0 = add(r1, r2) // Rd = Opcode(Rs1, Rs2)
2. Register with immediate:
r0 = add(r1, #42) // Rd = Opcode(Rs, Immediate)
3. Scaled register offset:
r0 = memw(r1 + r2 << #2) // Load with scaled offset
(shifts r2 by 2 bits: useful for array indexing)
4. Base + immediate:
r0 = memw(r1 + #8) // Load from r1 + 8
5. Post-increment/decrement:
r0 = memw(r1++ #4) // Load, then r1 += 4 (auto-increment)
r0 = memw(r1-- ) // Load, then r1 -= 4
6. Modulo addressing (hardware loop):
r0 = memw(r2++M0) // Load, r2 += M0, wrap at M1 boundaryImmediate Value Encoding:
// Immediate encoding in Hexagon
// 8-bit immediates (i8):
r0 = add(r1, #-1) // Range: -1 to -128
// 16-bit immediates (i16):
r0 = add(r1, #1000) // Range: -32768 to 32767
r1 = memw(r2 + #1024) // Must be 4-byte aligned
// 32-bit immediates (i32):
r0 = ##0x12345678 // Uses 2 instructions (CONST + OR)
// Large immediates usually expanded by assembler:
r0 = ##0x12345678
// Becomes:
// r0 = {#0x1234} // CONST (upper 22 bits)
// r0 = or(r0, #0x5678) // OR in lower bits4.4 Conditional Execution and Predicates#
Hexagon predicates (P0-P3) enable instruction-level conditional execution without branches.
Predicate Operations:
// Predicate assignment
p0 = cmp.eq(r0, r1) // p0 = (r0 == r1) ? 1 : 0
p1 = cmp.gt(r2, #100) // p1 = (r2 > 100) ? 1 : 0
// Predicate combine
p2 = and(p0, p1) // p2 = p0 AND p1
p3 = or(p0, p1) // p3 = p0 OR p1
// Conditional instruction execution
if (p0) r0 = add(r1, r2) // Execute only if p0 == 1
if (!p0) r0 = sub(r1, r2) // Execute only if p0 == 0
// Conditional move
r0 = mux(p0, r1, r2) // r0 = p0 ? r1 : r2Predicate Register Format:
Loading…4.5 Branch Instructions and Prediction#
Hexagon implements an efficient branch prediction unit integrated with the VLIW pipeline.
Branch Instruction Types:
// Unconditional branches
jump #offset // PC-relative jump
jumpr r0 // Register jump (computed address)
call #offset // Subroutine call (link r31)
// Conditional branches
if (p0) jump #offset // Conditional jump
if (!p0) jump #offset // Inverted condition
// Hardware loops (special loop branches)
loop0(#iterations, #begin_label)
loop1(#iterations, #begin_label)
// Ending loops
endloop0 // End loop0 with back-edge jump
endloop1 // End loop1Branch Prediction Mechanics:
Loading…Hardware Loop Instructions:
// Hardware loop structure (zero-overhead loop)
r0 = #0 // Iteration counter
loop0(r0, #label_start) // Setup loop0 for r0 iterations
#label_start:
r1 = add(r1, r2)
r2 = memw(r3++ #4)
// ...
endloop0 // Jump back to label_start, decrement r0
// Properties:
// • Zero-overhead (no branch penalty in steady state)
// • Can nest up to 2 levels (loop0 inside loop1)
// • Loop counter in registers (LC0, LC1 implicit)
// • Loop end address in LE0, LE14.6 NOP Cycles and Stall Hazards#
Hazard Types and Solutions:
// 1. Read-After-Write (RAW) hazard
r0 = add(r1, r2) // Cycle N
r3 = add(r0, r4) // Cycle N+1 (r0 ready in W6, can forward in E4)
// NO STALL (1-cycle forward path)
// 2. Store-to-Load dependency
memw(r0) = r1 // Store in cycle N
r2 = memw(r3) // Load in cycle N+1
// STALL: Load must wait for store ordering (2 cycles minimum)
// 3. Multi-cycle result dependency
r0 = mpyh(r1, r2) // Multiply (3-cycle latency)
r3 = add(r0, r4) // Must wait 3 cycles
// Cycle N: MULT starts
// Cycle N+1: Stall (waiting)
// Cycle N+2: Stall (waiting)
// Cycle N+3: Result ready, can start ADD
// 4. Load-to-use forward hazard
r0 = memw(r1) // 2-cycle latency
r1 = add(r0, r2) // Can start 1 cycle after load (forward from L1 hit)
// Cycle N: Load from L1 hit
// Cycle N+1: Data forwarded (even though W6 is cycle N+2)
// Cycle N+2: ADD executes with r0 value
// NOP handling
{
memw(r0) = r1 // Store
nop
r2 = memw(r3) // Load (after 1-cycle stall)
}Instruction Dependency Tracking:
Loading…4.7 Endianness and Data Organization#
Hexagon is little-endian.
Data Layout:
Loading…5. Hexagon NPU within Snapdragon SoC#
5.1 Snapdragon SoC Block Diagram#
The Hexagon processor is one compute engine within the larger Snapdragon SoC ecosystem.
Loading…5.2 Interconnect Architecture (NoC)#
The Hexagon processor connects to the rest of the SoC via a network-on-chip (NoC).
NoC Topology (Snapdragon 8 Gen 2 example):
Loading…5.3 DMA (Direct Memory Access) Engines#
Hexagon includes dedicated DMA engines for off-core memory access independent of the processor pipeline.
DMA Engine Architecture:
Loading…DMA Performance Profile:
| Operation | Throughput | Latency | Notes |
|---|---|---|---|
| DMA burst (1D) | 128 bits/cycle | ~100 cycles setup | Coalesced |
| DMA 2D transfer | Same | Stride-dependent | Address calc/cycle |
| DMA → L2 | ~200 GB/s peak | Depends on L2 state | Rarely bottleneck |
| DMA → DDR | ~32 GB/s (LPDDR5) | 50-100 cycles | Shared bandwidth |
DMA Code Example:
// Hexagon DMA initialization (pseudo-C)
typedef volatile struct {
uint32_t CMD; // 0x0 - DMA command
uint32_t STATUS; // 0x4 - DMA status
uint32_t ADDR_SRC; // 0x8 - Source address
uint32_t ADDR_DST; // 0xC - Destination
uint32_t LENGTH; // 0x10 - Transfer length
uint32_t SRC_STRIDE; // 0x14 - Source stride
uint32_t DST_STRIDE; // 0x18 - Destination stride
} DMA_Registers;
void dma_copy_2d(const void *src, void *dst,
uint32_t rows, uint32_t cols,
uint32_t src_row_stride, uint32_t dst_row_stride) {
DMA_Registers *dma = (DMA_Registers*)0xe0000000;
dma->ADDR_SRC = (uint32_t)src;
dma->ADDR_DST = (uint32_t)dst;
dma->LENGTH = cols * rows;
dma->SRC_STRIDE = src_row_stride;
dma->DST_STRIDE = dst_row_stride;
dma->CMD = 0x01; // START
// Poll completion
while ((dma->STATUS & 0x1) == 0) {
// Wait
}
}5.4 SMMU (System Memory Management Unit) and IOMMU#
The SMMU provides virtual-to-physical address translation for Hexagon and other peripherals.
SMMU Configuration for Hexagon:
Loading…5.5 Power Domains (VDDCX, VDDMX)#
Hexagon can be independently power-gated or frequency-scaled.
Power Domain Organization:
Loading…5.6 Clock Domains#
Hexagon operates in independent clock domains for frequency scaling.
Clock Architecture:
Loading…6. Generational Differences (v65-v75)#
6.1 ISA Feature Evolution#
| Feature | v65 | v66 | v68 | v69 | v73 | v75 |
|---|---|---|---|---|---|---|
| Core | ||||||
| Clock | 1.8G | 1.9G | 1.8G | 2.0G | 2.1G | 2.2G |
| Threads | 4 | 4 | 4 | 4 | 4 | 4 |
| L1-I Cache | 32K | 32K | 32K | 32K | 32K | 32K |
| L1-D Cache | 32K | 32K | 32K | 32K | 32K | 32K |
| L2 Cache | 256K | 256K | 512K | 512K | 512K | 512K |
| HVX | ||||||
| Width | 128b | 128b | 256b | 256b | 256b | 256b |
| Registers | 32 | 32 | 32 | 32 | 32 | 32 |
| Ops/cycle | 4 | 4 | 8 | 8 | 8 | 8 |
| HTA/HMX | ||||||
| Present | No | No | Yes | Yes | Yes | Yes |
| Type | - | - | HTA | HTA | HTA | HMX |
| MatMul Perf | - | - | ~7 TMAC/s | ~7.5 TMAC/s | ~8.4 TMAC/s | ~10 TMAC/s |
| Memory | ||||||
| TCM | No | No | 0-32K | 0-32K | 0-32K | 0-32K |
| VTCM | No | No | 0-128K | 0-128K | 0-128K | 0-256K |
| ISA | ||||||
| HVX v60 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| HVX v62 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| HVX v65 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| HVX v66 | - | ✓ | ✓ | ✓ | ✓ | ✓ |
| HVX v68 | - | - | ✓ | ✓ | ✓ | ✓ |
| HVX v69 | - | - | - | ✓ | ✓ | ✓ |
| HVX v73 | - | - | - | - | ✓ | ✓ |
| HVX v75 | - | - | - | - | - | ✓ |
6.2 Hexagon v65 vs v66 (Minor Iteration)#
v66 is primarily a minor clockspeed and ISA refinement of v65.
Key Additions in v66:
// New HVX v66 instructions
v0 = vrndnh(v0) // Round-to-nearest-half
v0 = vaslh(v0, r0) // Variable arithmetic shift
v0 = vfma(v0, v1, v2) // Fused multiply-accumulate
// Scalar improvements
r0 = sfmpy(r1, r2) // Scalar FMA (floating-point)Cache/Memory improvements:
- I-TLB: 64 → 64 (no change)
- D-TLB: 32 → 32 (no change)
- L1 latency: 1 cycle (no change)
6.3 Hexagon v68 (Major Step: HTA, 256-bit HVX)#
v68 introduces significant compute acceleration capabilities.
Major v68 Features:
-
HVX Width Expansion: 128b → 256b
C// v65/v66: 128-bit operations HVX_Vector v0(128b), v1(128b), v2(128b); v0 = Q6_V_vadd_VV(v1, v2); // 128-bit ADD // v68+: 256-bit operations (4× throughput) v0 = Q6_V_vadd_VV_256(v1, v2); // 256-bit ADD // Single instruction does 8 x 32-bit ops vs 4 x 32-bit -
HTA (Hexagon Tensor Accelerator)
C// Tensor operations (new in v68) // Controlled via HTA-specific instructions // Setup matrix multiply // A: input activation matrix (128×K) // B: weight matrix (K×128) // C: output accumulator (128×128) // In pseudocode: hta_matmul_setup(A_base, B_base, C_base); hta_matmul_execute(m, k, n, data_type); hta_wait_complete(); -
TCM/VTCM Support (Optional)
C// Tightly-coupled memory access // VTCM: 0-128 KB dedicated for vector operations #pragma VTCM int8_t weight_tensor[128][128]; // Guaranteed 1-cycle access // Use in vector operations v0 = Q6_V_vmem_A(weight_tensor); -
Dual-Store Support (v68)
C// Two stores in single packet { memw(r0) = r1 // Store to address r0 memw(r2) = r3 // Store to address r2 (dual-store) } // v65/v66: Error (only 1 LSU) // v68+: Valid if r0 != r2 and no bank conflict
6.4 Hexagon v69 (Incremental: Slight Perf Boost)#
v69 is a modest speed/power optimization over v68.
v69 Improvements:
Clock increase: 1.8 GHz → 2.0 GHz
HTA throughput: +5% (improved MAC latency scheduling)
New instructions (few):
r0 = ashiftr(r1, r2, #width) // Dynamic width shift
v0 = vmpy_qfx(v1, v2) // Q-format multiply (fixed-point)6.5 Hexagon v73 (Refinement: Better Cache)#
v73 focuses on memory and control flow efficiency.
v73 Changes:
L2 cache: 512 KB (unchanged from v68)
Clock: 2.1 GHz
New branch prediction features:
• Extended BTB (Branch Target Buffer)
• Improved pattern history
New memory prefetch instructions:
dcfetch(r0) // Prefetch for data access6.6 Hexagon v75 (Latest: HMX Expansion, Larger VTCM)#
v75 is the latest generation with major improvements to tensor acceleration and memory.
v75 Major Additions:
-
HMX Expansion (vs v68 HTA)
C// HMX: Dedicated matrix accelerator (more capable than HTA) // INT8: 28.8 TMAC/s (v75 @ 1.8 GHz, 16×16K MACs/cycle) // FP16: 14.4 TFLOPS // TF32: 3.6 TFLOPS (new in v75) // New data types for inference TF32 (19-bit, Google TPU format) INT4 (4-bit quantized) INT2 (2-bit extreme quantization) -
VTCM Expansion: 128 KB → 256 KB
C// Larger vector TCM for bigger working sets #pragma VTCM int8_t weights[256][256]; // Now fits in VTCM (256×256=64KB) // v68: Would need external L2 access // v75: Fits in dedicated VTCM -
Improved FP32 Performance
C// Floating-point enhancements r0 = fpround(r1) // Better rounding control v0 = vfma_fp32(v1, v2, v3) // Vector FMA (better precision) -
New Vector Instructions (HVX v75)
C// Advanced permutation v0 = vshuffeh(v1, v2) // Shuffle even/odd v0 = vtranspose(v0, v1) // Matrix transpose // New bit manipulation v0 = vpopcnt(v1) // Population count (Hamming weight) v0 = vlz(v1) // Leading zeros
6.7 ISA Extension Timeline Summary#
Loading…7. Self-Assessment Questions#
PhD-Level Qualifier Exam Style Questions#
Section 1: Processor Architecture
-
Explain the 6-stage scalar pipeline with emphasis on forwarding paths and hazard resolution. How many cycles are required for a load-use dependency to be resolved? What is the minimum stall latency for a store-load dependency?
-
The Hexagon processor implements 4-way hardware multithreading. Explain (a) why threads don't execute simultaneously, (b) how instruction packets are interleaved, (c) what happens when a single thread experiences a 20-cycle L2 cache miss, and (d) the register isolation mechanism.
-
Compare and contrast HVX, HTA, and HMX. For each, provide:
- Peak throughput (ops/cycle) at 1.8 GHz
- Typical latency for primary operations
- Data width and register count
- Optimal use cases for neural network inference
-
The VLIW packet structure allows up to 4 instructions per 128-bit packet. Explain:
- Slot assignment rules and dual-issue constraints
- Why only 1 LSU can issue per cycle (mostly)
- The dual-store exception in v68+ and its constraints
- How the compiler/assembler detects valid vs invalid packets
Section 2: Memory Hierarchy
-
Diagram and explain the Hexagon memory hierarchy latencies. Given a sequence of memory operations:
Cr0 = memw(r1) // Cycle N (L1 hit) r2 = memw(r3) // Cycle N+1 r4 = add(r0, r2) // When does this start executing?Explain the forwarding path and identify all possible stalls.
-
The D-cache is organized as a dual-bank structure. Explain (a) the bank interleaving scheme, (b) how a load and store can both execute simultaneously, (c) what constitutes a bank conflict, and (d) the victim buffer role in write-back.
-
Compare TCM and VTCM in terms of address space, access patterns, and latency characteristics. Why can't the scalar core use VTCM?
-
L2 cache has an 8-way associative design with 512 KB (v68+). Calculate:
- Number of sets
- Bits used for set index, line offset, and tag
- Miss penalty if request must go off-core (100 cycles)
- Expected miss rate for audio DSP algorithms (craft answer)
Section 3: ISA and Instruction-Level Details
-
Explain the predicate execution model. Given:
Cp0 = cmp.eq(r0, #5) if (p0) r1 = add(r2, r3) if (!p0) r1 = sub(r2, r3)How many cycles does this execute? Can both branches be issued in the same packet? Explain.
-
Hexagon branch prediction has ~95% accuracy for loops. Explain:
- The structure of the BTB (branch target buffer)
- Misprediction penalty and recovery sequence
- How hardware loops (loop0/endloop0) achieve zero-overhead looping
- The role of prediction in prefetching I-cache
-
NOP cycles and stall hazards: Given:
Cr0 = mpyh(r1, r2) // 3-cycle latency r3 = add(r0, r4) // Read r0Explain the dependency tracking hardware and minimum stall cycles.
-
Analyze the instruction encoding for:
r0 = add(r1, #1000). Explain:- How 16-bit immediates are encoded
- Alternative instruction sequences for 32-bit immediates
- Why large constants require multiple instructions
Section 4: Multi-Threading and Synchronization
-
Explain the round-robin scheduler from first principles. If Thread 0 experiences a 15-cycle L2 miss on Cycle 5, what is the packet issue sequence for Cycles 5-20?
-
Register file banks: The 8 KB register file is split into 4 banks (one per thread). Explain:
- Physical address mapping for
R5in each thread - Why no inter-thread forwarding is implemented
- How synchronization primitives (locks) rely on shared memory
- Physical address mapping for
Section 5: SoC Integration
-
Hexagon connects to the SoC via a NoC (network-on-chip). Explain:
- How L2 cache misses are translated to NoC requests
- Priority/fairness arbitration in the NoC
- SMMU translation flow: VA → IPA → PA
- Bandwidth sharing with CPU/GPU (typical ratios)
-
Power domains VDDCX and VDDMX: Explain the difference and power gating/standby scenarios for each.
-
DMA engines provide off-core data movement. Explain:
- Configuration registers (source, destination, length, stride)
- How 2D transfers work with strides
- Peak throughput and typical use (loading weights, activations)
Section 6: Generational Progression
-
Trace the evolution from v65 → v68 → v75. For each, identify:
- New execution units introduced
- ISA extensions (with code examples)
- Peak throughput metrics
-
Why was HVX width expansion (128→256 bits) a turning point for Hexagon as an ML accelerator?
-
The VTCM expansion to 256 KB in v75: Calculate the weight matrix sizes that now fit. Compare inference latency for a 128×128 INT8 MatMul with weights in VTCM vs L2 cache.
Answers Framework (Guidance Only)#
Q1 Answer Framework:
- L1 hit latency: 2 cycles (E4 generate, M5 hit)
- Load-to-use forward: 1 cycle
- Store-load dependency: 2-3 cycle minimum (ordering guarantees)
- Forwarding from W6 to E4 of next packet
Q3 Answer Framework:
- HVX: 16 ops/cycle (256b FP32), ~3 cycle latency, 32×256b regs, SIMD DSP ops
- HTA/HMX: ~7-10 TMAC/sec (INT8 matrix), 50-100 cycle latency, MAC arrays, tensor ops
- Comparison: HVX for general DSP, HTA/HMX specialized for conv/linear layers
Q13 Answer Framework:
Thread 0: P0↓ . . . . . P1
Thread 1: . P0 . . . P1 .
Thread 2: . . P0 . P1 . .
Thread 3: . . . P0 P1 . .
...
(skip T0 for ~4 rotations while L2 access pending)References and Further Reading#
Official Qualcomm Documentation:
- Hexagon V73 Architecture Specification (HVX v73, ISA ref)
- Snapdragon 8 Gen 2 Technical Reference Manual
- Hexagon HVX Programmer's Reference Manual
- Hexagon Tensor Accelerator (HTA) Programming Guide
Memory Subsystem:
- Qualcomm Hexagon Cache & Memory Hierarchy Design Brief
- ARM SMMU v3 Specification (for IOMMU details)
Performance Tuning:
- Qualcomm Hexagon Performance Optimization Guide
- HVX Code Optimization Handbook (vector scheduling)
Related ISA References:
- VLIW architecture fundamentals (Fisher et al., 2005)
- Hardware multithreading survey (Ungerer et al., 2003)
- Tensor accelerator design patterns
Document Version: 1.0 Last Updated: March 2026 Target Audience: PhD-level engineers, advanced ML systems researchers Assumption: Strong background in computer architecture, VLIW ISAs, and C/C++ programming