Skip to content

Commit e986289

Browse files
authored
Adding Vulkan and HIP (ROCM) support (#8)
* Update bindings.ps1 * Update bindings.ps1 * Update BUILDING.md * Update BUILDING.md * Update bindings.ps1 * added Vulkan and ROCM support to linux build script * updated building doc to explicitly say ROCM is linux only * removed D prefix from everything * fixed a misunderstanding * Fixed typo
1 parent fc567ca commit e986289

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

BUILDING.md

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Optionally, environment variables can be set for certain architectures when buil
4545
- `MAX_JOBS`: Number of parallel jobs (defaults to the number of CPU cores)
4646
- `GGML_CUDA=1`: Enables CUDA support
4747
- `CMAKE_CUDA_ARCHITECTURES`: Specifies CUDA compute capabilities (defaults to `native` if using CMake > 3.24)
48+
- `GGML_VULKAN=1`: Enables Vulkan Support
49+
- `GGML_HIP=1`: Enables HIP ROCM Support (Requires specifying DAMDGPU_TARGETS, Linux only)
50+
- `AMDGPU_TARGETS`: Specify ROCM target (example: `gfx1030`)
4851

4952
## Running
5053

bindings/bindings.ps1

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ if ($env:GGML_CUDA -eq 1) {
2626
}
2727
}
2828

29+
if ($env:GGML_VULKAN -eq 1) {
30+
Write-Host "Vulkan enabled, including in build"
31+
32+
$extraCmakeArgs += "-DGGML_VULKAN=ON"
33+
}
34+
2935
cmake . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release $extraCmakeArgs
3036
cmake --build build --config Release --target deno_cpp_binding -j $jobs
3137
Copy-Item build/*.dll ../lib

bindings/bindings.sh

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ if [ "$GGML_CUDA" = "1" ]; then
2525
fi
2626
fi
2727

28+
if [ "$GGML_VULKAN" = "1" ]; then
29+
EXTRA_CMAKE_ARGS+=("-DGGML_VULKAN=ON")
30+
echo "Vulkan enabled, including in build"
31+
fi
32+
33+
if [ "$GGML_HIP" = "1" ]; then
34+
EXTRA_CMAKE_ARGS+=("-DGGML_HIP=ON")
35+
echo "HIP enabled, including in build"
36+
37+
if [ -n "$AMDGPU_TARGETS" ]; then
38+
EXTRA_CMAKE_ARGS+=(
39+
"-DAMDGPU_TARGETS=$AMDGPU_TARGETS"
40+
)
41+
fi
42+
fi
43+
2844
# Join array elements with spaces
2945
CMAKE_ARGS="${EXTRA_CMAKE_ARGS[*]}"
3046

0 commit comments

Comments
 (0)