Skip to content

Add AVX intrinsics implementation for Factorization Machine #3654

Closed
@pkumar07

Description

@pkumar07

System information

  • OS version/distro: Windows 10 version 1709
  • .NET Version (eg., dotnet --info): 3.0.100-preview-010184

Issue

I'm trying to add C++ AVX intrinsics implementation for Factorization Machine and doing a dynamic dispatch from FactorizationMachineInterface.cs. I'm using Avx.IsSupported to check for AVX support and then call the CalculateGradientAndUpdateNativeAVX/SSE function declared as an extern.

The build fails with the following error for netcoreapp3.0. Would appreciate your suggestions to fix this.

buildfail

Source code / logs

Here is the Microsoft.ML.StandardTrainers.csproj snippet I'm using:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework Condition="'$(UseIntrinsics)' != 'true'">netstandard2.0</TargetFramework>
    <TargetFrameworks Condition="'$(UseIntrinsics)' == 'true'">netstandard2.0;netcoreapp3.0</TargetFrameworks>
    <IncludeInPackage>Microsoft.ML</IncludeInPackage>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <LangVersion>7.3</LangVersion>
    <DebugType>pdbonly</DebugType>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
    <ProjectReference Include="..\Microsoft.ML.CpuMath\Microsoft.ML.CpuMath.csproj" />
    <ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
    <Compile Remove="FactorizationMachine/FactorizationMachineInterface.netstandard.cs" />
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
    <Compile Remove="FactorizationMachine/FactorizationMachineInterface.netcoreapp.cs" />
    <PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
  </ItemGroup>

</Project>

FYI:
The build fails when targeting to netcoreapp3.0 even with no modifications to the source code. i.e.
<TargetFramework>netstandard2.0</TargetFramework>
to
<TargetFrameworks>netstandard2.0;netcoreapp3.0</TargetFrameworks>

@glebuk @singlis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions