Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0a7f10f
[+] CI: test gpu examples
Sy0307 Nov 3, 2025
909529f
fix
Sy0307 Nov 3, 2025
60fe4f4
fix
Sy0307 Nov 3, 2025
1ed6604
[~] Fix
Sy0307 Nov 8, 2025
48c06d0
[+] fix:remove ubpf_vm build
Sy0307 Nov 8, 2025
2ef2215
[~] Fix: Add libelf-dev & zlib1g-dev
Sy0307 Nov 8, 2025
511493d
[+] Add clang-18 dependency
Sy0307 Nov 8, 2025
7e18ee2
[~] Fix:Remove script
Sy0307 Nov 8, 2025
3bec9d6
[~] Fix: fix bad bash lines
Sy0307 Nov 8, 2025
2496797
[~] Fix:Reduce shm size
Sy0307 Nov 8, 2025
f2c0d69
[+] Fix: fix error of "SM version specified by .target is higher than…
Sy0307 Nov 8, 2025
a49b46a
[+] Fix:Add default sm version
Sy0307 Nov 8, 2025
1f1718a
[+] Fix:fix for sm version error
Sy0307 Nov 8, 2025
653cf68
[+] Fix: Set GPU SM to sm_61 for NVPTX
Sy0307 Nov 8, 2025
e408bd7
[+] Feat: Add gpu_shard_array example & fix errors
Sy0307 Nov 8, 2025
f5b5e9c
[~] Fix
Sy0307 Nov 8, 2025
51123c6
[~] Fix:update upload-artifact version
Sy0307 Nov 8, 2025
f36db4e
[~] Revert: revert fatbin_record changes
Sy0307 Nov 8, 2025
4947ec6
[~] Fix:re-test
Sy0307 Nov 9, 2025
9715754
[~] Fix: fix timeout error
Sy0307 Nov 9, 2025
dba3db0
[~] Fix: fix BPFTIME_SHM_MEMORY_MB error & SM version error
Sy0307 Nov 9, 2025
ca9182e
[+] Fix: solve sm version error
Sy0307 Nov 9, 2025
d720bc3
[+] feat: cancel hardcode on sm version
Sy0307 Nov 9, 2025
6e0b38c
[~] Fix:revert some modifications
Sy0307 Nov 9, 2025
7bf4752
[~] Fix:fix the method of passing
Sy0307 Nov 9, 2025
4f01c9d
[~] Fix: Add more slots for error of sm version
Sy0307 Nov 9, 2025
5b1017d
[~] Fix:force to re-build
Sy0307 Nov 9, 2025
68219f6
[~] fix: remove hard sm target setting
Sy0307 Nov 9, 2025
5608c16
[~] Fix: add more reasonable detection logic
Sy0307 Nov 9, 2025
815d9fb
[~] Fix: fix log error
Sy0307 Nov 9, 2025
c2ba075
[~] Feat: Add device_default_target config
Sy0307 Nov 9, 2025
529d575
[~] Fix
Sy0307 Nov 10, 2025
ae190bd
[+] Fix: fix compile error
Sy0307 Nov 10, 2025
11b08b7
[~] Fix
Sy0307 Nov 10, 2025
1058443
[~] Fix:test
Sy0307 Nov 10, 2025
f333574
[~] Fix
Sy0307 Nov 10, 2025
49e9a34
[~] Fix: bpf_main remove error
Sy0307 Nov 10, 2025
0237496
[~] Fix: remove more
Sy0307 Nov 10, 2025
3b7d8a7
[~] Fix
Sy0307 Nov 11, 2025
157da53
[~] Fix:fix bug of ptx
Sy0307 Nov 11, 2025
ea80022
Fix:fix regrex
Sy0307 Nov 11, 2025
930c5f3
[~] Fix: Syntax error
Sy0307 Nov 11, 2025
48f7994
Fix: fix more syntax error
Sy0307 Nov 11, 2025
f6a2ff0
[~] Test
Sy0307 Nov 11, 2025
b763d12
test
Sy0307 Nov 11, 2025
d26c1c8
fix
Sy0307 Nov 11, 2025
bfd0b02
test
Sy0307 Nov 11, 2025
74b3144
[~] Fix
Sy0307 Nov 11, 2025
33f64e6
fix
Sy0307 Nov 11, 2025
ddc0fd6
revert
Sy0307 Nov 11, 2025
3bc5679
fix
Sy0307 Nov 11, 2025
2aaf31d
fix
Sy0307 Nov 11, 2025
7bb9f17
fix
Sy0307 Nov 11, 2025
31d0dab
test
Sy0307 Nov 11, 2025
be07066
[~] Fix: Use per-thread buffers and dirty flag for thread safety, ens…
Sy0307 Nov 12, 2025
2cf288b
[+] Fix: Enhance stdout behavior for better log visibility by enablin…
Sy0307 Nov 12, 2025
f7ab31b
[+] Update: Set max-parallel to 1 in GPU test workflow to control job…
Sy0307 Nov 12, 2025
3f87514
[+] Add: Implement CUDA context helper functions to ensure device can…
Sy0307 Nov 12, 2025
110f38b
[+] Add: Implement rebase functionality for GPU ring buffer map point…
Sy0307 Nov 12, 2025
2bf1866
[+] Update: Change include directive for bpftime_shm_internal.hpp to …
Sy0307 Nov 12, 2025
31f87ca
[+] Update: Remove legacy rebase functionality for GPU ring buffer ma…
Sy0307 Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ concurrency:

