public static extern int IRInstanceStateSetParam(IRContext context, int hState, int param, ulong value);
/// <summary> /// Performs no operation. /// </summary> public void InitializedKernelContext( IRContext kernelContext, Method kernelMethod) { }
/// <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); }
public static extern int IREmergencyKeyDispose(IRContext context, int hKey);
public static extern int IREmergencyKeySerialize(IRContext context, int hKey, ref byte[] buffSize, ref byte[] buff);
public static extern int IRContextDispose(IRContext context);
public static extern int IREmergencyClose(IRContext context, int hState, int hRootBlock, int hParentBlock, int hEmerngencyKey, int reason, byte[] comments, ref int hBlock);
public static extern int IRRootTemplateSetNetwork(IRContext context, int hTemplate, ulong networkID);
public static extern int IRRootTemplateSetParent(IRContext context, int hTemplate, int parentRootRecord);
public static extern int IRRootTemplateParam(IRContext context, int hTemplate, int param, byte[] value);
public static extern int IRRootTemplateSetEmergencyKey(IRContext context, int hTemplate, int hKey);
public static extern int IRRootTemplateDispose(IRContext context, int hTemplate);
public static extern int IRRootTemplateCreate(IRContext context, ref int hTemplate);
public static extern int IRRootBlockCreate(IRContext context, int hTemplate, int hState, ref int hBlock);
public static extern int IRClose(IRContext context, int hState, int hParentBlock, int reason, byte[] comments, int hSucessor, ref int hBlock);
public static extern int IRBlockDispose(IRContext context, int hBlock);
public static extern int IRContextCreate(byte[] configFile, ref IRContext context);
public static extern int IRBlockLoad(IRContext context, int blockSize, byte[] block, ref int hBlock);
public static extern int IRDataBlockAdd(IRContext context, int hState, int lockKey, int hParentBlock, ulong applicationId, int payloadSize, byte[] payload, ref int hBlock);
public static extern int IRBlockParameter(IRContext context, int hBlock, int param, ref ulong value);
public static extern int IREmergencyKeyCreate(IRContext context, int type, int size, ref int hKey);
public static extern int IRBlockSerialize(IRContext context, int hBlock, ref int buffSize, byte[] buff);
public static extern int IREmergencyKeyLoad(IRContext context, int buffSize, byte[] buff, ref int hKey);
public static extern int IRCheckEmergencyClosing(IRContext context, int hBlock, int hRootBlock);
public void FinishedCodeGeneration( IRContext context, Method entryPoint) { }
public static extern int IRCheckParent(IRContext context, int hBlock, int hParentBlock);
/// <summary> /// Performs no operation. /// </summary> public void OptimizedKernelContext( IRContext kernelContext, Method kernelMethod) { }
public static extern int IRCheckRoot(IRContext context, int hRootBlock);
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(); }
public static extern int IRInstanceStateSerialize(IRContext context, int hState, ref byte[] buffSize, ref byte[] buff);