예제 #1
0
        public static string Compile(MethodInfo method, ILSource source)
        {
            var builder = new StringBuilder();

            var atomic = method.GetCustomAttribute <AtomicAttribute>();

            if (atomic != null)
            {
                builder.AppendLine("#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable");
                builder.AppendLine("#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable");
            }

            builder.Append($"{CLGenerator.GenerateSignature(method, source)}");

            builder.Append("\n{\n");

            builder.Append($"{GenerateBody(method, source)}");

            builder.Append("\n}\n");

            return(builder.ToString());
        }
예제 #2
0
 public static string CLString(this Type type, ILCode code)
 {
     return(CLGenerator.GenerateType(type, code));
 }