From 145f9e8f69bd7b16bf8a29c190303956fcdd8018 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Mon, 1 May 2023 00:58:27 +0200 Subject: [PATCH] Fix nostd build cgemm was not tested as nostd in ci --- ensure_no_std/Cargo.toml | 2 +- src/cgemm_common.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ensure_no_std/Cargo.toml b/ensure_no_std/Cargo.toml index 8d5ca83..1b671fd 100644 --- a/ensure_no_std/Cargo.toml +++ b/ensure_no_std/Cargo.toml @@ -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" diff --git a/src/cgemm_common.rs b/src/cgemm_common.rs index 1842913..59d37d5 100644 --- a/src/cgemm_common.rs +++ b/src/cgemm_common.rs @@ -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) => { @@ -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.