Skip to content

Commit 3d4afbe

Browse files
Merge pull request #101 from BradHutchings/work-in-progress
Work in progress
2 parents fb2faaa + e44f8a0 commit 3d4afbe

36 files changed

+768
-172
lines changed

.devops/musa.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
ARG UBUNTU_VERSION=22.04
22
# This needs to generally match the container host's environment.
3-
ARG MUSA_VERSION=rc4.0.1
3+
ARG MUSA_VERSION=rc4.2.0
44
# Target the MUSA build image
5-
ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-mudnn-devel-ubuntu${UBUNTU_VERSION}
5+
ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}-amd64
66

7-
ARG BASE_MUSA_RUN_CONTAINER=mthreads/musa:${MUSA_VERSION}-mudnn-runtime-ubuntu${UBUNTU_VERSION}
7+
ARG BASE_MUSA_RUN_CONTAINER=mthreads/musa:${MUSA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}-amd64
88

99
FROM ${BASE_MUSA_DEV_CONTAINER} AS build
1010

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ jobs:
515515
516516
ubuntu-22-cmake-musa:
517517
runs-on: ubuntu-22.04
518-
container: mthreads/musa:rc4.0.1-mudnn-devel-ubuntu22.04
518+
container: mthreads/musa:rc4.2.0-devel-ubuntu22.04-amd64
519519

520520
steps:
521521
- name: Clone

ci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ docker run --privileged -it \
5454
-v $HOME/llama.cpp/ci-cache:/ci-cache \
5555
-v $HOME/llama.cpp/ci-results:/ci-results \
5656
-v $PWD:/ws -w /ws \
57-
mthreads/musa:rc4.0.1-mudnn-devel-ubuntu22.04
57+
mthreads/musa:rc4.2.0-devel-ubuntu22.04-amd64
5858
```
5959

6060
Inside the container, execute the following commands:

completion-ui/admin/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// License Inquiries: [email protected].
77
-->
88
<head>
9-
<--
9+
<!--
1010
To do: Script file that can determine actual server, redirect to another port. -Brad 2025-07-24
1111
-->
1212
<meta http-equiv="refresh" content="0; url=https://mmojo.local:8443/">

completion-ui/completion/help.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<div id="content">
2929

3030
<div id="title-bar" class="row">
31-
<div id="mmojo">Mmojo Completion - Help</div>
31+
<div id="mmojo-completion">Mmojo Completion - Help</div>
3232
</div>
3333

3434
<div id="work-area-text" class="row">

completion-ui/completion/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div id="mmojo-completion" onclick="ClickMmojoCompletion();">Mmojo Completion</div>
3333
<img id="settings-icon" src="images/settings-64.png" onclick="ToggleSettings();" title="Toggle Settings" />
3434
<img id="chat-icon" src="images/chat-64.png" onclick="Chat();" title="Chat" />
35-
<img id="print-icon" src="images/print-64.png" onclick="Print();"/>
35+
<img id="print-icon" src="images/print-64.png" onclick="Print();" title="Print"/>
3636
<img id="bookmark-icon" src="images/bookmark-64.png" onclick="EditBookmark();" title="Bookmark Maker"/>
3737
<img id="full-screen-icon" src="images/fullscreen-64.png" onclick="ToggleFullScreen();" title="Toggle Full Screen"/>
3838
<img id="help-icon" src="images/help-64.png" onclick="Help();" title="Help"/>

docs/build-s390x.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ cmake --build build --config Release -j $(nproc)
4242
cmake --build build --config Release -j $(nproc)
4343
```
4444

45-
- By default, NNPA is enabled when available. To disable it (not recommended):
45+
- By default, NNPA is disabled by default. To enable it:
4646

4747
```bash
4848
cmake -S . -B build \
4949
-DCMAKE_BUILD_TYPE=Release \
5050
-DGGML_BLAS=ON \
5151
-DGGML_BLAS_VENDOR=OpenBLAS \
52-
-DGGML_NNPA=OFF
52+
-DGGML_NNPA=ON
5353
5454
cmake --build build --config Release -j $(nproc)
5555
```
@@ -84,16 +84,24 @@ All models need to be converted to Big-Endian. You can achieve this in three cas
8484

8585
![File Type - gguf](https://img.shields.io/badge/File_Type-gguf-fff)
8686

87-
You can find popular models pre-converted and verified at [s390x Ready Models](https://huggingface.co/collections/taronaeo/s390x-ready-models-672765393af438d0ccb72a08).
87+
You can find popular models pre-converted and verified at [s390x Verified Models](https://huggingface.co/collections/taronaeo/s390x-verified-models-672765393af438d0ccb72a08) or [s390x Runnable Models](https://huggingface.co/collections/taronaeo/s390x-runnable-models-686e951824198df12416017e).
8888

89-
These models have already been converted from `safetensors` to `GGUF Big-Endian` and their respective tokenizers verified to run correctly on IBM z15 and later system.
89+
These models have already been converted from `safetensors` to `GGUF` Big-Endian and their respective tokenizers verified to run correctly on IBM z15 and later system.
9090

9191
2. **Convert safetensors model to GGUF Big-Endian directly (recommended)**
9292

9393
![File Type - safetensors](https://img.shields.io/badge/File_Type-safetensors-da1e28)
9494

9595
The model you are trying to convert must be in `safetensors` file format (for example [IBM Granite 3.3 2B](https://huggingface.co/ibm-granite/granite-3.3-2b-instruct)). Make sure you have downloaded the model repository for this case.
9696

97+
Ensure that you have installed the required packages in advance
98+
99+
```bash
100+
pip3 install -r requirements.txt
101+
```
102+
103+
Convert the `safetensors` model to `GGUF`
104+
97105
```bash
98106
python3 convert_hf_to_gguf.py \
99107
--outfile model-name-be.f16.gguf \
@@ -116,7 +124,7 @@ All models need to be converted to Big-Endian. You can achieve this in three cas
116124

117125
![File Type - gguf](https://img.shields.io/badge/File_Type-gguf-fff)
118126

119-
The model you are trying to convert must be in `gguf` file format (for example [IBM Granite 3.3 2B](https://huggingface.co/ibm-granite/granite-3.3-2b-instruct-GGUF)). Make sure you have downloaded the model file for this case.
127+
The model you are trying to convert must be in `gguf` file format (for example [IBM Granite 3.3 2B GGUF](https://huggingface.co/ibm-granite/granite-3.3-2b-instruct-GGUF)). Make sure you have downloaded the model file for this case.
120128

121129
```bash
122130
python3 gguf-py/gguf/scripts/gguf_convert_endian.py model-name.f16.gguf BIG
@@ -141,15 +149,15 @@ Only available in IBM z15 or later system with the `-DGGML_VXE=ON` (turned on by
141149

142150
### 2. NNPA Vector Intrinsics Acceleration
143151

144-
Only available in IBM z16 or later system with the `-DGGML_NNPA=ON` (turned on when available) compile flag. No hardware acceleration is possible with llama.cpp with older systems, such as IBM z15/arch13. In such systems, the APIs can still run but will use a scalar implementation.
152+
Only available in IBM z16 or later system with the `-DGGML_NNPA=ON` (turned off by default) compile flag. No hardware acceleration is possible with llama.cpp with older systems, such as IBM z15/arch13. In such systems, the APIs can still run but will use a scalar implementation.
145153

146154
### 3. zDNN Accelerator
147155

148-
_Only available in IBM z16 or later system. No direction at the moment._
156+
_Only available in IBM z16 / LinuxONE 4 or later system. No support currently available._
149157

150158
### 4. Spyre Accelerator
151159

152-
_No direction at the moment._
160+
_Only available with IBM z17 / LinuxONE 5 or later system. No support currently available._
153161

154162
## Performance Tuning
155163

@@ -189,6 +197,26 @@ IBM VXE/VXE2 SIMD acceleration depends on the BLAS implementation. It is strongl
189197

190198
Answer: Please ensure that your GCC compiler is of minimum GCC 15.1.0 version, and have `binutils` updated to the latest version. If this does not fix the problem, kindly open an issue.
191199

200+
4. Failing to install the `sentencepiece` package using GCC 15+
201+
202+
Answer: The `sentencepiece` team are aware of this as seen in [this issue](https://github.com/google/sentencepiece/issues/1108).
203+
204+
As a temporary workaround, please run the installation command with the following environment variables.
205+
206+
```bash
207+
export CXXFLAGS="-include cstdint"
208+
```
209+
210+
For example,
211+
212+
```bash
213+
CXXFLAGS="-include cstdint" pip3 install -r requirements.txt
214+
```
215+
216+
5. `-DGGML_NNPA=ON` generates gibberish output
217+
218+
Answer: We are aware of this as detailed in [this issue](https://github.com/ggml-org/llama.cpp/issues/14877). Please either try reducing the number of threads, or disable the compile option using `-DGGML_NNPA=OFF`.
219+
192220
## Getting Help on IBM Z & LinuxONE
193221

194222
1. **Bugs, Feature Requests**
@@ -244,3 +272,5 @@ IBM VXE/VXE2 SIMD acceleration depends on the BLAS implementation. It is strongl
244272
- ✅ - acceleration available
245273
- 🚫 - acceleration unavailable, will still run using scalar implementation
246274
- ❓ - acceleration unknown, please contribute if you can test it yourself
275+
276+
Last Updated by **Aaron Teo ([email protected])** on July 25, 2025.

docs/development/HOWTO-add-model.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ The convert script reads the model configuration, tokenizer, tensor names+data a
2323

2424
The required steps to implement for an HF model are:
2525

26-
1. Define the model `Model.register` annotation in a new `Model` subclass, example:
26+
1. Define the model `ModelBase.register` annotation in a new `TextModel` or `MmprojModel` subclass, example:
2727

2828
```python
29-
@Model.register("MyModelForCausalLM")
30-
class MyModel(Model):
29+
@ModelBase.register("MyModelForCausalLM")
30+
class MyModel(TextModel):
31+
model_arch = gguf.MODEL_ARCH.MYMODEL
32+
```
33+
34+
or
35+
36+
```python
37+
@ModelBase.register("MyModelForConditionalGeneration")
38+
class MyModel(MmprojModel):
3139
model_arch = gguf.MODEL_ARCH.MYMODEL
3240
```
3341

@@ -75,9 +83,10 @@ block_mappings_cfg: dict[MODEL_TENSOR, tuple[str, ...]] = {
7583
`transformer.blocks.{bid}.norm_1` will be mapped to `blk.{bid}.attn_norm` in GGUF.
7684

7785
Depending on the model configuration, tokenizer, code and tensors layout, you will have to override:
78-
- `Model#set_gguf_parameters`
79-
- `Model#set_vocab`
80-
- `Model#write_tensors`
86+
- `TextModel#set_gguf_parameters`
87+
- `MmprojModel#set_gguf_parameters`
88+
- `ModelBase#set_vocab`
89+
- `ModelBase#modify_tensors`
8190

8291
NOTE: Tensor names must end with `.weight` or `.bias` suffixes, that is the convention and several tools like `quantize` expect this to proceed the weights.
8392

docs/docker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ You may want to pass in some different `ARGS`, depending on the MUSA environment
110110

111111
The defaults are:
112112

113-
- `MUSA_VERSION` set to `rc4.0.1`
113+
- `MUSA_VERSION` set to `rc4.2.0`
114114

115115
The resulting images, are essentially the same as the non-MUSA images:
116116

ggml/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ option(GGML_RVV "ggml: enable rvv" ON)
131131
option(GGML_RV_ZFH "ggml: enable riscv zfh" OFF)
132132
option(GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF)
133133
option(GGML_VXE "ggml: enable vxe" ON)
134-
option(GGML_NNPA "ggml: enable nnpa" ON)
134+
option(GGML_NNPA "ggml: enable nnpa" OFF) # temp disabled by default, see: https://github.com/ggml-org/llama.cpp/issues/14877
135135

136136
option(GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF)
137137
set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
@@ -174,6 +174,8 @@ option(GGML_HIP_GRAPHS "ggml: use HIP graph, experimental,
174174
option(GGML_HIP_NO_VMM "ggml: do not try to use HIP VMM" ON)
175175
option(GGML_HIP_ROCWMMA_FATTN "ggml: enable rocWMMA for FlashAttention" OFF)
176176
option(GGML_HIP_FORCE_ROCWMMA_FATTN_GFX12 "ggml: enable rocWMMA FlashAttention on GFX12" OFF)
177+
option(GGML_MUSA_GRAPHS "ggml: use MUSA graph, experimental, unstable" OFF)
178+
option(GGML_MUSA_MUDNN_COPY "ggml: enable muDNN for accelerated copy" OFF)
177179
option(GGML_VULKAN "ggml: use Vulkan" OFF)
178180
option(GGML_VULKAN_CHECK_RESULTS "ggml: run Vulkan op checks" OFF)
179181
option(GGML_VULKAN_DEBUG "ggml: enable Vulkan debug output" OFF)

0 commit comments

Comments
 (0)