| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | |
| | | 4 | | namespace InferenceEngine.Core; |
| | | 5 | | |
| | | 6 | | /// <summary>Options for an <see cref="OutOfProcessBaseInferenceEngine{TInput,TOutput}"/>.</summary> |
| | | 7 | | public sealed class OutOfProcessEngineOptions |
| | | 8 | | { |
| | | 9 | | /// <summary>Absolute path to the consumer's worker executable (the same app, launched with |
| | | 10 | | /// <see cref="WorkerArguments"/> so it enters <see cref="Worker.InferenceWorkerHost"/>).</summary> |
| | 37 | 11 | | public required string WorkerExecutablePath { get; init; } |
| | | 12 | | |
| | | 13 | | /// <summary>Arguments appended after <see cref="WorkerExecutablePath"/> to enter the worker mode. |
| | | 14 | | /// Default is <c>["--worker", "inference"]</c>; match the consumer's <c>Program.cs</c> entry point. |
| | | 15 | | /// A list (not a single string) avoids fragility with arguments containing spaces.</summary> |
| | 59 | 16 | | public IReadOnlyList<string> WorkerArguments { get; init; } = new[] { "--worker", "inference" }; |
| | | 17 | | |
| | | 18 | | /// <summary>Consumer-defined id identifying which engine the worker should construct.</summary> |
| | 149 | 19 | | public string EngineId { get; init; } = string.Empty; |
| | | 20 | | |
| | | 21 | | /// <summary>Environment variables applied to the WORKER process only (e.g. |
| | | 22 | | /// <c>HSA_OVERRIDE_GFX_VERSION=10.3.0</c>). Never applied to the host (which must stay GL-free |
| | | 23 | | /// of ROCm/comgr). Inherits the host's environment by default; these augment/override it.</summary> |
| | 41 | 24 | | public IReadOnlyDictionary<string, string> WorkerEnvironment { get; init; } = new Dictionary<string, string>(); |
| | | 25 | | |
| | | 26 | | /// <summary>In-process engine options mirrored to the worker (model path, GPU toggle, warmup). |
| | | 27 | | /// <see cref="InferenceEngineOptions.OnSessionInitialized"/> does not cross the boundary; the |
| | | 28 | | /// proxy mirrors <see cref="BaseInferenceEngine{TInput,TOutput}.EngineInfo"/> from the worker's |
| | | 29 | | /// Load response and fires the callback on the host via <see cref="BaseInferenceEngine{TInput,TOutput}"/>.</summary |
| | 103 | 30 | | public InferenceEngineOptions EngineOptions { get; init; } = new(); |
| | | 31 | | |
| | | 32 | | /// <summary>Timeout for the worker to start, handle <c>load</c>, and emit its EngineInfo. |
| | | 33 | | /// The first MIGraphX program compile can take ~85s; default is generous.</summary> |
| | 108 | 34 | | public TimeSpan StartupTimeout { get; init; } = TimeSpan.FromMinutes(3); |
| | | 35 | | |
| | | 36 | | /// <summary>Timeout for a single <c>predict</c> round-trip.</summary> |
| | 67 | 37 | | public TimeSpan InferenceTimeout { get; init; } = TimeSpan.FromSeconds(60); |
| | | 38 | | } |