File size: 1,164 Bytes
1f3a244
 
 
 
1
2
3
4
5
{"type": "session", "harness": "opencode", "id": "asm-debug-simd", "name": "Debugging x86-64 SIMD Bugs"}
{"type": "message", "message": {"role": "system", "content": "You are an expert debugger."}}
{"type": "message", "message": {"role": "user", "content": "How do I debug SIMD (SSE/AVX) issues in x86-64?"}}
{"type": "message", "message": {"role": "assistant", "content": "SIMD debugging:\n\n1. Alignment faults: SSE MOVAPS on unaligned address causes SIGSEGV. Check with 'x/1xg $rip'. Fix: use MOVUPS or ALIGN 16.\n\n2. MXCSR exceptions: MXCSR register controls SIMD exceptions. Bit 7=flush-to-zero, bits 1-5=exception masks. 'mxcsr' in GDB.\n\n3. AVX state: using XMM after AVX without VZEROUPPER causes perf degradation (not crash).\n\n4. Register state in GDB: 'p $xmm0.v4_float' (4 floats), 'p $ymm0.v8_float' (8 floats).\n\n5. Common SIMD bugs:\n   - Lane confusion: operation on wrong lane. VPERMPS to debug shuffle orders.\n   - Broadcast vs gather: VBROADCASTSS replicates, VPGATHERDD loads different values.\n   - Mask register: AVX-512 k1-k7 masks lanes.\n\n6. Compiler Explorer: compare your assembly with compiler output to verify intrinsics."}}