Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix factorization should work in x86 #1441

artidoro opened this issue Oct 29, 2018 · 1 comment


Copy link

commented Oct 29, 2018

Matrix factorization fails in x86 (MatrixFactorizationSimpleTrainAndPredict test was disabled as part of #1432).

The reason is that the MFModel struct is architecture dependent:

private unsafe struct MFModel
public int M;
public int N;
public int K;
public float* P;
public float* Q;

The struct matches the output data structure produced by c++ code in the libmf library.

See the following comment for how this issue should be solved using P/Invoke instead: #1432 (comment)


This comment has been minimized.

Copy link

commented Mar 27, 2019

Looks like users hit this as well:

When you try using Matrix Factorization in an x86 application, you get an exception:

System.ExecutionEngineException: Exception of type 'System.ExecutionEngineException' was thrown.
>	System.Private.CoreLib.dll!System.Runtime.InteropServices.Marshal.Copy(System.IntPtr source, float[] destination, int startIndex, int length) Line 363	C#
 	Microsoft.ML.Recommender.dll!Microsoft.ML.Recommender.Internal.SafeTrainingAndModelBuffer.Get(out int m, out int n, out int k, out float[] p, out float[] q) Line 392	C#
 	Microsoft.ML.Recommender.dll!Microsoft.ML.Trainers.Recommender.MatrixFactorizationModelParameters.MatrixFactorizationModelParameters(Microsoft.ML.Runtime.IHostEnvironment env, Microsoft.ML.Recommender.Internal.SafeTrainingAndModelBuffer buffer, Microsoft.ML.Data.KeyDataViewType matrixColumnIndexType, Microsoft.ML.Data.KeyDataViewType matrixRowIndexType) Line 102	C#
 	Microsoft.ML.Recommender.dll!Microsoft.ML.Trainers.MatrixFactorizationTrainer.TrainCore(Microsoft.ML.Runtime.IChannel ch, Microsoft.ML.Data.RoleMappedData data, Microsoft.ML.Data.RoleMappedData validData) Line 459	C#
 	Microsoft.ML.Recommender.dll!Microsoft.ML.Trainers.MatrixFactorizationTrainer.Fit(Microsoft.ML.IDataView trainData, Microsoft.ML.IDataView validationData) Line 510	C#
 	Microsoft.ML.Recommender.dll!Microsoft.ML.Trainers.MatrixFactorizationTrainer.Fit(Microsoft.ML.IDataView input) Line 520	C#
 	Microsoft.ML.Data.dll!Microsoft.ML.Data.EstimatorChain<Microsoft.ML.Transforms.KeyToValueMappingTransformer>.Fit(Microsoft.ML.IDataView input)	Unknown

cc @wschin @XamlBrewer

@eerhardt eerhardt added the Bug Bash label Mar 27, 2019

@glebuk glebuk added this to To do in v0.12 Apr 1, 2019

@shauheen shauheen removed this from To do in v0.12 Apr 5, 2019

@wschin wschin closed this in #3227 Apr 8, 2019

@wschin wschin added this to Done in v1.0 via automation Apr 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.