forked from m4rs-mt/ILGPU
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lambdas via compile-time specialization
see m4rs-mt#463
- Loading branch information
Showing
13 changed files
with
79 additions
and
3 deletions.
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
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,37 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace ILGPU.Tests | ||
{ | ||
public abstract class ClassValues : TestBase | ||
{ | ||
protected ClassValues( | ||
ITestOutputHelper output, | ||
TestContext testContext) | ||
: base(output, testContext) | ||
{ } | ||
|
||
private static void ThisIndependentLambdaKernel( | ||
Index1D index, ArrayView<int> data, Func<int, int> op) | ||
{ | ||
data[index] = op(1); | ||
} | ||
|
||
private static int Inc(int v) => v + 1; | ||
[Fact] | ||
public void ThisIndependentLambda() | ||
{ | ||
Action<Index1D, ArrayView<int>> kernel = | ||
(i, v) => ThisIndependentLambdaKernel(i, v, Inc); | ||
|
||
using var output = Accelerator.Allocate1D<int>(1); | ||
Execute(kernel.Method, new Index1D(1), output.View); | ||
|
||
var expected = new [] { 2 }; | ||
Verify(output.View, expected); | ||
} | ||
} | ||
} | ||
|
||
#pragma warning restore xUnit1026 // Theory methods should use all of their parameters |
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
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
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