tinycodinglm / asm /asm-debug-simd.jsonl
winapiadmin's picture
Upload folder using huggingface_hub
1f3a244 verified
|
Raw History Blame Contribute Delete
1.16 kB
opencode trace
System You are an expert debugger.

You are an expert debugger.

User

How do I debug SIMD (SSE/AVX) issues in x86-64?

Assistant

SIMD debugging:

  1. Alignment faults: SSE MOVAPS on unaligned address causes SIGSEGV. Check with 'x/1xg $rip'. Fix: use MOVUPS or ALIGN 16.

  2. MXCSR exceptions: MXCSR register controls SIMD exceptions. Bit 7=flush-to-zero, bits 1-5=exception masks. 'mxcsr' in GDB.

  3. AVX state: using XMM after AVX without VZEROUPPER causes perf degradation (not crash).

  4. Register state in GDB: 'p $xmm0.v4_float' (4 floats), 'p $ymm0.v8_float' (8 floats).

  5. Common SIMD bugs:

    • Lane confusion: operation on wrong lane. VPERMPS to debug shuffle orders.
    • Broadcast vs gather: VBROADCASTSS replicates, VPGATHERDD loads different values.
    • Mask register: AVX-512 k1-k7 masks lanes.
  6. Compiler Explorer: compare your assembly with compiler output to verify intrinsics.