-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Velocity SIMD CPU Runtime (Runtime + Scalar x2). (#1055)
* Extended TypeInformation.ttinclude to contain Velocity information. * Extended declarative unary math functions with implementation details for Velocity backend. * Added new VelocityOperations.ttinclude T4 include file to represent Velocity stack-operation type information. * Added new VelocityMasks analysis to determine information about required vector lane masks. * Added new VelocityHelpers managing VelocityWarpOperationMode enumerations to get information about the current state of the virtual Velocity evaluation stack. * Added generic VelocityTargetSpecializer to support vectorized and scalar code generation for different platforms. * Added new VelocityCodeGenerator to build mask-based SIMD control flow to Velocity backend. * Added new VelocityCodeGenerator.Views to generate code for View-based values to Velocity backend. * Added new VelocityCodeGenerator.Values to generate code for general IR values to Velocity backend. * Added new VelocityCodeGenerator.Threads to generate code for Thread-based values to Velocity backend. * Added new VelocityCodeGenerator.Terminators to generate code for SIMD-based terminators to Velocity backend. * Added new VelocityCodeGenerator.IO to generate code for SIMD-based IO operations to Velocity backend. * Added new Velocity type generator to created vectorized managed type instances. * Added new VelocityArgumentMapper that constructs padded argument structures based on the PTXArgumentMapper. * Added VelocityKernelFunction generator to Velocity backend. * Added VelocityFunction generator to Velocity backend. * Added abstract internal VelocityParameters class to pass automatically generated parameter instances to Velocity kernels. * Added VelocityGenerationModule to map methods to the managed world and transfer scalar arguments into the vector world. * Added new Velocity argument mapper class to convert input .Net arguments. * Added new VelocityCompiledKernel class to represent compiled Velocity kernels. * Added new group context for Velocity kernels. * Added new VelocityBlockScheduling transformation to ensure proper ordering of blocks in the schedule. * Added new general VelocityBackend class to convert compile Velocity kernels. * Added first scalar VelocityTargetSpecializer implementation. * Added scalar type generator to support building pseudo-vectorized types. * Added new automatically generated pseudo-vector instructions used by the scalar Velocity code generator. * Update runtime error messages. * Added Velocity accelerator Capabilities. * Refined peer-access implementation of CPUAccelerator. * Added new VelocityDevice class to represent and configure SIMD-based velocity accelerators. * Added VelocityAccelerator and extension providers. * Added new VelocityStream to represent streams in Velocity land. * Added new VelocityMemoryBuffer to represent memory buffers in Velocity land. * Adapted CPUMemoryBuffer to support new Velocity buffers. * Added new VelocityKernel to represent optimized and compiled Velocity kernels. * Added core ILGPU Velocity tests. * Added Velocity tests to CI pipeline. --------- Co-authored-by: MoFtZ <[email protected]>
- Loading branch information
Showing
52 changed files
with
8,733 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[*.cs] | ||
|
||
# CA1707: Identifiers should not contain underscores | ||
dotnet_diagnostic.CA1707.severity = none | ||
|
||
# CA1014: Mark assemblies with CLSCompliant | ||
dotnet_diagnostic.CA1014.severity = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// --------------------------------------------------------------------------------------- | ||
// ILGPU | ||
// Copyright (c) 2023 ILGPU Project | ||
// www.ilgpu.net | ||
// | ||
// File: Configurations.tt/Configurations.cs | ||
// | ||
// This file is part of ILGPU and is distributed under the University of Illinois Open | ||
// Source License. See LICENSE.txt for details. | ||
// --------------------------------------------------------------------------------------- | ||
|
||
<#@ template debug="false" hostspecific="true" language="C#" #> | ||
<#@ include file="../ILGPU.Tests/Generic/ConfigurationBase.tt" #> | ||
<#@ assembly name="System.Core" #> | ||
<#@ import namespace="System.IO" #> | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
<# | ||
var configurationFile = Host.ResolvePath("../ILGPU.Tests/Configurations.txt"); | ||
var configurations = TestConfig.Parse(configurationFile); | ||
#> | ||
namespace ILGPU.Tests.Velocity | ||
{ | ||
<# foreach (var (test, level, collection) in configurations) { #> | ||
<# var name = $"Velocity{test}_{level}"; #> | ||
[Collection("VelocityContextCollection<#= collection #>")] | ||
public sealed partial class <#= name #> : <#= test #> | ||
{ | ||
public <#= name #>( | ||
ITestOutputHelper output, | ||
VelocityTestContext<#= collection #> testContext) | ||
: base(output, testContext) | ||
{ } | ||
} | ||
|
||
<# } #> | ||
<# foreach (var (config, level) in TestConfig.AllConfigurations) { #> | ||
public class VelocityTestContext<#= config #> : VelocityTestContext | ||
{ | ||
public VelocityTestContext<#= config #>() | ||
: base(OptimizationLevel.<#= level #>) | ||
{ } | ||
} | ||
|
||
[CollectionDefinition("VelocityContextCollection<#= config #>")] | ||
public class VelocityContextCollection<#= config #> : | ||
ICollectionFixture<VelocityTestContext<#= config #>> { } | ||
|
||
<# } #> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(LibraryUnitTestTargetFrameworks)</TargetFrameworks> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<RunSettingsFilePath>$(MSBuildProjectDirectory)\..\ILGPU.Tests\.test.runsettings</RunSettingsFilePath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<EnableNETAnalyzers>true</EnableNETAnalyzers> | ||
<AnalysisMode>AllEnabledByDefault</AnalysisMode> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" /> | ||
<PackageReference Include="xunit" Version="2.5.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" /> | ||
<PackageReference Include="T4.Build" Version="0.2.4" PrivateAssets="All" /> | ||
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\Src\ILGPU\ILGPU.csproj" /> | ||
<ProjectReference Include="..\ILGPU.Tests\ILGPU.Tests.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="Configurations.cs"> | ||
<DesignTime>True</DesignTime> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Configurations.tt</DependentUpon> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Configurations.tt"> | ||
<Generator>TextTemplatingFileGenerator</Generator> | ||
<LastGenOutput>Configurations.cs</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="Configurations.cs"> | ||
<DesignTime>True</DesignTime> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Configurations.tt</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// --------------------------------------------------------------------------------------- | ||
// ILGPU | ||
// Copyright (c) 2023 ILGPU Project | ||
// www.ilgpu.net | ||
// | ||
// File: TestContext.cs | ||
// | ||
// This file is part of ILGPU and is distributed under the University of Illinois Open | ||
// Source License. See LICENSE.txt for details. | ||
// --------------------------------------------------------------------------------------- | ||
|
||
using ILGPU.Runtime.Velocity; | ||
using System; | ||
|
||
namespace ILGPU.Tests.Velocity | ||
{ | ||
/// <summary> | ||
/// An abstract test context for Velocity accelerators. | ||
/// </summary> | ||
public abstract class VelocityTestContext : TestContext | ||
{ | ||
/// <summary> | ||
/// Creates a new test context instance. | ||
/// </summary> | ||
/// <param name="optimizationLevel">The optimization level to use.</param> | ||
/// <param name="prepareContext">The context preparation handler.</param> | ||
protected VelocityTestContext( | ||
OptimizationLevel optimizationLevel, | ||
Action<Context.Builder> prepareContext) | ||
: base( | ||
optimizationLevel, | ||
builder => prepareContext( | ||
builder.Velocity(VelocityDeviceType.Scalar2)), | ||
context => context.CreateVelocityAccelerator()) | ||
{ } | ||
|
||
/// <summary> | ||
/// Creates a new test context instance. | ||
/// </summary> | ||
/// <param name="optimizationLevel">The optimization level to use.</param> | ||
protected VelocityTestContext(OptimizationLevel optimizationLevel) | ||
: this(optimizationLevel, _ => { }) | ||
{ } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.