Skip to content

Commit

Permalink
Fix nostd build
Browse files Browse the repository at this point in the history
cgemm was not tested as nostd in ci
  • Loading branch information
bluss committed Apr 30, 2023
1 parent 258a69f commit 145f9e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ensure_no_std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
publish = false

[dependencies]
matrixmultiply = { path = "..", default-features = false }
matrixmultiply = { path = "..", default-features = false, features = ["cgemm"] }

[profile.dev]
panic = "abort"
Expand Down
14 changes: 12 additions & 2 deletions src/cgemm_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::mem;
use std::ptr::copy_nonoverlapping;
use core::mem;
use core::ptr::copy_nonoverlapping;

use rawpointer::PointerExt;

use crate::kernel::Element;
use crate::kernel::ConstNum;

#[cfg(feature = "std")]
macro_rules! fmuladd {
// conceptually $dst += $a * $b, optionally use fused multiply-add
(fma_yes, $dst:expr, $a:expr, $b:expr) => {
Expand All @@ -28,6 +29,15 @@ macro_rules! fmuladd {
};
}

#[cfg(not(feature = "std"))]
macro_rules! fmuladd {
($any:tt, $dst:expr, $a:expr, $b:expr) => {
{
$dst += $a * $b;
}
};
}


// kernel fallback impl macro
// Depends on a couple of macro and function defitions to be in scope - loop_m/_n, at, etc.
Expand Down

0 comments on commit 145f9e8

Please sign in to comment.