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.

60 min readPrerequisites: VLIW processors, Cache hierarchies, Memory systems, DSP concepts, C/C++ and computer architecture

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#

  1. Full Hexagon Processor Anatomy
  2. Hardware Threading Model
  3. Memory Hierarchy
  4. The Hexagon ISA
  5. Hexagon NPU within Snapdragon SoC
  6. Generational Differences (v65-v75)
  7. 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.

Text
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 update

Detailed Pipeline Stages:

StageOperationDurationNotes
FETCHI-cache access, I-TLB translation1 cycle128-bit aligned packets only
DECODEInstruction parsing, immediate extraction1 cycleParallel decoding of 4 instructions
DISPATCHSlot assignment, register renaming prep1 cycleResolves instruction class conflicts
EXECUTEComputation, branch resolution1-3 cyclesVariable latency (MUL takes 2-3)
MEMORYL1 D-cache or LSU operations2-3 cyclesLoad latency = 2 cycles hit
WRITEBACKRegister file commit1 cycleSynchronized across threads

ASCII Block Diagram of Scalar Pipeline:

Diagram
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:

GenerationWidthRegistersPeak ThroughputOps/Cycle
v65/v66128b32×128b256 bits/cycle8 FP32 ops
v68+256b32×256b512 bits/cycle16 FP32 ops

HVX Register File Organization:

Diagram
Loading…

HVX Execution Pipelines:

The HVX unit contains multiple independent execution paths:

  1. Vector ALU Path: Arithmetic, logic, shift operations (1 cycle latency)
  2. Vector Multiply Path: 256-bit multiply-accumulate (3 cycle latency)
  3. Vector Memory Path: Cache access, streaming loads (2-3 cycle latency)
  4. Vector Permute Path: Shuffles, rotations, interleaves (1 cycle latency)

HVX Instruction Encoding (Dual-Issue):

Diagram
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+):

Diagram
Loading…

HMX vs HVX Comparison:

AspectHVXHMX
TypeSIMD VectorTensor Array
Ops/Cycle16 (256b, FP32)16,000 (INT8 MAC)
Throughput512 bits16 KB (aggregated)
Latency1-3 cycles50-100 cycles
Prime UseDSP, filtersMatMul, convolution
Data Width8/16/32/64 bits8-bit (INT8), 16-bit (FP16)

HMX Instruction Format:

HMX is controlled via specialized tensor instructions that encode matrix dimensions and operation types:

C
// 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 cycles

1.5 Interrelationship Between Processing Units#

Diagram
Loading…

1.6 Functional Units and Execution Resources#

Complete Execution Resource Summary:

Diagram
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:

Diagram
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:

Diagram
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):

Diagram
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:

  1. Functional Unit Conflicts: Two threads trying to use same ALU

    • Solution: Stall one thread, let other execute
    • Priority: Lower thread ID typically has priority
  2. 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
  3. 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:

Text
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) % 4

2.5 Thread Priority and Fairness#

Dynamic Thread Prioritization:

C
// 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:

EventStall DurationWhy
L1 cache miss10-20 cyclesMemory hierarchy traversal
L2 cache miss30-100 cyclesOff-core access
Memory read dependency2 cyclesLoad-to-use hazard
Branch misprediction3-5 cyclesPipeline flush
Functional unit not ready1-3 cyclesOperand not available
Lock contentionVariableInter-thread synchronization

2.6 Thread-Local Storage and Register Isolation#

Each thread maintains complete state isolation:

Diagram
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:

Diagram
Loading…

3.2 L1 Instruction Cache (I-Cache)#

Specifications by Generation:

Aspectv65/v66v68v69/v73v75
Size32 KB32 KB32 KB32 KB
Associativity4-way4-way4-way4-way
Line Size32 B32 B32 B32 B
Fetch Width128 b128 b128 b128 b
Hit Latency1 cycle1 cycle1 cycle1 cycle
I-TLB Entries64646464

I-Cache Organization:

Diagram
Loading…

I-Cache Access Path:

C
// 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 packet

3.3 L1 Data Cache (D-Cache)#

D-Cache Specifications:

AspectConfiguration
Size32 KB
Associativity4-way
Line Size32 B
Access Width64-bit (dual-bank)
Hit Latency2 cycles (address generation in E4, hit in M5)
Write-Through/BackWrite-back
Victim BufferYes, 4-entry
D-TLB32 entries, fully associative

D-Cache Dual-Bank Organization:

Diagram
Loading…

D-Cache Access Latency Details:

Diagram
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:

GenerationSizeAssocLineHit LatencyBandwidth
v65256 KB8-way64 B2 cyc128 bits
v66256 KB8-way64 B2 cyc128 bits
v68512 KB8-way64 B2 cyc128 bits
v69/v73512 KB8-way64 B2 cyc128 bits
v75512 KB8-way64 B2 cyc128 bits

L2 Cache Structure:

Diagram
Loading…

L2 Hit/Miss Path:

Diagram
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:

GenerationTCM SizeVTCM SizePurpose
v65/v660 KB0 KBN/A
v680-32 KB0-128 KBOptional
v69/v730-32 KB0-128 KBOptional
v750-32 KB0-256 KBOptional

TCM vs VTCM Distinction:

