Skip to content

Commit

Permalink
Add portable_simd support (#45)
Browse files Browse the repository at this point in the history
* Add portable_simd support

* Implement rand features for portable_simd

* Fix rand implementation

* features: add dependency from portable_simd to std

* inline(always) more operations

* chore(portable_simd): update to the latest nightly

---------

Co-authored-by: Sébastien Crozet <[email protected]>
  • Loading branch information
farnoy and sebcrozet authored Jun 22, 2024
1 parent e338e4b commit 2cd20ed
Show file tree
Hide file tree
Showing 6 changed files with 1,795 additions and 28 deletions.
41 changes: 13 additions & 28 deletions .github/workflows/simba-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ jobs:
check-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check formatting
run: cargo fmt -- --check
- uses: actions/checkout@v2
- name: Check formatting
run: cargo fmt -- --check
build-native:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build --no-default-feature
run: cargo build --no-default-features;
- name: Build libm only
run: cargo build --no-default-features --features libm;
- name: Build (default features)
run: cargo build;
- name: Build all features except cuda,libm
run: cargo build --features wide,rkyv-serialize,serde_serialize,partial_fixed_point_support;
- uses: actions/checkout@v2
- name: Build --no-default-feature
run: cargo build --no-default-features;
- name: Build libm only
run: cargo build --no-default-features --features libm;
- name: Build (default features)
run: cargo build;
- name: Build all features except libm
run: cargo build --features wide,rkyv-serialize,serde_serialize,partial_fixed_point_support;
build-wasm:
runs-on: ubuntu-latest
steps:
Expand All @@ -49,19 +49,4 @@ jobs:
- name: build x86_64-unknown-linux-gnu
run: xargo build --verbose --no-default-features --target=x86_64-unknown-linux-gnu;
- name: build x86_64-unknown-linux-gnu --features libm
run: xargo build --verbose --no-default-features --features libm --target=x86_64-unknown-linux-gnu;
build-cuda:
runs-on: ubuntu-latest
steps:
- uses: Jimver/[email protected]
- name: Install nightly-2021-12-04
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-12-04
override: true
- uses: actions/checkout@v2
- run: rustup target add nvptx64-nvidia-cuda
- run: cargo build --no-default-features --features cuda
- run: cargo build --no-default-features --features cuda --target=nvptx64-nvidia-cuda
env:
CUDA_ARCH: "350"
run: xargo build --verbose --no-default-features --features libm --target=x86_64-unknown-linux-gnu;
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ maintenance = { status = "actively-developed" }
[features]
default = [ "std" ]
std = ["wide/std"]
portable_simd = [ "std" ]
partial_fixed_point_support = [ "fixed", "cordic" ]
serde_serialize = [ "serde", "fixed/serde" ]
rkyv-serialize = [ "rkyv" ]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ However, the SIMD traits won't be implemented for any SIMD types. Therefore it i
#![deny(unused_results)]
#![deny(missing_docs)] // FIXME: should be denied
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "portable_simd", feature(portable_simd))]

#[cfg(not(feature = "std"))]
extern crate core as std;
Expand Down
4 changes: 4 additions & 0 deletions src/simd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
pub use self::auto_simd_impl::*;
#[cfg(feature = "packed_simd")]
pub use self::packed_simd_impl::*;
#[cfg(feature = "portable_simd")]
pub use self::portable_simd_impl::*;
pub use self::simd_bool::SimdBool;
pub use self::simd_complex::SimdComplexField;
pub use self::simd_option::SimdOption;
Expand All @@ -18,6 +20,8 @@ pub use self::wide_simd_impl::{
mod auto_simd_impl;
#[cfg(feature = "packed_simd")]
mod packed_simd_impl;
#[cfg(feature = "portable_simd")]
mod portable_simd_impl;
#[cfg(feature = "rand")]
mod rand_impl;
mod simd_bool;
Expand Down
Loading

0 comments on commit 2cd20ed

Please sign in to comment.