CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
209 lines
6.7 KiB
Plaintext
209 lines
6.7 KiB
Plaintext
# Copyright (C) 2019-2024 Free Software Foundation, Inc.
|
|
# Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights reserved.
|
|
|
|
# This file is part of GDB.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# exp_internal 1
|
|
|
|
load_lib rocm.exp
|
|
|
|
require allow_hip_tests
|
|
|
|
standard_testfile .cpp
|
|
|
|
set num_waves 16
|
|
|
|
# Some GPUs have 32 lanes per wave, while others have 64. Use 32
|
|
# threads per block so that we can control number of waves using the
|
|
# number of blocks on all GPUs.
|
|
set options [list \
|
|
debug \
|
|
hip \
|
|
additional_flags=-DGRID_DIM=$num_waves \
|
|
additional_flags=-DBLOCK_DIM=32 \
|
|
]
|
|
if {[prepare_for_testing "failed to prepare ${testfile}" \
|
|
$testfile $srcfile $options]} {
|
|
return -1
|
|
}
|
|
|
|
# Run and wait until all threads/waves report a breakpoint hit.
|
|
|
|
proc run_and_wait {test} {
|
|
global gdb_prompt
|
|
global num_waves
|
|
|
|
set hits 0
|
|
|
|
# Use background "run" so that we get the prompt immediately.
|
|
gdb_test_multiple "run&" $test {
|
|
-re "$gdb_prompt" {
|
|
gdb_test_multiple "" $test {
|
|
-re "hit Breakpoint \[1-9\]" {
|
|
incr hits
|
|
if {$hits < $num_waves} {
|
|
exp_continue
|
|
} else {
|
|
pass $test
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
with_rocm_gpu_lock {
|
|
|
|
if ![runto_main] {
|
|
fail "can't run to main"
|
|
return -1
|
|
}
|
|
|
|
# Fetch the thread id of the first wave and the number of available GPUs.
|
|
|
|
# Set breakpoint in device code.
|
|
gdb_breakpoint "VectorAdd" "allow-pending"
|
|
gdb_continue_to_breakpoint "continue to VectorAdd"
|
|
set threadid [get_valueof "" "\$_thread" 0]
|
|
|
|
if {$threadid == ""} {
|
|
return
|
|
}
|
|
|
|
verbose -log "threadid=$threadid"
|
|
|
|
clean_restart ${binfile}
|
|
|
|
# Turn on non-stop mode.
|
|
with_test_prefix "non-stop" {
|
|
gdb_test_no_output "set non-stop on"
|
|
gdb_test_no_output "set environment HIP_ENABLE_DEFERRED_LOADING=0"
|
|
gdb_breakpoint "VectorAdd" "allow-pending"
|
|
|
|
run_and_wait "run to VectorAdd Breakpoint"
|
|
|
|
gdb_test "thread $threadid" \
|
|
"Switching to thread $threadid, lane 0 \\(AMDGPU Lane .*" \
|
|
"thread TID before inferior exit"
|
|
gdb_test "continue -a" {.+Inferior\s[\d].+\sexited\snormally.+}
|
|
|
|
run_and_wait "run to VectorAdd Breakpoint after inferior exit"
|
|
|
|
gdb_test "thread $threadid" \
|
|
"Switching to thread $threadid, lane 0 \\(AMDGPU Lane .*" \
|
|
"thread TID after run to VectorAdd"
|
|
}
|
|
|
|
# Check "info agents".
|
|
# vega10 sample output "1 A (GPUID 39113) gfx900 vega10 224 2240 44:00.0"
|
|
# vega20 sample output "2 A (GPUID 45151) gfx906 vega20 240 2400 0a:00.0"
|
|
gdb_test_sequence "info agents" "info agents" {
|
|
{Id\s+State\s+Target Id\s+Architecture\s+Device Name\s+Cores\s+Threads\s+Location}
|
|
{\d+\s+[AU]\s+AMDGPU Agent \([^\)]*\)\s+\w+\s+[^\r\n]+\s+\d+\s+\d+\s+\w+:\w+:\d+\.\d}
|
|
}
|
|
|
|
# Check "info threads".
|
|
# Sample output:
|
|
#* 5 AMDGPU Wave 1:1:1:1 (0,0,0)/0 "bit_extract_kernel" bit_extract_kernel () at bit_extract.cpp:38
|
|
# 6 AMDGPU Wave 1:1:1:1 (0,0,0)/1 "bit_extract_kernel" __hip_get_block_dim_x ()
|
|
gdb_test_sequence "info threads" "info threads" {
|
|
{Id\s+Target\s+Id\s+Frame}
|
|
{\d+\s+AMDGPU\sWave\s\d+\:\d+:\d+:\d+}
|
|
}
|
|
|
|
# Show architecture info while debugging in device code.
|
|
# Sample output "The target architecture is set automatically (currently amdgcn:gfx906)"
|
|
gdb_test "show architecture" \
|
|
{The target architecture is set to "auto" \(currently "amdgcn:gfx\w+"\)\.}
|
|
|
|
gdb_test_sequence "show convenience" "show convenience" {
|
|
{\$_thread = \d+}
|
|
{\$_wave_id = \"\(\d+,\d+,\d+\)/\d+\"}
|
|
}
|
|
|
|
|
|
# Check "info sharedlibrary"
|
|
# Sample output
|
|
# From To Syms Read Shared Object Library
|
|
# 0x00007ffbdfe05000 0x00007ffbdfe07a2c Yes (*) AMDGPU shared object [loaded from memory 0xab9900..0xac3470]
|
|
# 0x00007ffbdc201000 0x00007ffbdc201c94 Yes AMDGPU shared object [loaded from memory 0x9b71d0..0x9bae28]
|
|
# gdb_test_sequence "info sharedlibrary" "info sharedlibrary" {
|
|
# {From\s+To\s+Syms\s+Read\s+Shared Object Library}
|
|
# {0x[0-9a-fA-F]+\s+0x[0-9a-fA-F]+\s+Yes\s\(\*\)\s+AMDGPU shared object.}
|
|
# {0x[0-9a-fA-F]+\s+0x[0-9a-fA-F]+\s+Yes\s+AMDGPU shared object.}
|
|
# }
|
|
|
|
|
|
# Check "info break".
|
|
# Sample output:
|
|
# Num Type Disp Enb Address What
|
|
# 1 breakpoint keep y 0x00007ffbdc2012dc in bit_extract_kernel() at bit_extract.cpp:38
|
|
# breakpoint already hit 1 time
|
|
gdb_test_sequence "info break" "info break" {
|
|
{Num\s+Type\s+Disp\sEnb Address\s+What}
|
|
{\d+\s+breakpoint\s+keep\s+y}
|
|
{breakpoint already hit\s\d+\stime}
|
|
}
|
|
|
|
|
|
# Check "info inferiors".
|
|
# Num Description Executable
|
|
# * 1 process 34544 /home/amd/rohit/samples/0_Intro/bit_extract/bit_extrac
|
|
gdb_test_sequence "info inferiors" "info inferiors" {
|
|
{Num\s+Description\s+Connection\s+Executable}
|
|
{\*\s\d+\s+process\s+\d+}
|
|
}
|
|
|
|
gdb_test "disable 1"
|
|
gdb_test "continue -a" {.+Inferior\s\d+.+\sexited\snormally.+} \
|
|
"continue -a after disable 1"
|
|
gdb_test "run" {.+Inferior\s[\d].+\sexited\snormally.+}
|
|
gdb_test "enable 1"
|
|
run_and_wait "run to VectorAdd after disable/enable Breakpoint No"
|
|
|
|
gdb_test "clear VectorAdd"
|
|
gdb_test "continue -a" {.+Inferior\s\d+.+\sexited\snormally.+} \
|
|
"continue -a after clear VectorAdd"
|
|
gdb_test "start" {.+hit\sTemporary\sbreakpoint\s[\d].*}
|
|
gdb_test "continue" {.+Inferior\s[\d].+\sexited\snormally.+} \
|
|
"continue after start"
|
|
|
|
gdb_breakpoint "VectorAdd" "allow-pending"
|
|
run_and_wait "Again setting Breakpoint and running to Breakpoint after inferior exit"
|
|
|
|
gdb_test "continue -a" {.+Inferior\s[\d].+\sexited\snormally.+} \
|
|
"continue -a until exit"
|
|
|
|
# Switch to all stop mode.
|
|
with_test_prefix "all-stop" {
|
|
gdb_test_no_output "set non-stop off"
|
|
gdb_test "run" {.+hit\sBreakpoint\s\d+.+\sVectorAdd\s\(.*\)\sat.*}
|
|
gdb_test "continue" {.+hit\sBreakpoint\s\d+.+\sVectorAdd\s\(.*\)\sat.*}
|
|
gdb_test "disable 3"
|
|
gdb_test "continue" {.+Inferior\s[\d].+\sexited\snormally.+} \
|
|
"continue after disable 3"
|
|
gdb_test "run" {.+Inferior\s[\d].+\sexited\snormally.+} \
|
|
"run after exit"
|
|
gdb_test "enable 3"
|
|
gdb_test "run" {.+hit\sBreakpoint\s[\d].+\sVectorAdd\s\(.*\)\sat.*} \
|
|
"run after enable 3"
|
|
gdb_test "clear VectorAdd"
|
|
gdb_test "continue" {.+Inferior\s[\d].+\sexited\snormally.+} \
|
|
"continue after clear VectorAdd"
|
|
}
|
|
|
|
}
|