Diagram
Loading…

TCM Access Example:

C
// 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:

C
// 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()    // Atomic

4. 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:

Diagram
Loading…

Instruction Encoding (32-bit):

Diagram
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:

SlotResourcesValid Instruction Types
0ALU, MULADD, SUB, AND, OR, MUL, compare, shift, move
1ALU, MULSame as Slot 0 (ALU can dual-issue)
2LSULOAD, STORE, prefetch, atomic
3ALU, MUL, BranchSame as 0/1, or branch, call, return

Dual-Issue Constraints:

Text
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 error

4.3 Register Operand Format and Addressing Modes#

Register Operands:

Text
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 boundary

Immediate Value Encoding:

C
// 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 bits

4.4 Conditional Execution and Predicates#

Hexagon predicates (P0-P3) enable instruction-level conditional execution without branches.

Predicate Operations:

C
// 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 : r2

Predicate Register Format:

Diagram
Loading…

4.5 Branch Instructions and Prediction#

Hexagon implements an efficient branch prediction unit integrated with the VLIW pipeline.

Branch Instruction Types:

C
// 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 loop1

Branch Prediction Mechanics:

Diagram
Loading…

Hardware Loop Instructions:

C
// 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, LE1

4.6 NOP Cycles and Stall Hazards#

Hazard Types and Solutions:

C
// 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:

Diagram
Loading…

4.7 Endianness and Data Organization#

Hexagon is little-endian.

Data Layout:

Diagram
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.

Diagram
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):

Diagram
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:

Diagram
Loading…

DMA Performance Profile:

OperationThroughputLatencyNotes
DMA burst (1D)128 bits/cycle~100 cycles setupCoalesced
DMA 2D transferSameStride-dependentAddress calc/cycle
DMA → L2~200 GB/s peakDepends on L2 stateRarely bottleneck
DMA → DDR~32 GB/s (LPDDR5)50-100 cyclesShared bandwidth

DMA Code Example:

C
// 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:

Diagram
Loading…

5.5 Power Domains (VDDCX, VDDMX)#

Hexagon can be independently power-gated or frequency-scaled.

Power Domain Organization:

Diagram
Loading…

5.6 Clock Domains#

Hexagon operates in independent clock domains for frequency scaling.

Clock Architecture:

Diagram
Loading…

6. Generational Differences (v65-v75)#

6.1 ISA Feature Evolution#

Featurev65v66v68v69v73v75
Core
Clock1.8G1.9G1.8G2.0G2.1G2.2G
Threads444444
L1-I Cache32K32K32K32K32K32K
L1-D Cache32K32K32K32K32K32K
L2 Cache256K256K512K512K512K512K
HVX
Width128b128b256b256b256b256b
Registers323232323232
Ops/cycle448888
HTA/HMX
PresentNoNoYesYesYesYes
Type--HTAHTAHTAHMX
MatMul Perf--~7 TMAC/s~7.5 TMAC/s~8.4 TMAC/s~10 TMAC/s
Memory
TCMNoNo0-32K0-32K0-32K0-32K
VTCMNoNo0-128K0-128K0-128K0-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:

C
// 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:

  1. 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
  2. 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();
  3. 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);
  4. 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:

Text
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:

Text
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 access

6.6 Hexagon v75 (Latest: HMX Expansion, Larger VTCM)#

v75 is the latest generation with major improvements to tensor acceleration and memory.

v75 Major Additions:

  1. 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)
  2. 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
  3. Improved FP32 Performance

    C
    // Floating-point enhancements
    r0 = fpround(r1)           // Better rounding control
    v0 = vfma_fp32(v1, v2, v3) // Vector FMA (better precision)
  4. 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#

Diagram
Loading…

7. Self-Assessment Questions#

PhD-Level Qualifier Exam Style Questions#

Section 1: Processor Architecture

  1. 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?

  2. 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.

  3. 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
  4. 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

  1. Diagram and explain the Hexagon memory hierarchy latencies. Given a sequence of memory operations:

    C
    r0 = 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.

  2. 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.

  3. Compare TCM and VTCM in terms of address space, access patterns, and latency characteristics. Why can't the scalar core use VTCM?

  4. 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

  1. Explain the predicate execution model. Given:

    C
    p0 = 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.

  2. 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
  3. NOP cycles and stall hazards: Given:

    C
    r0 = mpyh(r1, r2)    // 3-cycle latency
    r3 = add(r0, r4)     // Read r0

    Explain the dependency tracking hardware and minimum stall cycles.

  4. 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

  1. 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?

  2. Register file banks: The 8 KB register file is split into 4 banks (one per thread). Explain:

    • Physical address mapping for R5 in each thread
    • Why no inter-thread forwarding is implemented
    • How synchronization primitives (locks) rely on shared memory

Section 5: SoC Integration

  1. 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)
  2. Power domains VDDCX and VDDMX: Explain the difference and power gating/standby scenarios for each.

  3. 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

  1. Trace the evolution from v65 → v68 → v75. For each, identify:

    • New execution units introduced
    • ISA extensions (with code examples)
    • Peak throughput metrics
  2. Why was HVX width expansion (128→256 bits) a turning point for Hexagon as an ML accelerator?

  3. 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:

Text
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