-
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.
- Loading branch information
Showing
7 changed files
with
193 additions
and
1 deletion.
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,60 @@ | ||
// --------------------------------------------------------------------------------------- | ||
// ILGPU | ||
// Copyright (c) 2024 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); | ||
#> | ||
|
||
#if NET7_0_OR_GREATER | ||
|
||
namespace ILGPU.Tests.Velocity256 | ||
{ | ||
<# foreach (var (test, level, collection) in configurations) { #> | ||
<# var name = $"Velocity256{test}_{level}"; #> | ||
[Collection("Velocity256ContextCollection<#= collection #>")] | ||
public sealed partial class <#= name #> : <#= test #> | ||
{ | ||
public <#= name #>( | ||
ITestOutputHelper output, | ||
Velocity256TestContext<#= collection #> testContext) | ||
: base(output, testContext) | ||
{ } | ||
} | ||
|
||
<# } #> | ||
<# foreach (var (config, level) in TestConfig.AllConfigurations) { #> | ||
public class Velocity256TestContext<#= config #> : Velocity256TestContext | ||
{ | ||
public Velocity256TestContext<#= config #>() | ||
: base( | ||
OptimizationLevel.<#= level #>, | ||
enableAssertions: true, | ||
forceDebugConfig: true, | ||
_ => { }) | ||
{ } | ||
} | ||
|
||
[CollectionDefinition("Velocity256ContextCollection<#= config #>")] | ||
public class Velocity256ContextCollection<#= config #> : | ||
ICollectionFixture<Velocity256TestContext<#= config #>> { } | ||
|
||
<# } #> | ||
} | ||
|
||
#endif |
60 changes: 60 additions & 0 deletions
60
Src/ILGPU.Tests.Velocity256/ILGPU.Tests.Velocity256.csproj
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,60 @@ | ||
<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.9.0" /> | ||
<PackageReference Include="xunit" Version="2.6.6" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6"> | ||
<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,51 @@ | ||
// --------------------------------------------------------------------------------------- | ||
// ILGPU | ||
// Copyright (c) 2024 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; | ||
|
||
#if NET7_0_OR_GREATER | ||
|
||
namespace ILGPU.Tests.Velocity256 | ||
{ | ||
/// <summary> | ||
/// An abstract test context for Velocity accelerators. | ||
/// </summary> | ||
public abstract class Velocity256TestContext : TestContext | ||
{ | ||
/// <summary> | ||
/// Creates a new test context instance. | ||
/// </summary> | ||
/// <param name="optimizationLevel">The optimization level to use.</param> | ||
/// <param name="enableAssertions"> | ||
/// Enables use of assertions. | ||
/// </param> | ||
/// <param name="forceDebugConfig"> | ||
/// Forces use of debug configuration in O1 and O2 builds. | ||
/// </param> | ||
/// <param name="prepareContext">The context preparation handler.</param> | ||
protected Velocity256TestContext( | ||
OptimizationLevel optimizationLevel, | ||
bool enableAssertions, | ||
bool forceDebugConfig, | ||
Action<Context.Builder> prepareContext) | ||
: base( | ||
optimizationLevel, | ||
enableAssertions, | ||
forceDebugConfig, | ||
builder => prepareContext( | ||
builder.Velocity(VelocityDeviceType.Vector256)), | ||
context => context.CreateVelocityAccelerator()) | ||
{ } | ||
} | ||
} | ||
|
||
#endif |
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