Skip to content

Commit

Permalink
cache-size target_family x86
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-r-earp committed May 14, 2024
1 parent e48729b commit 82f0fac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ unchecked-index = "0.2.2"
curl = { version = "0.4.46", optional = true }
indicatif = { version = "0.17.8", optional = true }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
[target.'cfg(target_family = "x86")'.dependencies]
cache-size = "0.6.0"

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions src/tensor/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ use ndarray::{ArrayViewMut, Dimension, RawArrayViewMut};
#[cfg(feature = "neural-network")]
use ndarray::{Axis, Ix4, Ix5, RemoveAxis};
use std::marker::PhantomData;
#[cfg(not(target_family = "wasm"))]
#[cfg(target_family = "x86")]
use std::sync::OnceLock;

pub(crate) fn parallel_size() -> usize {
const L1_CACHE_SIZE_DEFAULT: usize = 1 << 15;
let l1_cache_size: usize = {
#[cfg(not(target_family = "wasm"))]
#[cfg(target_family = "x86")]
{
static L1_CACHE_SIZE: OnceLock<usize> = std::sync::OnceLock::new();
*L1_CACHE_SIZE
.get_or_init(|| cache_size::l1_cache_size().unwrap_or(L1_CACHE_SIZE_DEFAULT))
}
#[cfg(target_family = "wasm")]
#[cfg(not(target_family = "x86"))]
{
L1_CACHE_SIZE_DEFAULT
}
Expand Down

0 comments on commit 82f0fac

Please sign in to comment.