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

Velocity SIMD CPU Runtime (Runtime + Scalar x2) #1055

Merged
merged 38 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6ae3a49
Extended TypeInformation.ttinclude to contain Velcocity information.
m4rs-mt Sep 5, 2023
d6eef4a
Extended declarative unary math functions with implementation details…
m4rs-mt Jan 26, 2023
22cb5c3
Added new VelocityOperations.ttinclude T4 include file to represent V…
m4rs-mt Aug 24, 2023
0f49bf6
Added new VelocityMasks analysis to determine information about requi…
m4rs-mt Aug 24, 2023
4ebf5b4
Added new VelocityHelpers managing VelocityWarpOperationMode enumerat…
m4rs-mt Aug 24, 2023
16b0ee1
Added generic VelocityTargetSpecializer to support vectorized and sca…
m4rs-mt Aug 24, 2023
a99e8d1
Added new VelocityCodeGenerator to build mask-based SIMD control flow…
m4rs-mt Jan 26, 2023
edc96a8
Added new VelocityCodeGenerator.Views to generate code for View-based…
m4rs-mt Mar 2, 2023
247d84e
Added new VelocityCodeGenerator.Values to generate code for general I…
m4rs-mt Mar 2, 2023
522cf10
Added new VelocityCodeGenerator.Threads to generate code for Thread-b…
m4rs-mt Mar 2, 2023
b62a106
Added new VelocityCodeGenerator.Terminators to generate code for SIMD…
m4rs-mt Mar 2, 2023
1296945
Added new VelocityCodeGenerator.IO to generate code for SIMD-based IO…
m4rs-mt Mar 2, 2023
d1853b8
Added new Velocity type generator to created vectorized managed type …
m4rs-mt Jan 26, 2023
9a366a3
Registered new Velocity backend type.
m4rs-mt Jan 26, 2023
45dd41b
Added new VelocityArgumentMapper that constructs padded argument stru…
m4rs-mt Jan 26, 2023
be4f046
Added VelocityKernelFunction generator to Velocity backend.
m4rs-mt Jan 26, 2023
08068bb
Added VelocityFunction generator to Velocity backend.
m4rs-mt Mar 2, 2023
7d9caf3
Added abstract internal VelocityParameters class to pass automaticall…
m4rs-mt Mar 2, 2023
d48cd8a
Added VelocityGenerationModule to map methods to the managed world an…
m4rs-mt Jan 26, 2023
4a59c88
Added new Velocity argument mapper class to convert input .Net argume…
m4rs-mt Jan 26, 2023
498ed61
Added new VelocityCompiledKernel class to represent compiled Velocity…
m4rs-mt Mar 2, 2023
4b18243
Added new group context for Velocity kernels.
m4rs-mt Aug 24, 2023
8f861f6
Added new VelocityBlockScheduling transformation to ensure proper ord…
m4rs-mt Aug 30, 2023
f4df4d0
Added new general VelocityBackend class to convert compile Velocity k…
m4rs-mt Mar 2, 2023
90d3206
Added first scalar VelocityTargetSpecializer implementation.
m4rs-mt Aug 24, 2023
36d02e7
Added scalar type generator to support building pseudo-vectorized types.
m4rs-mt Aug 24, 2023
8a7b105
Added new automatically generated pseudo-vector instructions used by …
m4rs-mt Aug 24, 2023
62a69d4
Update runtime error messages.
m4rs-mt Jan 26, 2023
3537b05
Added Velocity accelerator Capabilities.
m4rs-mt Aug 28, 2023
fb14c1f
Refined peer-access implementation of CPUAccelerator.
m4rs-mt Jan 26, 2023
10dfd1e
Added new VelocityDevice class to represent and configure SIMD-based …
m4rs-mt Mar 2, 2023
a547c95
Added VelocityAccelerator and extension providers.
m4rs-mt Jan 26, 2023
72826ad
Added new VelocityStream to represent streams in Velocity land.
m4rs-mt Mar 2, 2023
63433e3
Added new VelocityMemoryBuffer to represent memory buffers in Velocit…
m4rs-mt Mar 2, 2023
c5ca0bb
Adapted CPUMemoryBuffer to support new Velocity buffers.
m4rs-mt Mar 2, 2023
9281464
Added new VelocityKernel to represent optimized and compiled Velocity…
m4rs-mt Mar 2, 2023
3b82ea8
Added core ILGPU Velocity tests.
m4rs-mt Mar 2, 2023
deb6989
Added Velocity tests to CI pipeline.
MoFtZ Sep 12, 2023
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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ jobs:
os: ${{ fromJson(needs.setup-os-matrix.outputs.os) }}
library: [ILGPU, ILGPU.Algorithms]
framework: [net6.0, net7.0]
flavor: [CPU, Velocity]
exclude:
- library: ILGPU.Algorithms
flavor: Velocity
- os: cuda
flavor: Velocity
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -174,7 +180,7 @@ jobs:
- name: Set test flavor
id: test-flavor
shell: bash
run: echo "flavor=$([[ "${{ matrix.os }}" == cuda ]] && echo "Cuda" || echo "CPU")" >> $GITHUB_OUTPUT
run: echo "flavor=$([[ "${{ matrix.os }}" == cuda ]] && echo "Cuda" || echo "${{ matrix.flavor }}")" >> $GITHUB_OUTPUT

- name: Build and test
run: dotnet test Src/${{ matrix.library }}.Tests.${{ steps.test-flavor.outputs.flavor }} --configuration=Release --framework=${{ matrix.framework }} -p:TreatWarningsAsErrors=true
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ Src/ILGPU/AtomicFunctions.cs
Src/ILGPU/Backends/PTX/PTXIntrinsics.Generated.cs
Src/ILGPU/Backends/PTX/PTXLibDeviceMethods.cs
Src/ILGPU/Backends/PTX/PTXLibDeviceNvvm.cs
Src/ILGPU/Backends/Velocity/Scalar/ScalarOperations.cs
Src/ILGPU/Frontend/Intrinsic/RemappedIntrinsics.Generated.cs
Src/ILGPU/HalfConversion.cs
Src/ILGPU/IR/Construction/ArithmeticOperations.cs
Expand Down Expand Up @@ -339,6 +340,7 @@ Src/ILGPU.Tests/.test.runsettings
Src/ILGPU.Tests.CPU/Configurations.cs
Src/ILGPU.Tests.Cuda/Configurations.cs
Src/ILGPU.Tests.OpenCL/Configurations.cs
Src/ILGPU.Tests.Velocity/Configurations.cs

# Generated test source files (Algorithms)
Src/ILGPU.Algorithms.Tests/Generic/ConfigurationBase.cs
Expand Down
7 changes: 7 additions & 0 deletions Src/ILGPU.Tests.Velocity/.editorconfig
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
51 changes: 51 additions & 0 deletions Src/ILGPU.Tests.Velocity/Configurations.tt
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 #>> { }

<# } #>
}
59 changes: 59 additions & 0 deletions Src/ILGPU.Tests.Velocity/ILGPU.Tests.Velocity.csproj
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>
45 changes: 45 additions & 0 deletions Src/ILGPU.Tests.Velocity/TestContext.cs
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, _ => { })
{ }
}
}
7 changes: 7 additions & 0 deletions Src/ILGPU.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILGPU.Algorithms.Tests.Open
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILGPU.Algorithms.Tests", "ILGPU.Algorithms.Tests\ILGPU.Algorithms.Tests.csproj", "{18F2225C-82FD-4B01-8AF9-CF746D16EDA1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILGPU.Tests.Velocity", "ILGPU.Tests.Velocity\ILGPU.Tests.Velocity.csproj", "{4AFD2AAD-FA52-43EA-B9A8-10E948F9A139}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -71,6 +73,10 @@ Global
{18F2225C-82FD-4B01-8AF9-CF746D16EDA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18F2225C-82FD-4B01-8AF9-CF746D16EDA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18F2225C-82FD-4B01-8AF9-CF746D16EDA1}.Release|Any CPU.Build.0 = Release|Any CPU
{4AFD2AAD-FA52-43EA-B9A8-10E948F9A139}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4AFD2AAD-FA52-43EA-B9A8-10E948F9A139}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AFD2AAD-FA52-43EA-B9A8-10E948F9A139}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AFD2AAD-FA52-43EA-B9A8-10E948F9A139}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -84,6 +90,7 @@ Global
{AA73D3B1-873F-4A79-8347-E0781E382FF8} = {7701FE3C-4187-401C-9612-44667203B0E5}
{6ED7EDA1-E6DA-4867-8084-C0327EEFB7A9} = {7701FE3C-4187-401C-9612-44667203B0E5}
{18F2225C-82FD-4B01-8AF9-CF746D16EDA1} = {7701FE3C-4187-401C-9612-44667203B0E5}
{4AFD2AAD-FA52-43EA-B9A8-10E948F9A139} = {7701FE3C-4187-401C-9612-44667203B0E5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22270DEE-D42D-479D-A76F-B2E7A5F7C949}
Expand Down
7 changes: 6 additions & 1 deletion Src/ILGPU/Backends/Backend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public enum BackendType
/// </summary>
IL,

/// <summary>
/// A Velocity backend.
/// </summary>
Velocity,

/// <summary>
/// A PTX backend.
/// </summary>
Expand Down Expand Up @@ -123,7 +128,7 @@ public void OptimizedKernelContext(
/// <summary>
/// Represents the current kernel context in scope of a backend instance.
/// </summary>
protected readonly ref struct BackendContext
protected internal readonly ref struct BackendContext
{
#region Nested Types

Expand Down
Loading
Loading