Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[target.thumbv7neon-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.wasm32-wasip1]
runner = "wasmtime --dir=. --dir=.. --env ARBTEST_BUDGET_MS"
rustflags = ["-C", "target-feature=+simd128,+relaxed-simd"]
39 changes: 36 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ jobs:
matrix:
features: [all, none]
os: [ubuntu-24.04-arm, ubuntu-latest]
include:
- os: ubuntu-24.04-arm
nightly: true
features: neon
target: thumbv7neon-unknown-linux-gnueabihf
- os: ubuntu-latest
features: simd128
target: wasm32-wasip1
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
Expand All @@ -78,6 +86,7 @@ jobs:
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: clippy
targets: ${{ matrix.target }}

- name: Rust cache
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
Expand All @@ -87,11 +96,17 @@ jobs:

- name: Clippy with all features
if: ${{ matrix.features == 'all' }}
run: cargo clippy --release --all-targets --all-features --tests --all -- -D warnings
run: cargo clippy --release --all-targets --all-features --all -- -D warnings

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed because --all-targets include tests.


- name: Clippy with no features
if: ${{ matrix.features == 'none' }}
run: cargo clippy --release --all-targets --no-default-features --tests --all -- -D warnings
run: cargo clippy --release --all-targets --no-default-features --all -- -D warnings

- name: Clippy with ${{ matrix.features }} features
if: ${{ matrix.target }}
env:
RUSTC_BOOTSTRAP: ${{ matrix.nightly && 1 || 0 }}
run: cargo clippy --release -p jxl_simd --no-default-features --features ${{ matrix.features }} ${{ matrix.nightly && '--features nightly' }} --target ${{ matrix.target }} -- -D warnings

test:
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
Expand All @@ -109,6 +124,9 @@ jobs:
simd: avx512
- os: ubuntu-24.04-arm
simd: neon
- os: ubuntu-24.04-arm
simd: nightly-neon
target: thumbv7neon-unknown-linux-gnueabihf
- os: ubuntu-latest
simd: simd128
target: wasm32-wasip1
Expand All @@ -129,6 +147,12 @@ jobs:
with:
targets: ${{ matrix.target }}

- name: Install ARMv7 toolchain
if: ${{ matrix.simd == 'nightly-neon' }}
run: |
sudo dpkg --add-architecture armhf
sudo apt install --update -y gcc-arm-linux-gnueabihf libc6-dev:armhf

- name: Install wasmtime
if: ${{ matrix.target == 'wasm32-wasip1' }}
uses: bytecodealliance/actions/wasmtime/setup@v1
Expand All @@ -142,14 +166,23 @@ jobs:
if: ${{ matrix.simd != 'none' && !matrix.target }}
run: cargo test --release --all --no-fail-fast --no-default-features --features ${{ matrix.simd }}

- name: Tests with SIMD feature ${{ matrix.simd }} (ARMv7)
if: ${{ matrix.simd == 'nightly-neon' }}
env:
RUSTC_BOOTSTRAP: 1
run: |
cargo test --release --workspace --no-fail-fast --no-default-features --features nightly,neon --target ${{ matrix.target }} -- \
--skip compare_incremental_tirr_photo \
--skip compare_pipelines_progressive \
--skip compare_pipelines_tirr_photo

- name: Tests with SIMD feature ${{ matrix.simd }} (wasm ${{ matrix.wasm_features }})
if: ${{ matrix.target == 'wasm32-wasip1' }}
env:
RUSTFLAGS: -C target-feature=${{ matrix.wasm_features }}
run: |
cargo test --release --workspace --exclude jxl_cli --exclude jxl_cms --no-fail-fast --no-default-features --features ${{ matrix.simd }} --target ${{ matrix.target }} -- \
--skip tirr_photo \
--skip huge_image \
--skip fuzzer_smallbuffer

- name: Tests with no features
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Google LLC <*@google.com>
Caio <c410.f3r@gmail.com>
Galaxy4594 <164440799+Galaxy4594@users.noreply.github.com>
Ewout ter Hoeven <E.M.terHoeven@student.tudelft.nl>
Foolbar <118464521+FooIbar@users.noreply.github.com>
Helmut Januschka <helmut@januschka.com>
Inflation <2375962+inflation@users.noreply.github.com>
Jacob Abel <jacobabel@nullpo.dev>
Expand Down
13 changes: 7 additions & 6 deletions jxl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ jxl_macros = { path = "../jxl_macros", version = "=0.4.3", features = ["test"] }
[features]
default = ["all-simd"]

all-simd = ["jxl_simd/all-simd"]
sse42 = ["jxl_simd/sse42"]
avx = ["jxl_simd/avx"]
avx512 = ["jxl_simd/avx512"]
neon = ["jxl_simd/neon"]
simd128 = ["jxl_simd/simd128"]
all-simd = ["jxl_transforms/all-simd"]
sse42 = ["jxl_transforms/sse42"]
avx = ["jxl_transforms/avx"]
avx512 = ["jxl_transforms/avx512"]
neon = ["jxl_transforms/neon"]
simd128 = ["jxl_transforms/simd128"]
nightly = ["jxl_transforms/nightly"]

[lints]
workspace = true
4 changes: 4 additions & 0 deletions jxl/src/image/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ impl<T: ImageDataType> Image<T> {
}
}

#[cfg_attr(
target_pointer_width = "32",
ignore = "will overflow on 32-bit targets"
)]
#[test]
fn huge_image() {
assert!(Image::<u8>::new((1 << 28, 1 << 28)).is_err());
Expand Down
10 changes: 10 additions & 0 deletions jxl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
// license that can be found in the LICENSE file.

#![deny(unsafe_code)]
#![cfg_attr(
all(
target_arch = "arm",
target_feature = "v7",
feature = "nightly",
feature = "neon"
),
feature(arm_target_feature)
)]

pub mod api;
pub mod bit_reader;
pub mod color;
Expand Down
1 change: 1 addition & 0 deletions jxl_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ avx = ["jxl/avx"]
avx512 = ["jxl/avx512"]
neon = ["jxl/neon"]
simd128 = ["jxl/simd128"]
nightly = ["jxl/nightly"]

[lints]
workspace = true
Expand Down
1 change: 1 addition & 0 deletions jxl_simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ avx = ["sse42"]
avx512 = ["avx"]
neon = []
simd128 = []
nightly = []

[lints]
workspace = true
2 changes: 2 additions & 0 deletions jxl_simd/src/aarch64/mod.rs → jxl_simd/src/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ macro_rules! simd_function_body_neon {
return $name(d, $($val),*);
} else if let Some(d) = $crate::NeonDescriptor::new() {
#[target_feature(enable = "neon")]
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
fn neon(d: $crate::NeonDescriptor, $($arg: $ty),*) $(-> $ret)? {
$name(d, $($val),*)
}
Expand Down Expand Up @@ -87,6 +88,7 @@ macro_rules! test_neon {
use $crate::SimdDescriptor;
let Some(d) = $crate::NeonDescriptor::new() else { return; };
#[target_feature(enable = "neon")]
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
fn inner(d: $crate::NeonDescriptor) {
$name(d)
}
Expand Down
Loading
Loading