MetaGreg ClaytonAnnouncement
Extending LLDB to Debug Applications That Span CPUs and GPUs
Summary
Meta developed a vendor-neutral accelerator plugin architecture in lldb-server for debugging applications that span CPUs and GPUs. The design separates shared debugger infrastructure from hardware-specific device control by representing the CPU and GPU as separate LLDB targets. A plugin in lldb-server coordinates host and device debugging, translating a vendor’s device debugging API into concepts LLDB already understands. GPU debugging is activated only when the application uses a supported GPU runtime, leaving CPU-only debugging unaffected. The common framework, including the plugin interface and GDB-remote packets, has been upstreamed to LLVM, with remaining pieces expected soon.
Context
Modern AI applications span CPUs and GPUs, but traditional debuggers assume one process with one architecture and a consistent view of threads, registers, and memory. GPU programs challenge those assumptions with different instruction sets, address spaces, and execution models. Historically, GPU vendors built device-specific debuggers, requiring common capabilities to be implemented and maintained separately.
Approach / What changed
A vendor-neutral accelerator plugin architecture in lldb-server that separates shared debugger infrastructure from hardware-specific device control. The CPU and GPU are represented as separate LLDB targets, each with its own architecture, threads, registers, and address space, while a plugin in lldb-server coordinates host and device debugging. The plugin translates a vendor’s device debugging API into concepts LLDB already understands, such as processes, threads, registers, memory, modules, and stop reasons.
Takeaways
The accelerator plugin architecture in lldb-server separates shared debugger infrastructure from hardware-specific device control, keeping the LLDB client vendor-neutral.
CPU and GPU are represented as separate LLDB targets, each with its own architecture, threads, registers, and address space, avoiding incompatible concepts in a single process model.
A mock accelerator plugin allows the LLVM test suite to verify discovery, breakpoint coordination, and connection creation without specialized hardware.
FAQ
How does LLDB present CPU and GPU in one session?
The architecture represents the CPU and accelerator as separate LLDB targets, each with its own architecture, threads, registers, and address space. A plugin in lldb-server coordinates host and device debugging, so the two targets remain technically independent but appear in one LLDB or IDE session.
Does the plugin affect CPU-only debugging?
GPU debugging support is activated only when the debugged application uses a supported GPU runtime. For CPU-only applications, LLDB and lldb-server continue through the existing native debugging path without incurring runtime computational overhead.
How is the plugin tested without real hardware?
A mock accelerator plugin exercises the flow without specialized hardware, letting the LLVM test suite verify discovery, breakpoint coordination, connection creation, and basic device state. This allows shared infrastructure to be reviewed and tested independently of any particular GPU.
Source and freshness
- Source
- engineering.fb.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.