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

Moved OpenCL IntrinsicMath implementations. #1204

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ILGPU License
********************************************************************************
University of Illinois/NCSA Open Source License
Copyright (c) 2016-2023 ILGPU Project
Copyright (c) 2016-2024 ILGPU Project
All rights reserved.

Developed by: Marcel Koester ([email protected])
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ILGPU also provides Source Link support for a better debugging experience. Make
ILGPU is licensed under the University of Illinois/NCSA Open Source License.
Detailed license information can be found in LICENSE.txt.

Copyright (c) 2016-2023 ILGPU Project. All rights reserved.
Copyright (c) 2016-2024 ILGPU Project. All rights reserved.

Originally developed by Marcel Koester.

Expand Down
8 changes: 4 additions & 4 deletions Src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</PropertyGroup>

<PropertyGroup>
<LibraryVersionPrefix>1.5.1</LibraryVersionPrefix>
<LibraryAssemblyVersion>1.5.1.0</LibraryAssemblyVersion>
<LibraryFileVersion>1.5.1.0</LibraryFileVersion>
<LibraryPackageValidationBaselineVersion>1.5.0</LibraryPackageValidationBaselineVersion>
<LibraryVersionPrefix>1.5.2-beta1</LibraryVersionPrefix>
<LibraryAssemblyVersion>1.5.2.0</LibraryAssemblyVersion>
<LibraryFileVersion>1.5.2.0</LibraryFileVersion>
<LibraryPackageValidationBaselineVersion>1.5.1</LibraryPackageValidationBaselineVersion>
</PropertyGroup>

<!-- Unit Test Project Configuration -->
Expand Down
28 changes: 1 addition & 27 deletions Src/ILGPU.Algorithms/CL/CLContext.Generated.tt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU Algorithms
// Copyright (c) 2019-2021 ILGPU Project
// Copyright (c) 2019-2024 ILGPU Project
// www.ilgpu.net
//
// File: CLContext.Generated.tt/CLContext.Generated.cs
Expand All @@ -17,16 +17,6 @@
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
<#
var unaryMathFunctions = new ValueTuple<string, Type, string, string>[]
{
UnaryMathFunctions[18], // Rcp
UnaryMathFunctions[19], // Rcp
};
var binaryMathFunctions = new ValueTuple<string, Type, string, string>[]
{
BinaryMathFunctions[6], // Log
BinaryMathFunctions[7], // Log
};
var xmathUnaryCodeGenerators = new ValueTuple<string, string>[]
{
( "RoundAwayFromZero", "round" ),
Expand All @@ -49,22 +39,6 @@ namespace ILGPU.Algorithms.CL
public static void EnableCLAlgorithms(IntrinsicImplementationManager manager)
{
// Register math intrinsics
<# foreach (var (name, type, kind, basicType) in binaryMathFunctions) { #>
manager.RegisterBinaryArithmetic(
BinaryArithmeticKind.<#= kind #>,
BasicValueType.<#= basicType #>,
GetMathIntrinsic(
"<#= name #>",
typeof(<#= type #>), typeof(<#= type #>)));
<# } #>

<# foreach (var (name, type, kind, basicType) in unaryMathFunctions) { #>
manager.RegisterUnaryArithmetic(
UnaryArithmeticKind.<#= kind #>,
BasicValueType.<#= basicType #>,
MathCodeGeneratorIntrinsic);
<# } #>

<# foreach (var (name, functionName) in xmathUnaryCodeGenerators) { #>
RegisterXMathCodeGenerator(
manager,
Expand Down
46 changes: 1 addition & 45 deletions Src/ILGPU.Algorithms/CL/CLContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU Algorithms
// Copyright (c) 2019-2023 ILGPU Project
// Copyright (c) 2019-2024 ILGPU Project
// www.ilgpu.net
//
// File: CLContext.cs
Expand All @@ -27,32 +27,6 @@ namespace ILGPU.Algorithms.CL
/// </summary>
static partial class CLContext
{
/// <summary>
/// The <see cref="CLMath"/> type.
/// </summary>
private static readonly Type CLMathType = typeof(CLMath);

/// <summary>
/// Represents the <see cref="CLMath.GenerateMathIntrinsic(CLBackend,
/// CLCodeGenerator, IR.Value)"/>
/// methods.
/// </summary>
private static readonly MethodInfo MathCodeGenerator =
CLMathType.GetMethod(
nameof(CLMath.GenerateMathIntrinsic),
AlgorithmContext.IntrinsicBindingFlags)
.ThrowIfNull();

/// <summary>
/// Represents the intrinsic representation of the
/// <see cref="MathCodeGenerator"/>.
/// </summary>
private static readonly CLIntrinsic MathCodeGeneratorIntrinsic =
new CLIntrinsic(
MathCodeGenerator,
IntrinsicImplementationMode.GenerateCode)
.ThrowIfNull();

/// <summary>
/// The <see cref="CLGroupExtensions"/> type.
/// </summary>
Expand All @@ -63,24 +37,6 @@ static partial class CLContext
/// </summary>
internal static readonly Type CLWarpExtensionsType = typeof(CLWarpExtensions);

/// <summary>
/// Resolves a CL intrinsic for the given math-function configuration.
/// </summary>
/// <param name="name">The intrinsic name.</param>
/// <param name="types">The parameter types.</param>
/// <returns>The resolved intrinsic representation.</returns>
private static CLIntrinsic GetMathIntrinsic(string name, params Type[] types)
{
var targetMethod = CLMathType.GetMethod(
name,
AlgorithmContext.IntrinsicBindingFlags,
null,
types,
null)
.ThrowIfNull();
return new CLIntrinsic(targetMethod, IntrinsicImplementationMode.Redirect);
}

/// <summary>
/// Registers an intrinsic mapping.
/// </summary>
Expand Down
Loading
Loading