Skip to content

Commit 74b8fc1

Browse files
authored
ggml webgpu: profiling, CI updates, reworking of command submission (ggml-org#16452)
* Add profiling * More detailed profiling * Rework command submission to avoid global locks * Update wait handling * try new method of waiting on futures * Add serializing of command submission in some cases * Add new pool for timestamp queries and clean up logging * Serialize command submission in CI and leave a TODO note * Update webgpu CI * Add myself as WebGPU codeowner * Deadlock avoidance * Leave WebGPU/Vulkan CI serialized * Fix divide by 0 * Fix logic in division by inflight_threads * Update CODEOWNERS and remove serialize submit option
1 parent aeaf8a3 commit 74b8fc1

File tree

6 files changed

+517
-249
lines changed

6 files changed

+517
-249
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ jobs:
444444
# This is using llvmpipe and runs slower than other backends
445445
ctest -L main --verbose --timeout 4200
446446

447-
ubuntu-22-cmake-webgpu:
448-
runs-on: ubuntu-22.04
447+
ubuntu-24-cmake-webgpu:
448+
runs-on: ubuntu-24.04
449449

450450
steps:
451451
- name: Clone
@@ -455,16 +455,34 @@ jobs:
455455
- name: ccache
456456
uses: ggml-org/[email protected]
457457
with:
458-
key: ubuntu-22-cmake-webgpu
458+
key: ubuntu-24-cmake-webgpu
459459
evict-old-files: 1d
460460

461-
- name: Vulkan SDK Dependencies
462-
id: vulkan-depends
461+
- name: Dependencies
462+
id: depends
463463
run: |
464-
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
465-
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
464+
sudo add-apt-repository -y ppa:kisak/kisak-mesa
466465
sudo apt-get update -y
467-
sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
466+
sudo apt-get install -y build-essential mesa-vulkan-drivers libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libcurl4-openssl-dev
467+
468+
- name: Get latest Vulkan SDK version
469+
id: vulkan_sdk_version
470+
run: |
471+
echo "VULKAN_SDK_VERSION=$(curl https://vulkan.lunarg.com/sdk/latest/linux.txt)" >> "$GITHUB_ENV"
472+
473+
- name: Use Vulkan SDK Cache
474+
uses: actions/cache@v4
475+
id: cache-sdk
476+
with:
477+
path: ./vulkan_sdk
478+
key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }}
479+
480+
- name: Setup Vulkan SDK
481+
if: steps.cache-sdk.outputs.cache-hit != 'true'
482+
uses: ./.github/actions/linux-setup-vulkan
483+
with:
484+
path: ./vulkan_sdk
485+
version: ${{ env.VULKAN_SDK_VERSION }}
468486

469487
- name: Dawn Dependency
470488
id: dawn-depends

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
/ggml/src/ggml-rpc/ @rgerganov
7171
/ggml/src/ggml-threading.* @ggerganov @slaren
7272
/ggml/src/ggml-vulkan/ @0cc4m
73+
/ggml/src/ggml-webgpu/ @reeselevine
7374
/ggml/src/ggml-zdnn/ @taronaeo @Andreas-Krebbel @AlekseiNikiforovIBM
7475
/ggml/src/ggml.c @ggerganov @slaren
7576
/ggml/src/ggml.cpp @ggerganov @slaren

ggml/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ option(GGML_VULKAN_VALIDATE "ggml: enable Vulkan validation"
222222
option(GGML_VULKAN_RUN_TESTS "ggml: run Vulkan tests" OFF)
223223
option(GGML_WEBGPU "ggml: use WebGPU" OFF)
224224
option(GGML_WEBGPU_DEBUG "ggml: enable WebGPU debug output" OFF)
225+
option(GGML_WEBGPU_CPU_PROFILE "ggml: enable WebGPU profiling (CPU)" OFF)
226+
option(GGML_WEBGPU_GPU_PROFILE "ggml: enable WebGPU profiling (GPU)" OFF)
227+
225228
option(GGML_ZDNN "ggml: use zDNN" OFF)
226229
option(GGML_METAL "ggml: use Metal" ${GGML_METAL_DEFAULT})
227230
option(GGML_METAL_NDEBUG "ggml: disable Metal debugging" OFF)

ggml/src/ggml-webgpu/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,13 @@ if (GGML_WEBGPU_DEBUG)
5050
target_compile_definitions(ggml-webgpu PRIVATE GGML_WEBGPU_DEBUG=1)
5151
endif()
5252

53+
if (GGML_WEBGPU_CPU_PROFILE)
54+
target_compile_definitions(ggml-webgpu PRIVATE GGML_WEBGPU_CPU_PROFILE=1)
55+
endif()
56+
57+
if (GGML_WEBGPU_GPU_PROFILE)
58+
target_compile_definitions(ggml-webgpu PRIVATE GGML_WEBGPU_GPU_PROFILE=1)
59+
endif()
60+
5361
target_include_directories(ggml-webgpu PRIVATE ${SHADER_OUTPUT_DIR})
5462
target_link_libraries(ggml-webgpu PRIVATE ${DawnWebGPU_TARGET})

0 commit comments

Comments
 (0)