diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5206671c..e44c74d2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,20 +154,26 @@ jobs: os: ${{ fromJson(needs.setup-os-matrix.outputs.os) }} library: [ILGPU, ILGPU.Algorithms, ILGPU.Analyzers] framework: [net6.0, net7.0, net8.0] - flavor: [CPU, Velocity, Velocity128] + flavor: [CPU, Velocity, Velocity128, Velocity256] exclude: - library: ILGPU.Algorithms flavor: Velocity - library: ILGPU.Algorithms flavor: Velocity128 + - library: ILGPU.Algorithms + flavor: Velocity256 - library: ILGPU.Analyzers flavor: Velocity - library: ILGPU.Analyzers flavor: Velocity128 + - library: ILGPU.Analyzers + flavor: Velocity256 - os: cuda flavor: Velocity - os: cuda flavor: Velocity128 + - os: cuda + flavor: Velocity256 - os: cuda library: ILGPU.Analyzers fail-fast: false diff --git a/.gitignore b/.gitignore index 019c1daf2..9b823d2dd 100644 --- a/.gitignore +++ b/.gitignore @@ -346,6 +346,7 @@ Src/ILGPU.Tests.Cuda/Configurations.cs Src/ILGPU.Tests.OpenCL/Configurations.cs Src/ILGPU.Tests.Velocity/Configurations.cs Src/ILGPU.Tests.Velocity128/Configurations.cs +Src/ILGPU.Tests.Velocity256/Configurations.cs # Generated test source files (Algorithms) Src/ILGPU.Algorithms.Tests/Generic/ConfigurationBase.cs diff --git a/Src/ILGPU.Tests.Velocity256/.editorconfig b/Src/ILGPU.Tests.Velocity256/.editorconfig new file mode 100644 index 000000000..09af4abce --- /dev/null +++ b/Src/ILGPU.Tests.Velocity256/.editorconfig @@ -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 diff --git a/Src/ILGPU.Tests.Velocity256/Configurations.tt b/Src/ILGPU.Tests.Velocity256/Configurations.tt new file mode 100644 index 000000000..2d8e81f01 --- /dev/null +++ b/Src/ILGPU.Tests.Velocity256/Configurations.tt @@ -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> { } + +<# } #> +} + +#endif \ No newline at end of file diff --git a/Src/ILGPU.Tests.Velocity256/ILGPU.Tests.Velocity256.csproj b/Src/ILGPU.Tests.Velocity256/ILGPU.Tests.Velocity256.csproj new file mode 100644 index 000000000..d7a492f70 --- /dev/null +++ b/Src/ILGPU.Tests.Velocity256/ILGPU.Tests.Velocity256.csproj @@ -0,0 +1,60 @@ + + + + $(LibraryUnitTestTargetFrameworks) + false + + + + $(MSBuildProjectDirectory)\..\ILGPU.Tests\.test.runsettings + + + + true + AllEnabledByDefault + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + True + True + Configurations.tt + + + + + + TextTemplatingFileGenerator + Configurations.cs + + + + + + + + + + True + True + Configurations.tt + + + + diff --git a/Src/ILGPU.Tests.Velocity256/TestContext.cs b/Src/ILGPU.Tests.Velocity256/TestContext.cs new file mode 100644 index 000000000..256baf226 --- /dev/null +++ b/Src/ILGPU.Tests.Velocity256/TestContext.cs @@ -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 +{ + /// + /// An abstract test context for Velocity accelerators. + /// + public abstract class Velocity256TestContext : TestContext + { + /// + /// Creates a new test context instance. + /// + /// The optimization level to use. + /// + /// Enables use of assertions. + /// + /// + /// Forces use of debug configuration in O1 and O2 builds. + /// + /// The context preparation handler. + protected Velocity256TestContext( + OptimizationLevel optimizationLevel, + bool enableAssertions, + bool forceDebugConfig, + Action prepareContext) + : base( + optimizationLevel, + enableAssertions, + forceDebugConfig, + builder => prepareContext( + builder.Velocity(VelocityDeviceType.Vector256)), + context => context.CreateVelocityAccelerator()) + { } + } +} + +#endif diff --git a/Src/ILGPU.sln b/Src/ILGPU.sln index 89fc63ff4..7cd27280a 100644 --- a/Src/ILGPU.sln +++ b/Src/ILGPU.sln @@ -36,6 +36,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILGPU.Analyzers", "ILGPU.An EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILGPU.Tests.Velocity128", "ILGPU.Tests.Velocity128\ILGPU.Tests.Velocity128.csproj", "{422BA1AE-858D-4AA4-815B-CF42A429D305}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILGPU.Tests.Velocity256", "ILGPU.Tests.Velocity256\ILGPU.Tests.Velocity256.csproj", "{F24B884D-A64B-4511-85B6-FEEDA92CBBA1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -98,6 +100,10 @@ Global {422BA1AE-858D-4AA4-815B-CF42A429D305}.Debug|Any CPU.Build.0 = Debug|Any CPU {422BA1AE-858D-4AA4-815B-CF42A429D305}.Release|Any CPU.ActiveCfg = Release|Any CPU {422BA1AE-858D-4AA4-815B-CF42A429D305}.Release|Any CPU.Build.0 = Release|Any CPU + {F24B884D-A64B-4511-85B6-FEEDA92CBBA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F24B884D-A64B-4511-85B6-FEEDA92CBBA1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F24B884D-A64B-4511-85B6-FEEDA92CBBA1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F24B884D-A64B-4511-85B6-FEEDA92CBBA1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -114,6 +120,7 @@ Global {4AFD2AAD-FA52-43EA-B9A8-10E948F9A139} = {7701FE3C-4187-401C-9612-44667203B0E5} {B0101B27-F153-4041-8DEE-741B651453D5} = {7701FE3C-4187-401C-9612-44667203B0E5} {422BA1AE-858D-4AA4-815B-CF42A429D305} = {7701FE3C-4187-401C-9612-44667203B0E5} + {F24B884D-A64B-4511-85B6-FEEDA92CBBA1} = {7701FE3C-4187-401C-9612-44667203B0E5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {22270DEE-D42D-479D-A76F-B2E7A5F7C949}