private static string GetFullCode() { PermutationGenerator result = new PermutationGenerator(); AppendTTFunc(result, "abs", "fabs"); AppendTTFunc(result, "neg", "-"); AppendTTFunc(result, "sign", "sgn"); AppendTTFunc(result, "relu", "relu"); AppendTTFunc(result, "sqrt", "sqrtf"); AppendTTFunc(result, "rsqrt", "rsqrtf"); AppendTTFunc(result, "exp", "expf"); AppendTTFunc(result, "log", "logf"); AppendTTFunc(result, "log1p", "log1p"); AppendTTFunc(result, "floor", "floor"); AppendTTFunc(result, "ceil", "ceil"); AppendTTFunc(result, "round", "round"); AppendTTFunc(result, "trunc", "trunc"); AppendTTFunc(result, "frac", "Frac"); AppendTTFunc(result, "sigmoid", "Sigmoid"); AppendTTTTFunc(result, "addsigmoidD", "AddSigmoidD"); AppendTTTFunc(result, "sigmoidD", "SigmoidD"); AppendTTTFunc(result, "relud", "relud"); AppendTTTTFunc(result, "addrelud", "addrelud"); AppendTTTTTFunc(result, "mulmuladd", "MulMulAdd"); AppendTTTTFunc(result, "addmul", "AddMul"); AppendTTTSFunc(result, "addmulv", "AddMul"); result.AddApplyTTT("atan2", "*a = atan2f(*b, *c);"); //result.AddApplyTS("t1_pow", "*a = powf(*a, b);"); //result.AddApplyTTS("t2_pow", "*a = powf(*b, c);"); //result.AddApplyTS("t1_tpow", "*a = powf(b, *a);"); //result.AddApplyTTS("t2_tpow", "*a = powf(c, *b);"); result.AddApplyTTTS("lerp", "*a = Lerp(*b, *c, d);"); //result.AddApplyTSS("t1_clamp", "*a = Clamp(*a, b, c);"); //result.AddApplyTTSS("t2_clamp", "*a = Clamp(*b, c, d);"); return(result.ToString()); }
private static void AppendTTTSFunc(PermutationGenerator pg, string kernelBaseName, string func) { pg.AddApplyTTS("t1_" + kernelBaseName, string.Format("*a = {0}(*a, *b, c);", func)); pg.AddApplyTTTS("t2_" + kernelBaseName, string.Format("*a = {0}(*b, *c, d);", func)); }