Skip to content
Discussion options

You must be logged in to vote

I think what you do is define a method that describes your computation and then intercept it by reading it's contents and either output code as-as or rewriting code if it matches what your generator is looking for. So it's basically a sort of compiler within compiler.

E.g.:

// input
static void MyArrayComputation(float[] a, float[] b, float c[])
{
    var d = a * b + c;
    var log = Math.Log(d);
    ...
}

// generated
[InterceptsLocation(blabla)]
static void MyArrayComputationGenerated(float[] a, float[] b)
{
    var d = FmaRoutineAllocNew(a, b, c); // your helper method because you've recognized that a * b + c can be optimized with FMA
    var log = Math.Log(d);
    ...
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CyrusNajmabadi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants