Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Microsoft.ML.FastTree/RandomForestClassification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,15 @@ public static extern unsafe int DecisionForestClassificationCompute(
[BestFriend]
private bool IsDispatchingToOneDalEnabled()
{
return OneDalUtils.IsDispatchingEnabled();
try
{
return OneDalUtils.IsDispatchingEnabled();
}
catch (Exception)
{
// Bail to default implementation upon encountering any situation where dispatch failed
return false;
}
}

[BestFriend]
Expand Down
10 changes: 9 additions & 1 deletion src/Microsoft.ML.FastTree/RandomForestRegression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,15 @@ public static extern unsafe int DecisionForestRegressionCompute(
[BestFriend]
private bool IsDispatchingToOneDalEnabled()
{
return OneDalUtils.IsDispatchingEnabled();
try
{
return OneDalUtils.IsDispatchingEnabled();
}
catch (Exception)
{
// fall back to original implementation for any circumstance that prevents dispatching
return false;
}
}

[BestFriend]
Expand Down
12 changes: 10 additions & 2 deletions src/Microsoft.ML.Mkl.Components/OlsLinearRegression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
using Microsoft.ML.Internal.Internallearn;
using Microsoft.ML.Internal.Utilities;
using Microsoft.ML.Model;
using Microsoft.ML.OneDal;
using Microsoft.ML.Runtime;
using Microsoft.ML.Trainers;
using Microsoft.ML.OneDal;

[assembly: LoadableClass(OlsTrainer.Summary, typeof(OlsTrainer), typeof(OlsTrainer.Options),
new[] { typeof(SignatureRegressorTrainer), typeof(SignatureTrainer), typeof(SignatureFeatureScorerTrainer) },
Expand Down Expand Up @@ -409,7 +409,15 @@ private void ComputeMklRegression(IChannel ch, FloatLabelCursor.Factory cursorFa
[BestFriend]
private bool IsDispatchingToOneDalEnabled()
{
return OneDalUtils.IsDispatchingEnabled();
try
{
return OneDalUtils.IsDispatchingEnabled();
}
catch (Exception)
{
// Bail to default implementation upon any situation that prevents dispatching
return false;
}
}

private OlsModelParameters TrainCore(IChannel ch, FloatLabelCursor.Factory cursorFactory, int featureCount)
Expand Down
11 changes: 1 addition & 10 deletions src/Microsoft.ML.OneDal/OneDalUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// See the LICENSE file in the project root for more information.

using System;
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.ML.Internal.Utilities;
Expand All @@ -17,14 +17,6 @@ namespace Microsoft.ML.OneDal
internal static class OneDalUtils
{

#if false
[BestFriend]
internal static bool IsDispatchingEnabled()
{
return Environment.GetEnvironmentVariable("MLNET_BACKEND") == "ONEDAL" &&
System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == System.Runtime.InteropServices.Architecture.X64;
}
#else
[BestFriend]
internal static bool IsDispatchingEnabled()
{
Expand All @@ -47,7 +39,6 @@ internal static bool IsDispatchingEnabled()
}
return false;
}
#endif

[BestFriend]
internal static long GetTrainData(IChannel channel, FloatLabelCursor.Factory cursorFactory, ref List<float> featuresList, ref List<float> labelsList, int numberOfFeatures)
Expand Down