Removed MLX backend #453#454
Conversation
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
…ffected crates. Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
…ixes. Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #454 +/- ##
==========================================
+ Coverage 93.36% 93.72% +0.35%
==========================================
Files 854 841 -13
Lines 38556 37470 -1086
==========================================
- Hits 35999 35118 -881
+ Misses 2557 2352 -205 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Code Suggestions ✨Latest suggestions up to 5a549e9
Previous suggestions✅ Suggestions up to commit 882bd19
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
User description
Describe your changes
Removed MLX backend #453
Issue ticket number and link
closes #453
Code checklist before requesting a review
For details on make, please see BUILD.md
Note: The CI runs all of the above and fixing things before they hit CI speeds
up the review and merge process. Thank you.
PR Type
Enhancement, Tests, Refactoring
Description
Removed MLX backend abstraction: Eliminated all MLX-specific implementations and backend trait abstractions (
LinearAlgebraBackend,BackendTensor,BackendGamma) across tensor, multivector, and topology modulesMigrated from
InternalCpuTensortoCausalTensor: Refactored tensor operations to use unifiedCausalTensor<T>type with direct trait bounds instead of backend-specific wrappersSimplified generic type parameters: Removed backend type parameters from
CausalMultiFieldand other types (e.g.,CausalMultiField<CpuBackend, f32>→CausalMultiField<f32>)Consolidated algebra implementations: Merged feature-gated backend-specific modules into unified implementations for multivector and multifield algebras
Added standalone gamma matrix module: Implemented
get_gammas(),get_basis_gammas(), andget_dual_basis_gammas()functions returningCausalTensor<T>directlyRefactored HKT implementations: Updated higher-kinded type patterns with unsafe pointer casting workaround and simplified trait bounds
Enhanced documentation: Improved examples (Einstein Field Equations) with detailed HKT pattern explanations and mathematical formulas
Updated copyright year: Changed from "2023 - 2026" to "2025" across multiple files
Simplified test suites: Removed backend-specific test variants and stubbed HKT trait tests due to trait bound constraints
Diagram Walkthrough
File Walkthrough
8 files
ein_sum_impl.rs
Refactor tensor operations from InternalCpuTensor to CausalTensordeep_causality_tensor/src/types/causal_tensor/ops/tensor_ein_sum/ein_sum_impl.rs
InternalCpuTensortoCausalTensorwithupdated trait bounds
get_binary_operandsandget_unary_operandto useexecute_ein_suminstead of pattern matching onEinSumOpcontractmethod with improved validation and permutation-basedtensor contraction algorithm
notes and error conditions
mod.rs
Refactor HKT multifield witness with unsafe dispatch patterndeep_causality_multivector/src/extensions/hkt_multifield/mod.rs
LinearAlgebraBackendgeneric parameter with concrete typeTfor
CausalMultiFieldWitnessMonad, CoMonad) with unsafe pointer casting workaround
contracts
CausalTensorandMetricdirectlymod.rs
Add scalar_eval module to extensionsdeep_causality_multivector/src/extensions/mod.rs
scalar_evalto the extensions module exportsmod.rs
Migrate from InternalCpuTensor to CausalTensor APIdeep_causality_tensor/src/types/causal_tensor/api/mod.rs
InternalCpuTensortype references withCausalTensorthroughout the file
TensorDatato more specific traitcombinations (
Clone,RealField,Zero,One,Sum, etc.)qr()method implementation from theTensortraitCausalTensorandEinSumASTdirectly insteadof backend-specific types
products_tests.rs
Remove CpuBackend type parameter from multifield testsdeep_causality_multivector/tests/types/multifield/ops/products_tests.rs
CpuBackendtype parameter fromCausalMultiFieldinstantiationsCausalMultiField::instead ofCausalMultiField::CpuBackendfromdeep_causality_tensordifferential.rs
Remove backend abstraction from differential operatorsdeep_causality_multivector/src/types/multifield/ops/differential.rs
LinearAlgebraBackendgeneric parameter and trait boundsCausalTensormethods
partial_derivative()to use manual index computation insteadof backend slicing
construct_gradient()to use direct tensor operations andremoved backend gamma provider dependency
TensorDatatoField + Copy + Default +PartialOrd + Send + Syncein_sum_op.rs
Add Einstein summation AST operation definitionsdeep_causality_tensor/src/types/causal_tensor/ops/tensor_ein_sum/ein_sum_op.rs
computations
EinSumOpenum with variants for tensor operations (MatMul,DotProd, Trace, etc.)
mat_mul(),contraction())operations (MatMul, BatchMatMul)
gamma.rs
Add standalone gamma matrix computation moduledeep_causality_multivector/src/types/multifield/ops/gamma.rs
algebras
get_gammas(),get_basis_gammas(), andget_dual_basis_gammas()functionsCausalTensordirectly instead of backend-specific typescalculations
12 files
ein_sum_impl_tests.rs
Update tensor operation tests for CausalTensor APIdeep_causality_tensor/src/types/causal_tensor/ops/tensor_ein_sum/ein_sum_impl_tests.rs
CausalTensorinstead ofInternalCpuTensor.into_inner()calls on tensor utility functionsEinSumOpandEinSumASTimports
behavior
arithmetic_tests.rs
Remove backend type parameter from multifield testsdeep_causality_multivector/tests/types/multifield/arithmetic/arithmetic_tests.rs
CpuBackendtype parameter from allCausalMultiFieldinstantiations
CausalMultiFieldCpuBackendmod.rs
Simplify multifield algebra tests without backend parameterdeep_causality_multivector/tests/types/multifield/algebra/mod.rs
CpuBackendtype parameter from allCausalMultiFieldinstantiations
test_normalize_unit_magnitudeto usesquared_magnitude()method
.expect()callsmod_tests.rs
Clean up gamma module test importsdeep_causality_multivector/tests/types/multifield/gamma/mod_tests.rs
CpuBackend,TensorBackend, andfrom_data_helperfrom_data_helperfunction
hkt_multifield_tests.rs
Stub HKT tests and simplify multifield test suitedeep_causality_multivector/tests/extensions/hkt_multifield/hkt_multifield_tests.rs
functor laws, etc.)
and arithmetic operations
trait bound constraints
CausalMultiFieldWitnessand HKT traitimplementations
causal_tensor_ext_hkt_tests.rs
Update HKT tensor tests with type changes and clarificationsdeep_causality_tensor/tests/extensions/causal_tensor_ext_hkt_tests.rs
f64toi32for most teststest_applicative_causal_tensor_apply_non_scalar_functoexpect empty result
test_foldable_causal_tensor_string_concattest for stringconcatenation
test_comonad_causal_tensor_extend_topology_checkwithclarifying comments
test_monad_causal_tensor_nestingtestbatched_matmul_tests.rs
Refactor batched matmul tests to use CausalTensor directlydeep_causality_multivector/tests/types/multifield/ops/batched_matmul_tests.rs
CpuBackendandMlxBackendspecific test implementationsCausalTensorbatched matmultests
operations
CausalTensorAPIconversions_tests.rs
Remove backend type parameter from conversion testsdeep_causality_multivector/tests/types/multifield/ops/conversions_tests.rs
CpuBackendtype parameter from allCausalMultiFieldinstantiations
CausalMultiField::instead ofCausalMultiField::CpuBackendandTensorBackendCpuBackend::shape()calls withCausalTensor::shape()test_ones_creates_identity_matricestestgrades_tests.rs
Remove CpuBackend type parameter from grades testsdeep_causality_multivector/tests/types/multifield/ops/grades_tests.rs
CpuBackendtype parameter from allCausalMultiFieldinstantiations
CausalMultiField::instead ofCausalMultiField::CpuBackendfromdeep_causality_tensormod.rs
Update multifield tests to remove backend abstractiondeep_causality_multivector/tests/types/multifield/mod_tests/mod.rs
CpuBackendandTensorBackendimports and usageCausalMultiField::
f32>toCausalMultiField::Simplified tensor shape assertions to use
CausalTensor::shape()directly
Removed backend-specific method calls in favor of tensor trait methodsdifferential_tests.rs
Remove backend references and partial derivative testsdeep_causality_multivector/tests/types/multifield/ops/differential_tests.rs
CpuBackendandTensorBackendimportsCausalMultiField::to
CausalMultiField::partial_derivative()test cases (approximately 60 lines oftests)
cpu_tests.rs
Refactor gamma matrix tests to remove backend traitdeep_causality_multivector/tests/types/multifield/gamma/cpu_tests.rs
BackendGammatrait andCpuGammaLoaderreferencesget_gammas(),get_basis_gammas(),get_dual_basis_gammas()functionsCpuBackend::shape()totensor.shape()method calls
CpuBackend::to_vec()totensor.to_vec()method2 files
causal_tensor_error.rs
Update copyright year in error moduledeep_causality_tensor/src/errors/causal_tensor_error.rs
ein_sum_validation_error.rs
Update copyright year in validation error moduledeep_causality_tensor/src/errors/ein_sum_validation_error.rs
1 files
einstein_field_causal_tensor.rs
Enhanced Einstein Field Equations example with HKT patternsdeep_causality_tensor/examples/einstein_field_causal_tensor.rs
Pureimport fromdeep_causality_haftEquations and HKT concepts
more explicitly
analysis and quantization
print_header()with mathematical formulasand HKT value proposition
7 files
mod.rs
Remove backend abstraction from multifield algebradeep_causality_multivector/src/types/multifield/algebra/mod.rs
rather than backend details
LinearAlgebraBackend,TensorDatatraits)
to justwith directCausalTensorusage
CausalTensormethods directly instead ofbackend dispatch
squared_magnitude()implementation and simplified traitbounds
mod.rs
Simplify multifield arithmetic without backend abstractiondeep_causality_multivector/src/types/multifield/arithmetic/mod.rs
implementations
towith directCausalTensorusageZero,Add,Sub,Neg, andMulimplementations to use tensoroperators directly
conversions.rs
Remove backend abstraction from multifield conversionsdeep_causality_multivector/src/types/multifield/ops/conversions.rs
LinearAlgebraBackendtraitdependencies
towith directCausalTensorusagefrom_coefficients()andto_coefficients()to useCausalTensormethods directlygammamodulefunctions
reshape(),matmul(), andpermute_axes()methodsmod.rs
Consolidate multivector algebra implementationsdeep_causality_multivector/src/types/multivector/algebra/mod.rs
algebra_mlx,algebra_cpu)CPU-only logic
normalize(),commutator(),inverse(),geometric_product()euclidean_squared_magnitude_3d(),euclidean_magnitude_3d(), andeuclidean_cross_product_3d()for spatialvectors
FieldandRealFieldinstead ofbackend-specific traits
tensor.rs
Simplify tensor trait definitions and boundsdeep_causality_tensor/src/traits/tensor.rs
Clonerequirement from traitdefinition
ein_sum()method signature to useEinSumASTand returnCausalTensortensor_product()return type toCausalTensorslice()return type toCausalTensorinverse()andsvd()trait bounds to use standard numerictraits
qr()method documentation and simplifiedstack()signaturemod.rs
Update tensor reduction module naming and typesdeep_causality_tensor/src/types/causal_tensor/ops/tensor_reduction/mod.rs
InternalCpuTensortoCausalTensorcpu_tensortocausal_tensorndim()tonum_dim()for consistencymod.rs
Update tensor broadcast module naming and typesdeep_causality_tensor/src/types/causal_tensor/ops/tensor_broadcast/mod.rs
InternalCpuTensortoCausalTensorcpu_tensortocausal_tensorndim()tonum_dim()for consistencyPartialOrdconstraint101 files