Skip to content

Commit

Permalink
Add arm64 DML instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
natke committed Sep 19, 2024
1 parent f69d68f commit fc32ceb
Showing 1 changed file with 53 additions and 10 deletions.
63 changes: 53 additions & 10 deletions examples/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,13 @@ cd Release
.\phi3.exe path_to_model
```

### Windows arm64
### Windows arm64 CPU

#### Install the onnxruntime and onnxruntime-genai binaries

Change into the onnxruntime-genai folder.

1. Install onnxruntime

This example is for `win-arm64`.

```cmd
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.19.2/onnxruntime-win-arm64-1.19.2.zip -o onnxruntime-win-arm64-1.19.2.zip
Expand All @@ -132,18 +130,63 @@ Change into the onnxruntime-genai folder.
copy onnxruntime-win-arm64-1.19.2\lib\* lib
```

2. Install onnxruntime-genai

```cmd
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.4.0/onnxruntime-genai-win-cpu-arm64-capi.zip -o onnxruntime-genai-win-cpu-arm64-capi.zip
tar xvf onnxruntime-genai-win-cpu-arm64-capi.zip
cd onnxruntime-genai-win-cpu-arm64-capi
tar xvf onnxruntime-genai-0.4.0-win-arm64.zip
copy onnxruntime-genai-0.4.0-win-arm64\include\* ..\include
copy onnxruntime-genai-0.4.0-win-arm64\lib\* ..\lib
cd ..
```

#### Build this sample

```bash
cmake -A arm64 -S . -B build -DPHI3=ON
cd build
cmake --build . --config Release
```

#### Run the sample

```bash
cd Release
.\phi3.exe path_to_model
```

### Windows arm64 DirectML

#### Install the onnxruntime and onnxruntime-genai binaries

Change into the onnxruntime-genai folder.

1. Install onnxruntime

```cmd
mkdir onnxruntime-win-arm64-directml
cd onnxruntime-win-arm64-directml
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.19.2/Microsoft.ML.OnnxRuntime.DirectML.1.19.2.nupkg -o Microsoft.ML.OnnxRuntime.DirectML.1.19.2.nupkg
tar xvf Microsoft.ML.OnnxRuntime.DirectML.1.19.2.nupkg
copy build\native\include\* ..\include
copy runtimes\win-arm64\native\* ..\lib
cd ..
```

2. Install onnxruntime-genai

This example requires onnxruntime-genai to be built from source.

```cmd
cd ..\..
python build.py --arm64 --config Release --skip_wheel --parallel --cmake_extra_defines ENABLE_PYTHON=OFF --ort_home examples\c
copy src\ort_genai.h examples\c\include
copy src\ort_genai_c.h examples\c\include
copy build\Windows\Release\Release\*.dll examples\c\lib
copy build\Windows\Release\Release\*.lib examples\c\lib
cd examples\c
curl -L https://github.com/microsoft/onnxruntime-genai/releases/download/v0.4.0/onnxruntime-genai-win-directml-arm64-capi.zip -o onnxruntime-genai-win-directml-arm64-capi.zip
tar xvf onnxruntime-genai-win-directml-arm64-capi.zip
cd onnxruntime-genai-win-directml-arm64-capi
tar xvf onnxruntime-genai-0.4.0-win-arm64-dml.zip
copy onnxruntime-genai-0.4.0-win-arm64-dml\include\* ..\include
copy onnxruntime-genai-0.4.0-win-arm64-dml\lib\* ..\lib
cd ..
```

#### Build this sample
Expand Down

0 comments on commit fc32ceb

Please sign in to comment.