Skip to content

[BUG]: Does not run properly on .NET standard 2.1 #1535

@bran-jnw

Description

@bran-jnw

Describe the bug

In the file ILGPU/tree/master/Src/ILGPU/Frontend/Intrinsic/RemappedIntrinsics.cs the following check is to take into account missing features in some versions of .NET:

private static void RegisterCopySignRemappings()
        {
#if !NETFRAMEWORK
            AddRemapping(
                typeof(Math),
                MathType,
                "CopySign",
                typeof(double),
                typeof(double));
            AddRemapping(
                typeof(MathF),
                MathType,
                "CopySign",
                typeof(float),
                typeof(float));
#endif
        }

However, this throws an error when trying to run on .NET Standard 2.1 as the CopySIgn function does not exist in this standard, much like .NET Framework.
This can easily be fixed by adding a preprocessor directive that includes .NET Standard:

private static void RegisterCopySignRemappings()
        {
#if !NETFRAMEWORK && !NETSTANDARD
            AddRemapping(
                typeof(Math),
                MathType,
                "CopySign",
                typeof(double),
                typeof(double));
            AddRemapping(
                typeof(MathF),
                MathType,
                "CopySign",
                typeof(float),
                typeof(float));
#endif
        }

I would have made a pull request but was a bit confused as to which branch was appropriate, so posted here instead.

Environment

  • ILGPU version: 1.5.3
  • .NET version: .NET standard 2.1
  • Operating system: Windows 11
  • Hardware (if GPU-related): RTX 2080 Super

Steps to reproduce

Code should not be needed in this case.

Expected behavior

The expectation was for it not to look for functions that do not exist in the used .NET version, this actually worked fine in .NET Framework 4.7.2 which makes sense based on the preprocessor directives present.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions