WE ARE 10 LAYERS DEEP

This commit is contained in:
Quaternions 2024-09-03 10:40:21 -07:00
parent c24ce58dbf
commit e9a9689e86
2 changed files with 38 additions and 9 deletions

View File

@ -91,22 +91,18 @@ macro_rules! impl_wide_vector_operations {
#[doc(hidden)] #[doc(hidden)]
#[macro_export(local_inner_macros)] #[macro_export(local_inner_macros)]
macro_rules! impl_wide_matrix_mul { macro_rules! impl_matrix_wide_mul {
( (
//TODO: Fixed point impls //TODO: Fixed point impls
$lhs: expr, $rhs: expr,
($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident { $($vector_field_outer: ident), + }, $size_outer: expr), ($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident { $($vector_field_outer: ident), + }, $size_outer: expr),
($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident { $($matrix_field_inner: ident), + }, $size_inner: expr), ($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident { $($matrix_field_inner: ident), + }, $size_inner: expr),
($rhs_struct_inner: ident { $($rhs_field_inner: ident), + }, $rhs_matrix_inner: ident { $($rhs_matrix_field_inner: ident), + }, $rhs_size_inner: expr) ($rhs_struct_inner: ident { $($rhs_field_inner: ident), + }, $rhs_matrix_inner: ident { $($rhs_matrix_field_inner: ident), + }, $rhs_size_inner: expr),
($lhs: expr, $rhs: expr)
) => { ) => {
impl<T,U> fixed_wide_traits::wide::WideDot<$matrix_inner<$rhs_struct_inner<U>>> for $struct_outer<$struct_inner<T>> impl $struct_outer<$struct_inner<fixed_wide::fixed::Fixed<{$lhs},{$lhs*32}>>>{
where
$struct_inner<T>:fixed_wide_traits::wide::WideDot<$rhs_struct_inner<U>>,
{
type Output=$struct_outer<<$struct_inner<T> as fixed_wide_traits::wide::WideDot<$rhs_struct_inner<U>>::Output>;
paste::item!{ paste::item!{
#[inline] #[inline]
fn [<wide_dot_ $size_outer x $size_inner _ $size_inner x $rhs_size_inner _ $lhs _ $rhs>](self,rhs:$matrix_inner<$rhs_struct_inner<U>>)->Self::Output{ pub fn [<wide_dot_ $size_outer x $size_inner _ $size_inner x $rhs_size_inner _ $lhs _ $rhs>](self,rhs:$matrix_inner<$rhs_struct_inner<fixed_wide::fixed::Fixed<{$rhs},{$rhs*32}>>>)->$struct_outer<$rhs_struct_inner<fixed_wide::fixed::Fixed<{$lhs+$rhs},{($lhs+$rhs)*32}>>>{
//just made this up, don't trust it //just made this up, don't trust it
let tr=rhs.transpose(); let tr=rhs.transpose();
//TODO: use a macro expansion instead of transpose and map //TODO: use a macro expansion instead of transpose and map
@ -120,6 +116,37 @@ macro_rules! impl_wide_matrix_mul {
} }
} }
} }
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_matrix_wide_mul_shim3 {
(
($outer_info:tt,$inner_info:tt,$rhs_info:tt),
($lhs: expr, $rhs: expr)
) => {
$crate::impl_matrix_wide_mul!($outer_info,$inner_info,$rhs_info,($lhs,$rhs));
}
}
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_matrix_wide_mul_shim2 {
(
($outer_info:tt,$inner_info:tt),
$rhs_info:tt
) => {
$crate::do_macro_8x8!(impl_matrix_wide_mul_shim3,($outer_info,$inner_info,$rhs_info));
}
}
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_matrix_wide_mul_shim1 {
(
($outer_info:tt,($($rhs_info:tt),+)),
$inner_info:tt
) => {
$crate::macro_repeated!(impl_matrix_wide_mul_shim2,($outer_info,$inner_info),$($rhs_info),+);
}
}
#[doc(hidden)] #[doc(hidden)]
#[macro_export(local_inner_macros)] #[macro_export(local_inner_macros)]
macro_rules! impl_wide_matrix_operations_2arg_not_const_generic { macro_rules! impl_wide_matrix_operations_2arg_not_const_generic {

View File

@ -47,6 +47,8 @@ macro_rules! impl_matrix_inner_shim {
$matrix_info:tt $matrix_info:tt
) => { ) => {
$crate::macro_repeated!(impl_matrix_inner,$matrix_info,$($vector_info),+); $crate::macro_repeated!(impl_matrix_inner,$matrix_info,$($vector_info),+);
#[cfg(feature="fixed_wide")]
$crate::macro_repeated!(impl_matrix_wide_mul_shim1,($matrix_info,($($vector_info),+)),$($vector_info),+);
} }
} }
#[doc(hidden)] #[doc(hidden)]