Skip to content

Commit 35ca173

Browse files
committed
Update ASTC encoder to 5.3.0 (#1036)
5.3.0 is a minor maintenance release. git subrepo commit (merge) external/astc-encoder subrepo: subdir: "external/astc-encoder" merged: "1c5233bf0" upstream: origin: "https://github.com/ARM-software/astc-encoder.git" branch: "5.2.0" commit: "30aabb3f4" git-subrepo: version: "0.4.9" origin: "https://github.com/MarkCallow/git-subrepo.git" commit: "4f60dd7"
1 parent f9c7338 commit 35ca173

27 files changed

Lines changed: 664 additions & 415 deletions

external/astc-encoder/.github/workflows/build_test.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ jobs:
1717
with:
1818
submodules: 'true'
1919

20+
- name: Update apt packages
21+
run: sudo apt-get update
22+
2023
- name: Install ImageMagick
21-
run: sudo apt install imagemagick
24+
run: sudo apt-get install imagemagick
2225

2326
- name: Build release
2427
run: |
@@ -55,18 +58,16 @@ jobs:
5558
pip install numpy Pillow
5659
5760
- name: Run system tests
58-
# GitHub is using Cobalt-100, which has 128-bit SVE so we cannot test sve_256 here
61+
# Disable SVE for now
5962
run: |
6063
python ./Test/astc_test_functional.py --encoder none
6164
python ./Test/astc_test_functional.py --encoder neon
62-
python ./Test/astc_test_functional.py --encoder sve_128
6365
python ./Test/astc_test_image.py --encoder none --test-set Small
6466
python ./Test/astc_test_image.py --encoder neon --test-set Small
65-
python ./Test/astc_test_image.py --encoder sve_128 --test-set Small
6667
6768
- name: Run unit tests
68-
# GitHub is using Cobalt-100, which has 128-bit SVE so we cannot test sve_256 here
69-
run: ctest -E test-unit-sve_256 --rerun-failed --output-on-failure
69+
# Disable SVE for now
70+
run: ctest -E "test-unit-sve_128|test-unit-sve_256" --rerun-failed --output-on-failure
7071
working-directory: build_rel
7172

7273
build-ubuntu-arm64-gcc:
@@ -78,13 +79,14 @@ jobs:
7879
with:
7980
submodules: 'true'
8081

82+
- name: Update apt packages
83+
run: sudo apt-get update
84+
8185
- name: Install ImageMagick
82-
run: sudo apt install imagemagick
86+
run: sudo apt-get install imagemagick
8387

8488
- name: Install GCC 14
85-
run: |
86-
sudo apt-get update
87-
sudo apt-get install -y gcc-14
89+
run: sudo apt-get install -y gcc-14
8890

8991
- name: Build release
9092
run: |
@@ -113,18 +115,16 @@ jobs:
113115
pip install numpy Pillow
114116
115117
- name: Run system tests
116-
# GitHub is using Cobalt-100, which has 128-bit SVE so we cannot test sve_256 here
118+
# Disable SVE for now
117119
run: |
118120
python ./Test/astc_test_functional.py --encoder none
119121
python ./Test/astc_test_functional.py --encoder neon
120-
python ./Test/astc_test_functional.py --encoder sve_128
121122
python ./Test/astc_test_image.py --encoder none --test-set Small
122123
python ./Test/astc_test_image.py --encoder neon --test-set Small
123-
python ./Test/astc_test_image.py --encoder sve_128 --test-set Small
124124
125125
- name: Run unit tests
126-
# GitHub is using Cobalt-100, which has 128-bit SVE so we cannot test sve_256 here
127-
run: ctest -E test-unit-sve_256 --rerun-failed --output-on-failure
126+
# Disable SVE for now
127+
run: ctest -E "test-unit-sve_128|test-unit-sve_256" --rerun-failed --output-on-failure
128128
working-directory: build_rel
129129

130130
build-ubuntu-x64-clang:

external/astc-encoder/.github/workflows/post_weekly_release.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ jobs:
7171
with:
7272
submodules: 'true'
7373

74+
- name: Update apt packages
75+
run: sudo apt-get update
76+
7477
- name: Install ImageMagick
75-
run: sudo apt install imagemagick
78+
run: sudo apt-get install imagemagick
7679

7780
- name: Build release
7881
run: |
@@ -101,12 +104,10 @@ jobs:
101104
pip install numpy Pillow
102105
103106
- name: Run system tests
104-
# GitHub is using Cobalt-100, which has 128-bit SVE so we cannot test sve_256 here
107+
# Disable SVE testing for now
105108
run: |
106109
python ./Test/astc_test_functional.py --encoder neon
107-
python ./Test/astc_test_functional.py --encoder sve_128
108110
python ./Test/astc_test_image.py --encoder neon --test-set Small
109-
python ./Test/astc_test_image.py --encoder sve_128 --test-set Small
110111
111112
build-ubuntu-x64:
112113
name: Ubuntu x64

external/astc-encoder/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Editor and engineering scratch files
2+
.cache
23
.vs
34
.vscode
45
.DS_Store

external/astc-encoder/.gitrepo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[subrepo]
77
remote = https://github.com/ARM-software/astc-encoder.git
88
branch = 5.2.0
9-
commit = 2319d9c4d4af53a7fc7c52985e264ce6e8a02a9b
10-
parent = 7475bc1bc0411e672a0a833e19f1f53bde30b588
9+
commit = 30aabb3f42406df45a910d8496f9bee17eeba9bb
10+
parent = f9c73388a58de9b83f260f11008b043d8f7c0954
1111
method = merge
12-
cmdver = 0.4.3
12+
cmdver = 0.4.9

external/astc-encoder/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(MSVC)
2525
add_compile_options("/wd4324")
2626
endif()
2727

28-
project(astcencoder VERSION 5.2.0)
28+
project(astcencoder VERSION 5.3.0)
2929

3030
set(CMAKE_CXX_STANDARD 14)
3131
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -45,13 +45,15 @@ option(ASTCENC_ISA_NONE "Enable astcenc builds for no SIMD")
4545
option(ASTCENC_ISA_NATIVE "Enable astcenc builds for native SIMD")
4646
option(ASTCENC_DECOMPRESSOR "Enable astcenc builds for decompression only")
4747
option(ASTCENC_SHAREDLIB "Enable astcenc builds with core library shared objects")
48+
option(ASTCENC_BIG_ENDIAN "Enable astcenc big-endian support")
4849
option(ASTCENC_DIAGNOSTICS "Enable astcenc builds with diagnostic trace")
4950
option(ASTCENC_ASAN "Enable astcenc builds with address sanitizer")
5051
option(ASTCENC_UBSAN "Enable astcenc builds with undefined behavior sanitizer")
5152
option(ASTCENC_UNITTEST "Enable astcenc builds with unit tests")
5253
option(ASTCENC_INVARIANCE "Enable astcenc floating point invariance" ON)
5354
option(ASTCENC_CLI "Enable build of astcenc command line tools" ON)
5455
option(ASTCENC_X86_GATHERS "Enable use of native x86 gathers" ON)
56+
option(ASTCENC_WERROR "Force builds to treat warnings as errors" ON)
5557

5658
# Preflight for some macOS-specific build options
5759
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
@@ -137,6 +139,9 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
137139
printopt("Universal bin " ${ASTCENC_UNIVERSAL_BUILD})
138140
endif()
139141
printopt("Invariance " ${ASTCENC_INVARIANCE})
142+
if(${ASTCENC_BIG_ENDIAN})
143+
printopt("Big endian " ${ASTCENC_BIG_ENDIAN})
144+
endif()
140145
printopt("Shared libs " ${ASTCENC_SHAREDLIB})
141146
printopt("Decompressor " ${ASTCENC_DECOMPRESSOR})
142147
message(STATUS "Developer options")
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Building Big Endian ASTC Encoder
2+
3+
We don't officially support the big-endian compressor build, and it is only
4+
lightly tested, but ensuring that the code is BE-compatible is good practice
5+
and some of the open source distributions still support BE platforms.
6+
7+
Even though Arm64 can run in a BE mode, it's now very rare in practice. It's no
8+
longer supported out of the box in the latest Arm upstream compiler releases,
9+
and getting hold of a sysroot is increasingly difficult. To test BE builds, I
10+
therefore cross-compile Linux builds for PPC64 and use `qemu-user` to run
11+
them. This doesn't use a real sysroot, and so everything must be compiled with
12+
`-static` linkage.
13+
14+
## Host software
15+
16+
Install the following host software:
17+
18+
```bash
19+
# Compiler
20+
sudo apt-get install g++-powerpc64-linux-gnu
21+
22+
# Multi-arch libraries
23+
sudo apt-get install g++-multilib-powerpc64-linux-gnu
24+
25+
# QEMU
26+
sudo apt-get install qemu-user-static qemu-user-binfmt binfmt-support
27+
sudo mkdir /etc/qemu-binfmt
28+
sudo ln -s /usr/powerpc64-linux-gnu /etc/qemu-binfmt/ppc64
29+
sudo update-binfmts --import qemu-ppc64
30+
```
31+
32+
## CMake toolchain file
33+
34+
Cross-compiling needs a correctly configured CMake, and the easiest way to
35+
do this consistently is to use a toolchain file. Create a `CMake-BE.toolchain`
36+
file in the root of the project, with the following content:
37+
38+
```
39+
# Operating system
40+
set(CMAKE_SYSTEM_NAME Linux)
41+
42+
# Cross-compilers for C and C++
43+
set(CMAKE_C_COMPILER powerpc64-linux-gnu-gcc)
44+
set(CMAKE_CXX_COMPILER powerpc64-linux-gnu-g++)
45+
46+
# Compiler environment
47+
set(CMAKE_FIND_ROOT_PATH /usr/powerpc64-linux-gnu)
48+
49+
set(CMAKE_C_FLAGS_INIT -static)
50+
set(CMAKE_CXX_FLAGS_INIT -static)
51+
set(CMAKE_EXE_LINKER_FLAGS_INIT -static)
52+
set(CMAKE_SHARED_LINKER_FLAGS_INIT -static)
53+
set(CMAKE_MODULE_LINKER_FLAGS_INIT -static)
54+
55+
# Build options
56+
set(ASTCENC_BIG_ENDIAN ON)
57+
58+
# Never match host tools
59+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
60+
61+
# Only match headers and libraries in the compiler environment
62+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
63+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
64+
```
65+
66+
## Build astcenc
67+
68+
Building uses CMake as normal, with the additional specification of the
69+
toolchain file to configure the build for cross-compilation. We don't have any
70+
SIMD implementations for big-endian architectures so these builds must compile
71+
for the reference C SIMD implementation, `ASTCENC_ISA_NONE`.
72+
73+
```
74+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_NONE=ON -DCMAKE_TOOLCHAIN_FILE=../CMake-BE.toolchain ..
75+
```
76+
77+
## Run astcenc
78+
79+
The cross-compiled `astcenc` binary runs as normal, and can access host files,
80+
but must run through QEMU to do the instruction set translation.
81+
82+
If the binfmt setup performed earlier was successful you can just run the
83+
binary as if it were a native binary:
84+
85+
```
86+
./bin/astcenc-none ...
87+
```
88+
89+
... but otherwise you can run it manually using QEMU as a wrapper:
90+
91+
```
92+
qemu-ppc64 ./bin/astcenc-none ...
93+
```
94+
95+
- - -
96+
97+
_Copyright © 2025, Arm Limited and contributors._

external/astc-encoder/Docs/ChangeLog-5x.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ release of the 5.x series.
66
All performance data on this page is measured on an Intel Core i5-9600K
77
clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.
88

9+
<!-- ---------------------------------------------------------------------- -->
10+
## 5.3.0
11+
12+
**Status:** March 2025
13+
14+
The 5.3.0 release is a minor maintenance release.
15+
16+
* **General:**
17+
* **Feature:** Reference C builds (`ASTCENC_ISA_NONE`) now support compiling
18+
for big-endian CPUs. Compile with `-DASTCENC_BIG_ENDIAN=ON` when compiling
19+
for a big-endian target; it is not auto-detected.
20+
* **Improvement:** Builds using GCC now specify `-flto=auto` to allow
21+
parallel link steps, and remove the log warnings about not setting a CPU
22+
count parameter value.
23+
* **Bug fix:** Builds using MSVC `cl.exe` that do not specify an explicit
24+
ISA using the preprocessor configuration defines will now correctly
25+
default to the SSE2 backend on x86-64 and the NEON backend on Arm64. Previously they would have defaulted to the reference C implementation,
26+
which is around 3.25 times slower.
27+
28+
929
<!-- ---------------------------------------------------------------------- -->
1030
## 5.2.0
1131

external/astc-encoder/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,16 @@ The x86-64 SSE2 builds will work on all x86-64 machines, but it is the slowest
7777
of the three. The other two require extended CPU instruction set support which
7878
is not universally available, but each step gains ~15% more performance.
7979

80-
For Arm, if binaries are available, we provide:
80+
For Arm we provide, in order of increasing performance:
8181

82+
* `astcenc-sve_256` - uses 256-bit SVE
83+
* `astcenc-sve_128` - uses 128-bit SVE
8284
* `astcenc-neon` - uses NEON
8385

86+
Note: The Arm Scalable Vector Extensions (SVE) allow CPUs to have a variable
87+
vector length. The astcenc implementation is not written in a length-agnostic
88+
style and requires the binary to match the vector length on the host CPU.
89+
8490
## macOS
8591

8692
For macOS devices we provide a single universal binary `astcenc`, which allows
@@ -235,10 +241,10 @@ or general mobile graphics development or technology please submit them on the
235241

236242
- - -
237243

238-
_Copyright © 2013-2024, Arm Limited and contributors. All rights reserved._
244+
_Copyright © 2013-2025, Arm Limited and contributors. All rights reserved._
239245

240246
[1]: ./Docs/FormatOverview.md
241-
[2]: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#ASTC
247+
[2]: https://www.khronos.org/registry/DataFormat/specs/1.4/dataformat.1.4.html#ASTC
242248
[3]: https://github.com/ARM-software/astc-encoder/releases
243249
[4]: https://community.arm.com/support-forums/f/graphics-gaming-and-vr-forum/
244250
[5]: https://developer.arm.com/documentation/102162/latest/?lang=en

external/astc-encoder/Source/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717

1818
# Overwrite the LTO flags to force fat LTO; worth 3-4% performance
1919
# See https://gitlab.kitware.com/cmake/cmake/-/issues/16808
20-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND ${ASTCENC_CLI})
20+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND ${ASTCENC_CLI})
2121
set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto")
2222
endif()
2323

24+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ${ASTCENC_CLI})
25+
set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto=auto")
26+
endif()
27+
2428
if(${ASTCENC_DECOMPRESSOR})
2529
set(ASTCENC_CODEC dec)
2630
else()

0 commit comments

Comments
 (0)