Message ID | 20221206135729.3937767-1-simon.marchi@efficios.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 490AE3842305 for <patchwork@sourceware.org>; Tue, 6 Dec 2022 13:58:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 490AE3842305 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670335116; bh=aJEUdbTg8NyQewzTE0P459UQfvO5CEKb7ZT+bd0aQ9A=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=I4fbRqOUHpFBGQ7zOh4rTt37EB15P1xFmQMsAHXooC6AbxoC6YrzV/fycznHiSY19 B1FqTUMAXdW/BbHU+XKeu0x70rFLEZn391bdaVzNVKUl+6TwCeqrgvKnVZsiDTOfuf 0aEEt0HqOjBfmprMtnWPMozBPZDcwZstFHbIWQ4Y= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 0FF4C3864A38 for <gdb-patches@sourceware.org>; Tue, 6 Dec 2022 13:57:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0FF4C3864A38 X-ASG-Debug-ID: 1670335051-0c856e762b1bae0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id vPc6FKONgAByKO5l (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Tue, 06 Dec 2022 08:57:31 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id DF8AA441D64; Tue, 6 Dec 2022 08:57:31 -0500 (EST) X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi <simon.marchi@efficios.com> Subject: [PATCH 00/12] Initial support for ROCm platform (AMDGPU) debugging Date: Tue, 6 Dec 2022 08:57:17 -0500 X-ASG-Orig-Subj: [PATCH 00/12] Initial support for ROCm platform (AMDGPU) debugging Message-Id: <20221206135729.3937767-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1670335051 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 6230 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.102644 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3492.3 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Simon Marchi <simon.marchi@efficios.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Initial support for ROCm platform (AMDGPU) debugging
|
|
Message
Simon Marchi
Dec. 6, 2022, 1:57 p.m. UTC
This patch series adds initial support for debugging programs offloaded to AMD GPUs using the ROCm platform. Patches 1 to 11 are preparatory patches, and patch 12 is the big one. We included in that patch only what we consider to be the bare minimum for a cohesive first step, something that can be run and tested. See the commit message of patch 12 for more details. At the end of this series, it is possible to hit breakpoints in GPU code and resume execution until the end of the program. Notably, GDB is not able to compute the backtrace, which is of course an important piece to do any real debugging. Supporting this will require GDB to support some extensions to DWARF, which is a big piece in itself. This part, as well as other features, will come as future patches. Patch 12 also contains documentation changes. This series was tested on Ubuntu 22.04, and no regressions appear for x86-64 / Linux debugging when and the AMDGPU / ROCm platform support is compiled in. Built-tested with --enable-targets=all. Porting GDB to the ROCm platform brought up many challenges and has a few interesting differences, compared to a "standard" CPU port. We did a presentation at the 2022 Cauldron, in Prague, that explains some of them: https://www.youtube.com/watch?v=X1iZ_Ta7jOo Lancelot SIX (1): gdb: add supports_arch_info callback to gdbarch_register Pedro Alves (1): gdb: make install_breakpoint return a non-owning reference Simon Marchi (10): gdbsupport: add type definitions for pid, lwp and tid gdb: add inferior_pre_detach observable gdb: make gdbarch_alloc take ownership of the tdep gdb: add gdbarch_up gdbsupport: move libxxhash configure check to gdbsupport gdbsupport: move fast_hash to gdbsupport/common-utils.h gdbsupport: add gdb::string_view_hash gdb/solib-svr4: don't disable probes interface if probe not found gdb: make gdb_printing_disassembler::stream public gdb: initial support for ROCm platform (AMDGPU) debugging gdb/Makefile.in | 17 +- gdb/NEWS | 7 + gdb/README | 15 + gdb/aarch64-tdep.c | 5 +- gdb/alpha-tdep.c | 7 +- gdb/amd-dbgapi-target.c | 1966 +++++++++++++++ gdb/amd-dbgapi-target.h | 116 + gdb/amdgpu-tdep.c | 1367 ++++++++++ gdb/amdgpu-tdep.h | 93 + gdb/arc-tdep.c | 6 +- gdb/arch-utils.c | 11 +- gdb/arm-tdep.c | 6 +- gdb/avr-tdep.c | 6 +- gdb/bfin-tdep.c | 6 +- gdb/bpf-tdep.c | 4 +- gdb/breakpoint.c | 4 +- gdb/breakpoint.h | 8 +- gdb/configure | 3863 +++++++++++++++-------------- gdb/configure.ac | 75 +- gdb/configure.tgt | 23 +- gdb/cris-tdep.c | 6 +- gdb/csky-tdep.c | 7 +- gdb/disasm.h | 4 +- gdb/doc/gdb.texinfo | 758 ++++++ gdb/frv-tdep.c | 15 +- gdb/ft32-tdep.c | 6 +- gdb/gdbarch.c | 6 +- gdb/gdbarch.h | 17 +- gdb/hppa-tdep.c | 7 +- gdb/i386-tdep.c | 7 +- gdb/ia64-tdep.c | 7 +- gdb/lm32-tdep.c | 6 +- gdb/loongarch-tdep.c | 6 +- gdb/m32c-tdep.c | 5 +- gdb/m32r-tdep.c | 6 +- gdb/m68hc11-tdep.c | 7 +- gdb/m68k-tdep.c | 7 +- gdb/mep-tdep.c | 7 +- gdb/microblaze-tdep.c | 5 +- gdb/mips-tdep.c | 7 +- gdb/mn10300-tdep.c | 6 +- gdb/moxie-tdep.c | 6 +- gdb/msp430-tdep.c | 7 +- gdb/nds32-tdep.c | 8 +- gdb/nios2-tdep.c | 6 +- gdb/observable.c | 1 + gdb/observable.h | 3 + gdb/or1k-tdep.c | 7 +- gdb/regcache.c | 3 +- gdb/riscv-tdep.c | 7 +- gdb/rl78-tdep.c | 7 +- gdb/rs6000-tdep.c | 8 +- gdb/rx-tdep.c | 7 +- gdb/s12z-tdep.c | 4 +- gdb/s390-tdep.c | 13 +- gdb/s390-tdep.h | 2 + gdb/sh-tdep.c | 6 +- gdb/solib-rocm.c | 679 +++++ gdb/solib-svr4.c | 15 +- gdb/sparc-tdep.c | 6 +- gdb/symtab.c | 2 +- gdb/target.c | 2 + gdb/testsuite/gdb.rocm/simple.cpp | 48 + gdb/testsuite/gdb.rocm/simple.exp | 52 + gdb/testsuite/lib/future.exp | 38 + gdb/testsuite/lib/gdb.exp | 7 + gdb/testsuite/lib/rocm.exp | 94 + gdb/tic6x-tdep.c | 6 +- gdb/utils.h | 19 - gdb/v850-tdep.c | 7 +- gdb/xtensa-config.c | 4 +- gdb/xtensa-tdep.c | 10 +- gdb/z80-tdep.c | 6 +- gdbserver/config.in | 3 + gdbserver/configure | 514 ++++ gdbsupport/Makefile.in | 3 + gdbsupport/common-utils.h | 38 + gdbsupport/common.m4 | 24 + gdbsupport/config.in | 3 + gdbsupport/configure | 514 ++++ gdbsupport/ptid.h | 18 +- 81 files changed, 8644 insertions(+), 2070 deletions(-) create mode 100644 gdb/amd-dbgapi-target.c create mode 100644 gdb/amd-dbgapi-target.h create mode 100644 gdb/amdgpu-tdep.c create mode 100644 gdb/amdgpu-tdep.h create mode 100644 gdb/solib-rocm.c create mode 100644 gdb/testsuite/gdb.rocm/simple.cpp create mode 100644 gdb/testsuite/gdb.rocm/simple.exp create mode 100644 gdb/testsuite/lib/rocm.exp
Comments
On 12/6/22 08:57, Simon Marchi via Gdb-patches wrote: > This patch series adds initial support for debugging programs offloaded > to AMD GPUs using the ROCm platform. > > Patches 1 to 11 are preparatory patches, and patch 12 is the big one. > We included in that patch only what we consider to be the bare minimum > for a cohesive first step, something that can be run and tested. See > the commit message of patch 12 for more details. > > At the end of this series, it is possible to hit breakpoints in GPU code > and resume execution until the end of the program. Notably, GDB is not > able to compute the backtrace, which is of course an important piece to > do any real debugging. Supporting this will require GDB to support some > extensions to DWARF, which is a big piece in itself. This part, as well > as other features, will come as future patches. > > Patch 12 also contains documentation changes. This series was tested on > Ubuntu 22.04, and no regressions appear for x86-64 / Linux debugging > when and the AMDGPU / ROCm platform support is compiled in. > Built-tested with --enable-targets=all. > > Porting GDB to the ROCm platform brought up many challenges and has a > few interesting differences, compared to a "standard" CPU port. We did > a presentation at the 2022 Cauldron, in Prague, that explains some of > them: > > https://www.youtube.com/watch?v=X1iZ_Ta7jOo FYI, I pushed patches 5, 7, 8 and 9, since they seemed like good changes, independently from this series (and they were LGTM'ed by Andrew). Simon