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

Enabled P/Invoke source generation with LibraryImport. #946

Merged
merged 3 commits into from
Mar 14, 2023
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
312 changes: 312 additions & 0 deletions Src/ILGPU.Algorithms/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuBlasAPIVersion</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuRandAPIVersion</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuBlasAPIVersion</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuRandAPIVersion</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuBlasAPIVersion</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuRandAPIVersion</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuBlasAPIVersion</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:ILGPU.Runtime.Cuda.CuRandAPIVersion</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.Create(System.Nullable{ILGPU.Runtime.Cuda.CuRandAPIVersion})</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestoryGenerator(System.IntPtr)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CPUCuRand.#ctor(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas`1.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateCPU(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateGPU(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.GPUCuRand.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.Create(System.Nullable{ILGPU.Runtime.Cuda.CuRandAPIVersion})</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestoryGenerator(System.IntPtr)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CPUCuRand.#ctor(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas`1.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateCPU(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateGPU(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.GPUCuRand.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.Create(System.Nullable{ILGPU.Runtime.Cuda.CuRandAPIVersion})</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestoryGenerator(System.IntPtr)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CPUCuRand.#ctor(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas`1.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateCPU(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateGPU(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.GPUCuRand.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.Create(System.Nullable{ILGPU.Runtime.Cuda.CuRandAPIVersion})</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestoryGenerator(System.IntPtr)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CPUCuRand.#ctor(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuBlas`1.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuBlasAPIVersion)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateCPU(ILGPU.Context,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.CuRand.CreateGPU(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.GPUCuRand.#ctor(ILGPU.Runtime.Cuda.CudaAccelerator,ILGPU.Runtime.Cuda.CuRandRngType,ILGPU.Runtime.Cuda.CuRandAPIVersion)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0005</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestroyGenerator(System.IntPtr)</Target>
<Left>lib/net471/ILGPU.Algorithms.dll</Left>
<Right>lib/net471/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0005</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestroyGenerator(System.IntPtr)</Target>
<Left>lib/net5.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net5.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0005</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestroyGenerator(System.IntPtr)</Target>
<Left>lib/net6.0/ILGPU.Algorithms.dll</Left>
<Right>lib/net6.0/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0005</DiagnosticId>
<Target>M:ILGPU.Runtime.Cuda.API.CuRandAPI.DestroyGenerator(System.IntPtr)</Target>
<Left>lib/netstandard2.1/ILGPU.Algorithms.dll</Left>
<Right>lib/netstandard2.1/ILGPU.Algorithms.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
47 changes: 2 additions & 45 deletions Src/ILGPU.Algorithms/Runtime/Cuda/API/CuBlasAPI.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------------------------
// ILGPU Algorithms
// Copyright (c) 2020-2021 ILGPU Project
// Copyright (c) 2020-2023 ILGPU Project
// www.ilgpu.net
//
// File: CuBlasAPI.cs
Expand Down Expand Up @@ -67,53 +67,10 @@ ex is DllNotFoundException ||
}

/// <summary>
/// Constructs a new cuRAND API instance.
/// Constructs a new cuBlas API instance.
/// </summary>
protected CuBlasAPI() { }

#endregion

#region Methods
public abstract CuBlasStatus Create(out IntPtr handle);

public abstract CuBlasStatus GetVersion(
IntPtr handle,
out int version);

public abstract CuBlasStatus Free(IntPtr handle);

public abstract CuBlasStatus GetStream(
IntPtr handle,
out IntPtr stream);

public abstract CuBlasStatus SetStream(
IntPtr handle,
IntPtr stream);

public abstract CuBlasStatus GetPointerMode(
IntPtr handle,
out CuBlasPointerMode mode);

public abstract CuBlasStatus SetPointerMode(
IntPtr handle,
CuBlasPointerMode mode);

public abstract CuBlasStatus GetAtomicsMode(
IntPtr handle,
out CuBlasAtomicsMode mode);

public abstract CuBlasStatus SetAtomicsMode(
IntPtr handle,
CuBlasAtomicsMode mode);

public abstract CuBlasStatus GetMathMode(
IntPtr handle,
out CuBlasMathMode mode);

public abstract CuBlasStatus SetMathMode(
IntPtr handle,
CuBlasMathMode mode);

#endregion
}
}
Loading