Skip to content

convert: speed up model endian conversion and add more datatype support - #30647

Merged
CISC merged 3 commits into
ggml-org:masterfrom
taronaeo:feat/llama-quantize-speedup
Oct 16, 2026
Merged

CISC merged 3 commits into
ggml-org:masterfrom
taronaeo:feat/llama-quantize-speedup

Conversation

@taronaeo

@taronaeo taronaeo commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Overview

This PR speeds up the model endianness process by byteswapping tensors instead of blocks. Preliminary measurements show a wall time reduction from 87.82s to 3.36 for Q8_0 and 24.95s to 1.94s for Q4_K. 12.86x and 26.14x reduction respectively.

This is particularly useful against jobs that bill against the wall time consumed (f.ex., HF Jobs). It also speeds up our s390x CI as we use the endianness conversion script for existing CI models.

Additional information

Tested conversion against ibm-granite/granite-3.3-2b-instruct-GGUF from Little-Endian to Big-Endian model

Quant Old Script Wall Time New Script Wall Time Delta Old Script BE Hash New Script BE Hash
Q4_K_M 24.95 seconds 1.94 seconds -12.86x 64fd1c9850366bf3b278bffb0a5d51fb6624ef2d10f702ae1335b910dc5f68ce 64fd1c9850366bf3b278bffb0a5d51fb6624ef2d10f702ae1335b910dc5f68ce
Q8_0 87.82 seconds 3.36 seconds -26.14x 60dc8751e762c41f55fb0ee2de7094cf2ac40a4d1d0999cfff3fb376afc21d44 60dc8751e762c41f55fb0ee2de7094cf2ac40a4d1d0999cfff3fb376afc21d44

TODO

  • Add support for missing data types.

Requirements

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
@taronaeo
taronaeo marked this pull request as ready for review October 16, 2026 06:54
@taronaeo
taronaeo requested a review from CISC as a code owner October 16, 2026 06:54
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
@taronaeo taronaeo changed the title convert: speed up model endian conversion convert: speed up model endian conversion and add more datatype support Oct 16, 2026
@taronaeo

Copy link
Copy Markdown
Member Author

Decided to add the missing data type support in this PR as well since they can be compiled together. Ready for review.

@CISC

CISC commented Oct 16, 2026

Copy link
Copy Markdown
Member

Very nice improvement!

@CISC
CISC merged commit b84ea5c into ggml-org:master Oct 16, 2026
5 checks passed
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 24, 2026
…ort (ggml-org#30647)

* convert: speed up model endian conversion

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

* convert: explicitly state noop

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

* convert: add missing data type support

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

---------

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
MuFengMuXue pushed a commit to MuFengMuXue/llama.cpp-gfx906 that referenced this pull request Oct 26, 2026
…ort (ggml-org#30647)

* convert: speed up model endian conversion

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

* convert: explicitly state noop

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

* convert: add missing data type support

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

---------

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
auRose94 pushed a commit to auRose94/llama.cpp that referenced this pull request Oct 28, 2026
…ort (ggml-org#30647)

* convert: speed up model endian conversion

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

* convert: explicitly state noop

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

* convert: add missing data type support

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>

---------

Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants