Skip to content

Commit f2e7bfe

Browse files
authored
Merge pull request #2 from walidbr/vulkan_perfetto
Vulkan perfetto
2 parents 8b67284 + 784fcc1 commit f2e7bfe

File tree

4 files changed

+72
-31
lines changed

4 files changed

+72
-31
lines changed

.github/workflows/close-issue.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/vulkan-build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Vulkan Build (No Run)
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build-vulkan:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
with:
13+
submodules: recursive
14+
15+
- name: Install build tools
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y \
19+
gcc-aarch64-linux-gnu \
20+
g++-aarch64-linux-gnu \
21+
cmake \
22+
make \
23+
wget \
24+
tar \
25+
unzip \
26+
curl \
27+
libcurl4-openssl-dev \
28+
libvulkan-dev \
29+
vulkan-tools \
30+
build-essential
31+
32+
- name: Install Vulkan SDK
33+
run: |
34+
wget https://sdk.lunarg.com/sdk/download/1.4.321.1/linux/vulkansdk-linux-x86_64-1.4.321.1.tar.xz -O vulkansdk.tar.xz \
35+
&& tar -xf vulkansdk.tar.xz -C ./ \
36+
&& rm vulkansdk.tar.xz
37+
- name: Install Android NDK
38+
run: |
39+
wget https://dl.google.com/android/repository/android-ndk-r27d-linux.zip -O android-ndk.zip \
40+
&& unzip android-ndk.zip -d ./ \
41+
&& rm android-ndk.zip
42+
- name: Set environment variables
43+
run: |
44+
echo "VULKAN_SDK=$(pwd)/1.4.321.1/x86_64" >> $GITHUB_ENV
45+
echo "PATH=$(pwd)/1.4.321.1/x86_64/bin:$PATH:$(pwd)/android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_ENV
46+
echo "VK_LAYER_PATH=$(pwd)/1.4.321.1/x86_64/etc/vulkan/explicit_layer.d" >> $GITHUB_ENV
47+
echo "Vulkan_INCLUDE_DIR=$(pwd)/1.4.321.1/x86_64/include" >> $GITHUB_ENV
48+
echo "Vulkan_LIBRARY=$(pwd)/1.4.321.1/x86_64/lib/libvulkan.so" >> $GITHUB_ENV
49+
echo "GLSLC=$(pwd)/1.4.321.1/x86_64/bin/glslc" >> $GITHUB_ENV
50+
- name: Configure (CMake, Vulkan enabled)
51+
env:
52+
VULKAN_SDK: ${{ env.VULKAN_SDK }}
53+
PATH: ${{ env.PATH }}
54+
run: |
55+
cmake -S . -B build-vk -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGGML_VULKAN=ON
56+
- name: Build
57+
run: |
58+
cmake --build build-vk -j8
59+
- name: Verify build outputs
60+
run: |
61+
ls -la build-vk/bin || true
62+
test -e build-vk/bin/llama-cli
63+
- name: Show test command (not executed)
64+
run: |
65+
echo "To run (requires Vulkan-capable GPU):"
66+
echo "GGML_VK_PERF_SILENT=1 GGML_VK_PERF_LOGGER=1 LLAMA_PERFETTO_TRACE=./<out>.pftrace build-vk/bin/llama-cli -m <model>.gguf"
67+
- name: Upload build artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: build-vk-bin
71+
path: build-vk/bin/

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4460,8 +4460,6 @@ static void ggml_vk_instance_init() {
44604460

44614461
std::vector<vk::PhysicalDevice> devices = vk_instance.instance.enumeratePhysicalDevices();
44624462

4463-
std::vector<vk::PhysicalDevice> devices = vk_instance.instance.enumeratePhysicalDevices();
4464-
44654463
// Emulate behavior of CUDA_VISIBLE_DEVICES for Vulkan
44664464
char * devices_env = getenv("GGML_VK_VISIBLE_DEVICES");
44674465
if (devices_env != nullptr) {

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif()
5858
# Build it into a static lib and link it so tracepoints are available across platforms
5959
# (macOS, Linux, Android; incl. Vulkan/Mali).
6060
add_library(perfetto_sdk STATIC profiler/perfetto.cc)
61-
61+
set_target_properties(perfetto_sdk PROPERTIES POSITION_INDEPENDENT_CODE ON)
6262
target_include_directories(perfetto_sdk PUBLIC ${CMAKE_SOURCE_DIR}/src/profiler)
6363
target_compile_features(perfetto_sdk PRIVATE cxx_std_17)
6464

0 commit comments

Comments
 (0)