Exemple #1
0
 public static extern int IRInstanceStateSetParam(IRContext context, int hState, int param, ulong value);
Exemple #2
0
 /// <summary>
 /// Performs no operation.
 /// </summary>
 public void InitializedKernelContext(
     IRContext kernelContext,
     Method kernelMethod)
 {
 }
Exemple #3
0
 /// <summary>
 /// Creates a new PTX context information.
 /// </summary>
 /// <param name="context">The main context.</param>
 public PTXContextData(Context context)
 {
     intrinsicContext       = new IRContext(context);
     ImplementationResolver = new Resolver(context, IntrinsicContext);
 }
Exemple #4
0
 public static extern int IREmergencyKeyDispose(IRContext context, int hKey);
Exemple #5
0
 public static extern int IREmergencyKeySerialize(IRContext context, int hKey, ref byte[] buffSize, ref byte[] buff);
Exemple #6
0
 public static extern int IRContextDispose(IRContext context);
Exemple #7
0
 public static extern int IREmergencyClose(IRContext context, int hState, int hRootBlock, int hParentBlock, int hEmerngencyKey, int reason, byte[] comments, ref int hBlock);
Exemple #8
0
 public static extern int IRRootTemplateSetNetwork(IRContext context, int hTemplate, ulong networkID);
Exemple #9
0
 public static extern int IRRootTemplateSetParent(IRContext context, int hTemplate, int parentRootRecord);
Exemple #10
0
 public static extern int IRRootTemplateParam(IRContext context, int hTemplate, int param, byte[] value);
Exemple #11
0
 public static extern int IRRootTemplateSetEmergencyKey(IRContext context, int hTemplate, int hKey);
Exemple #12
0
 public static extern int IRRootTemplateDispose(IRContext context, int hTemplate);
Exemple #13
0
 public static extern int IRRootTemplateCreate(IRContext context, ref int hTemplate);
Exemple #14
0
 public static extern int IRRootBlockCreate(IRContext context, int hTemplate, int hState, ref int hBlock);
Exemple #15
0
 public static extern int IRClose(IRContext context, int hState, int hParentBlock, int reason, byte[] comments, int hSucessor, ref int hBlock);
Exemple #16
0
 public static extern int IRBlockDispose(IRContext context, int hBlock);
Exemple #17
0
 public static extern int IRContextCreate(byte[] configFile, ref IRContext context);
Exemple #18
0
 public static extern int IRBlockLoad(IRContext context, int blockSize, byte[] block, ref int hBlock);
Exemple #19
0
 public static extern int IRDataBlockAdd(IRContext context, int hState, int lockKey, int hParentBlock, ulong applicationId, int payloadSize, byte[] payload, ref int hBlock);
Exemple #20
0
 public static extern int IRBlockParameter(IRContext context, int hBlock, int param, ref ulong value);
Exemple #21
0
 public static extern int IREmergencyKeyCreate(IRContext context, int type, int size, ref int hKey);
Exemple #22
0
 public static extern int IRBlockSerialize(IRContext context, int hBlock, ref int buffSize, byte[] buff);
Exemple #23
0
 public static extern int IREmergencyKeyLoad(IRContext context, int buffSize, byte[] buff, ref int hKey);
Exemple #24
0
 public static extern int IRCheckEmergencyClosing(IRContext context, int hBlock, int hRootBlock);
Exemple #25
0
 public void FinishedCodeGeneration(
     IRContext context,
     Method entryPoint)
 {
 }
Exemple #26
0
 public static extern int IRCheckParent(IRContext context, int hBlock, int hParentBlock);
Exemple #27
0
 /// <summary>
 /// Performs no operation.
 /// </summary>
 public void OptimizedKernelContext(
     IRContext kernelContext,
     Method kernelMethod)
 {
 }
Exemple #28
0
 public static extern int IRCheckRoot(IRContext context, int hRootBlock);
Exemple #29
0
            public Resolver(Context context, IRContext irContext)
                : base(irContext)
            {
                MathImplementationResolver resolver;

                using (var phase = context.BeginCodeGeneration(irContext))
                {
                    using (var frontendPhase = phase.BeginFrontendCodeGeneration())
                    {
                        resolver = new MathImplementationResolver(
                            frontendPhase,
                            mathFunction => mathFunction.GetCustomAttribute <PTXMathIntrinsicAttribute>() == null,
                            typeof(XMath), typeof(Resolver));

                        // Declare debugging functions
                        var deviceAssertFunction = frontendPhase.DeclareMethod(
                            new MethodDeclaration(
                                DebugAssertFailedName,
                                irContext.VoidType,
                                MethodFlags.External));

                        using (var failedBuilder = deviceAssertFunction.CreateBuilder())
                        {
                            failedBuilder.AddParameter(irContext.StringType, "message");
                            failedBuilder.AddParameter(irContext.StringType, "file");
                            failedBuilder.AddParameter(
                                irContext.GetPrimitiveType(BasicValueType.Int32),
                                "line");
                            failedBuilder.AddParameter(irContext.StringType, "function");
                            failedBuilder.AddParameter(
                                irContext.GetPrimitiveType(BasicValueType.Int32),
                                "charSize");
                        }

                        debugAssertFunction = frontendPhase.DeclareMethod(
                            new MethodDeclaration(
                                WrapperDebugAssertFailedName,
                                irContext.VoidType,
                                MethodFlags.Inline));
                        using (var assertBuilder = debugAssertFunction.CreateBuilder())
                        {
                            var messageParam = assertBuilder.AddParameter(irContext.StringType, "message");
                            var entryBlock   = assertBuilder.CreateEntryBlock();

                            entryBlock.CreateCall(
                                deviceAssertFunction,
                                ImmutableArray.Create(
                                    messageParam,
                                    entryBlock.CreatePrimitiveValue("Kernel.cs"),
                                    entryBlock.CreatePrimitiveValue(0),
                                    entryBlock.CreatePrimitiveValue("Kernel"),
                                    entryBlock.CreatePrimitiveValue(1)));
                            entryBlock.CreateReturn();
                        }
                    }
                }

                // Perform an initial pass to resolve all PTX-specific intrinsic functions
                var transformer = Transformer.Create(
                    new TransformerConfiguration(MethodTransformationFlags.None, false),
                    new IntrinsicSpecializer <PTXIntrinsicConfiguration>(new PTXIntrinsicConfiguration(
                                                                             this)));

                irContext.Transform(transformer);
                resolver.ApplyTo(this);

                // Resolve all previously unresolved intrinsic functions

                /* This is required since the intrinsic implementation resolver does not perform
                 * time-consuming recursive dependency analyses. This is not an issue since
                 * these analyses and recursive passes are not required for default user kernels.
                 * Unfortunately, we need a second pass at this point to ensure that all intrinsic
                 * function declarations have been properly resolved. */
                irContext.Transform(transformer);

                // Optimize the whole module
                irContext.Optimize();
            }
Exemple #30
0
 public static extern int IRInstanceStateSerialize(IRContext context, int hState, ref byte[] buffSize, ref byte[] buff);