jobs:
build-and-run:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-gcc13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:

jobs:
build:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-24.04
steps:
- name: Checkout repository (with submodules)
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ concurrency:
cancel-in-progress: true
jobs:
build-and-push-image:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-latest
# run only when code is compiling and tests are passing
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
# steps to perform in job
steps:
- name: Checkout code
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-attach.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:

jobs:
build_and_test_attach:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: "ubuntu-latest"
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-bpftrace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:

jobs:
build-and-run-syscall-tracing-load-start-test:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-22.04
container:
image: "manjusakalza/bpftime-base-image:ubuntu-2204"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
BPFTIME_VM_NAME: llvm
jobs:
build-runtime:
if: false # Disabled to save CI resources on dev/gpu_example branch
strategy:
matrix:
enable_jit:
Expand Down
267 changes: 267 additions & 0 deletions .github/workflows/test-gpu-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
name: Build and run GPU integrated tests (examples)

on:
workflow_dispatch:
push:
branches: ["*"]
pull_request:
branches: ["master", "main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

env:
BPFTIME_VM_NAME: llvm

jobs:
build-and-test-gpu-examples:
runs-on: [self-hosted, Linux, X64, gpu]
strategy:
fail-fast: false
max-parallel: 1
matrix:
examples:
- path: kernelretsnoop
executable: ./kernelretsnoop
victim: ./vec_add
expected_str: "Thread ("
name: kernelretsnoop
server_timeout: 15
- path: threadhist
executable: ./threadhist
victim: ./vec_add
expected_str: "Thread "
name: threadhist
server_timeout: 15
- path: cuda-counter
executable: ./cuda_probe
victim: ./vec_add
expected_str: "calls:"
name: cuda-counter
server_timeout: 15
- path: launchlate
executable: ./launchlate
victim: ./vec_add
expected_str: "Monitoring CUDA kernel launch latency"
name: launchlate
server_timeout: 15
- path: mem_trace
executable: ./mem_trace
victim: ./vec_add
expected_str: "counter[0]="
name: mem_trace
server_timeout: 15

steps:
- name: Configure proxy for China
run: |
echo "Setting up proxy for China network..."
export http_proxy=http://192.168.15.1:2345
export https_proxy=http://192.168.15.1:2345
export HTTP_PROXY=http://192.168.15.1:2345
export HTTPS_PROXY=http://192.168.15.1:2345
export no_proxy=localhost,127.0.0.1,192.168.0.0/16
echo "http_proxy=http://192.168.15.1:2345" >> $GITHUB_ENV
echo "https_proxy=http://192.168.15.1:2345" >> $GITHUB_ENV
echo "HTTP_PROXY=http://192.168.15.1:2345" >> $GITHUB_ENV
echo "HTTPS_PROXY=http://192.168.15.1:2345" >> $GITHUB_ENV
echo "no_proxy=localhost,127.0.0.1,192.168.0.0/16" >> $GITHUB_ENV
git config --global --add http.proxy http://192.168.15.1:2345
git config --global --add https.proxy http://192.168.15.1:2345

- uses: actions/checkout@v4
with:
submodules: recursive


- name: Check and install required tools
run: |
echo "Checking installed tools..."
sudo apt-get update -y
sudo apt-get install -y build-essential llvm-dev llvm-18-dev cmake \
libboost-all-dev libzstd-dev pkg-config ninja-build \
libelf-dev zlib1g-dev libcurl4-openssl-dev \
clang clang-18 gdb

# Check CUDA
nvcc --version || echo "nvcc not found (CUDA compiler)"
echo "CUDA location: $(which nvcc)"

- name: Print GPU info
run: |
echo "GPU inventory:"
nvidia-smi --query-gpu=index,name,driver_version,compute_cap --format=csv

- name: Build bpftime with CUDA support (LLVM JIT)
shell: bash
run: |
set -e
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Debug \
-DBPFTIME_LLVM_JIT=YES \
-DBPFTIME_ENABLE_CUDA_ATTACH=ON \
-DBPFTIME_CUDA_ROOT="/usr/local/cuda-12.6" \
-DLLVM_DIR="/usr/lib/llvm-18/lib/cmake/llvm/" \
-G Ninja
set +e
cmake --build build --config Debug --target bpftime-agent bpftime-syscall-server ptxpass_kprobe_entry ptxpass_kretprobe ptxpass_kprobe_memcapture -j$(nproc) --verbose -- -v | tee build_llvm_verbose.log
BUILD_RC=${PIPESTATUS[0]}
set -e
if [ $BUILD_RC -ne 0 ]; then
echo "Build failed. Showing last 300 lines of build_llvm_verbose.log:"
tail -n 300 build_llvm_verbose.log || true
exit $BUILD_RC
fi

- name: Build GPU example
run: |
echo "Building GPU example: ${{matrix.examples.path}}"
# Prefer system clang; fallback to clang-18 if needed
if ! command -v clang >/dev/null 2>&1 && command -v clang-18 >/dev/null 2>&1; then
export CLANG=clang-18
fi
make -C example/gpu/${{matrix.examples.path}} -j

- name: Test GPU example (per README two-process)
shell: bash
run: |
set -xeuo pipefail
ROOT_DIR=$(pwd)
EXAMPLE_DIR="$ROOT_DIR/example/gpu/${{matrix.examples.path}}"
BUILD_DIR="$ROOT_DIR/build"
SERVER_SO="$BUILD_DIR/runtime/syscall-server/libbpftime-syscall-server.so"
AGENT_SO="$BUILD_DIR/runtime/agent/libbpftime-agent.so"
EXE="$EXAMPLE_DIR/${{ matrix.examples.executable }}"
VICTIM="$EXAMPLE_DIR/${{ matrix.examples.victim }}"
EXPECTED="${{ matrix.examples.expected_str }}"
EXAMPLE_NAME="${{ matrix.examples.name }}"
CLIENT_TIMEOUT=60
# enable more logs and coredumps
export SPDLOG_LEVEL=trace
export BPFTIME_LOG_LEVEL=TRACE
export CUDA_LAUNCH_BLOCKING=1
export CUDA_MODULE_LOADING=LAZY
ulimit -c unlimited || true
# Clean up any previous bpftime processes and shared memory
echo "Cleaning up previous bpftime processes and shared memory..."
# Kill all bpftime related processes
pkill -9 -f "LD_PRELOAD.*libbpftime.*\.so" || true
pkill -9 -f "kernelretsnoop" || true
pkill -9 -f "threadhist" || true
pkill -9 -f "cuda_probe" || true
pkill -9 -f "launchlate" || true
pkill -9 -f "mem_trace" || true
pkill -9 -f "vec_add" || true
sleep 2
# Remove all bpftime shared memory segments and semaphores
rm -f /dev/shm/bpftime_maps_shm || true
rm -f /dev/shm/sem.bpftime_maps_shm* || true
rm -f /dev/shm/bpftime* || true
rm -f /dev/shm/sem.bpftime* || true
# Also clean up any POSIX message queues if they exist
rm -f /dev/mqueue/bpftime* || true
# Show what's left
echo "Remaining shared memory files:"
ls -la /dev/shm/ 2>/dev/null | grep -i bpftime || echo "No bpftime shared memory found"
# Clean up any leftover temporary files/directories quietly
shopt -s nullglob
for path in /tmp/bpftime-* /tmp/bpftime-mock.* /tmp/bpftime-fatbin-work.* /tmp/ptx_register_guard_output_*.ptx; do
rm -rf "$path" || true
done
shopt -u nullglob
# ensure previous logs do not interfere
rm -f server.log client.log || true
# tune shared memory size per example (ringbuf-heavy examples need more)
SHM_MB=16
case "$EXAMPLE_NAME" in
kernelretsnoop) SHM_MB=64 ;; # ringbuf map needs larger shm
esac
echo "Launching server with $SERVER_SO: $EXE (BPFTIME_SHM_MEMORY_MB=$SHM_MB)"
BPFTIME_SHM_MEMORY_MB=$SHM_MB BPFTIME_LOG_OUTPUT=console LD_PRELOAD="$SERVER_SO" "$EXE" > server.log 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
sleep 5
if ! kill -0 "$SERVER_PID" 2>/dev/null; then
echo "Server crashed early. Showing server.log tail:"; tail -n 200 server.log || true
exit 1
fi
echo "Launching client with $AGENT_SO: $VICTIM"
set +e
timeout -s SIGKILL ${CLIENT_TIMEOUT}s env BPFTIME_LOG_OUTPUT=console LD_PRELOAD="$AGENT_SO" bash -lc "$VICTIM" > client.log 2>&1
CLIENT_RC=$?
set -e
echo "Checking expected output: $EXPECTED"
# treat crashes as failure even if expected string appears
if grep -Eiq "(core dumped|Segmentation fault|Aborted)" server.log client.log; then
echo "Detected crash in logs"; tail -n 200 server.log || true; tail -n 200 client.log || true; RESULT=1
else
EXAMPLE_NAME="${{ matrix.examples.name }}"
FOUND=1
case "$EXAMPLE_NAME" in
cuda-counter)
if grep -Fq "calls:" server.log || grep -Fq "C[0] =" client.log || grep -Fq "C[1] =" client.log; then
FOUND=0
fi
;;
mem_trace)
if grep -Fq "counter[0]=" server.log || grep -Fq "mem_traces:" server.log; then
FOUND=0
fi
;;
*)
if grep -Fq "$EXPECTED" server.log client.log; then
FOUND=0
fi
;;
esac
if [ $FOUND -eq 0 ]; then
echo "SUCCESS: found README-like output for $EXAMPLE_NAME"
RESULT=0
else
echo "FAILURE: expected output not found for $EXAMPLE_NAME"
echo "--- server.log (tail) ---"; tail -n 200 server.log || true
echo "--- client.log (tail) ---"; tail -n 200 client.log || true
RESULT=1
fi
fi
# Collect extra diagnostics
cat /proc/$SERVER_PID/maps > server.maps 2>/dev/null || true
dmesg | tail -n 200 > dmesg_tail.log 2>/dev/null || true
nvidia-smi -L > nvidia_smi_l.log 2>&1 || true
nvidia-smi -q -x > nvidia_smi_q.xml 2>&1 || true
# Collect debug PTX files
cp /tmp/ptx_register_guard_output_*.ptx . 2>/dev/null || true
cp /tmp/bpftime-fatbin-work.*/patched.*.ptx . 2>/dev/null || true
# Show error context from the last patched PTX file around line 819
LAST_PTX=$(ls -t /tmp/bpftime-fatbin-work.*/patched.*.ptx 2>/dev/null | head -1)
if [ -f "$LAST_PTX" ]; then
echo "=== Showing lines 810-830 from $LAST_PTX ==="
sed -n '810,830p' "$LAST_PTX" || true
fi
# Try backtrace core files if any
CORES=$(ls -1 core* 2>/dev/null || true)
if [ -n "$CORES" ]; then
for c in $CORES; do
gdb -q -batch -ex "thread apply all bt full" -ex "info registers" -ex quit "$VICTIM" "$c" > "$c.bt" 2>&1 || true
done
fi
kill $SERVER_PID 2>/dev/null || true
exit $RESULT

- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: gpu-example-${{ matrix.examples.name }}-logs
path: |
server.log
client.log
server.maps
dmesg_tail.log
nvidia_smi_l.log
nvidia_smi_q.xml
ptx_register_guard_output_*.ptx
patched.*.ptx
core*
*.bt
1 change: 1 addition & 0 deletions .github/workflows/test-nginx-attach.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
build-and-test:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-latest
container:
image: debian:12
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-ptxpass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:

jobs:
test-ptxpass:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: [self-hosted, Linux, X64, gpu]
steps:
- name: Configure proxy for China
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:

jobs:
build:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: "ubuntu-latest"
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ concurrency:
cancel-in-progress: true
jobs:
build:
if: false # Disabled to save CI resources on dev/gpu_example branch
strategy:
matrix:
container:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ concurrency:
cancel-in-progress: true
jobs:
build-and-run-verifier-test-target:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ concurrency:
cancel-in-progress: true
jobs:
build:
if: false # Disabled to save CI resources on dev/gpu_example branch
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
Loading
Loading