stormlog.infer.correlation_accounting

Resolve inference evidence before computing overlap-aware GPU time.

Functions

account_gpu_time(graph)

Keep summed activity, interval union, and iteration elapsed separate.

align_timestamp(timestamp_ns, *, ...)

Translate one timestamp while preserving calibration uncertainty.

covering_alignments(timestamp_ns, *, ...)

Return the alignments whose domains and validity window cover a timestamp.

resolve_inference_events(records)

Deduplicate events, then resolve references independent of delivery order.

validate_request_shares(graph, accounting, ...)

Validate an explicit model against one measured iteration GPU budget.

Classes

AlignedTimestamp(value_ns, uncertainty_ns, ...)

CorrelationGraph(run_id, requests, ...)

DeviceClock(device_uuid, clock_domain[, ...])

GpuTime(summed_activity_ns, busy_ns, ...)

IterationTiming(elapsed_ns, gpu)

RequestShareEstimate(request_ref, ...[, ...])

RunAccounting(run_id, iterations, ...)

ShareBudget(iteration_ref, device_clock, ...)

UnresolvedReference(event_id, kind, ref)

class stormlog.infer.correlation_accounting.AlignedTimestamp(value_ns: 'int', uncertainty_ns: 'int', clock_domain: 'str')[source]

Bases: object

Parameters:
  • value_ns (int)

  • uncertainty_ns (int)

  • clock_domain (str)

value_ns: int
uncertainty_ns: int
clock_domain: str
class stormlog.infer.correlation_accounting.CorrelationGraph(run_id: 'str | None', requests: 'dict[tuple[EntityRef, EntityRef | None], RequestEvent]', iterations: 'dict[EntityRef, IterationEvent]', stages: 'dict[EntityRef, StageEvent]', memberships: 'tuple[MembershipEvent, ...]', activities: 'dict[EntityRef, ActivityReferenceEvent]', alignments: 'tuple[ClockAlignmentEvent, ...]', unresolved: 'tuple[UnresolvedReference, ...]')[source]

Bases: object

Parameters:
run_id: str | None
requests: dict[tuple[EntityRef, EntityRef | None], RequestEvent]
iterations: dict[EntityRef, IterationEvent]
stages: dict[EntityRef, StageEvent]
memberships: tuple[MembershipEvent, ...]
activities: dict[EntityRef, ActivityReferenceEvent]
alignments: tuple[ClockAlignmentEvent, ...]
unresolved: tuple[UnresolvedReference, ...]
class stormlog.infer.correlation_accounting.DeviceClock(device_uuid: 'str', clock_domain: 'str', clock_kind: 'str' = 'monotonic')[source]

Bases: object

Parameters:
  • device_uuid (str)

  • clock_domain (str)

  • clock_kind (str)

device_uuid: str
clock_domain: str
clock_kind: str = 'monotonic'
class stormlog.infer.correlation_accounting.GpuTime(summed_activity_ns: 'int', busy_ns: 'int', activity_count: 'int')[source]

Bases: object

Parameters:
  • summed_activity_ns (int)

  • busy_ns (int)

  • activity_count (int)

summed_activity_ns: int
busy_ns: int
activity_count: int
class stormlog.infer.correlation_accounting.IterationTiming(elapsed_ns: 'int | None', gpu: 'dict[DeviceClock, GpuTime]')[source]

Bases: object

Parameters:
elapsed_ns: int | None
gpu: dict[DeviceClock, GpuTime]
class stormlog.infer.correlation_accounting.RequestShareEstimate(request_ref: 'EntityRef', duration_ns: 'int', model: 'str', attempt_ref: 'EntityRef | None' = None)[source]

Bases: object

Parameters:
request_ref: EntityRef
duration_ns: int
model: str
attempt_ref: EntityRef | None = None
class stormlog.infer.correlation_accounting.RunAccounting(run_id: 'str | None', iterations: 'dict[EntityRef, IterationTiming]', device_totals: 'dict[DeviceClock, GpuTime]', unattributed_activity_refs: 'tuple[EntityRef, ...]', unmeasured_gpu_activity_refs: 'tuple[EntityRef, ...]')[source]

Bases: object

Parameters:
run_id: str | None
iterations: dict[EntityRef, IterationTiming]
device_totals: dict[DeviceClock, GpuTime]
unattributed_activity_refs: tuple[EntityRef, ...]
unmeasured_gpu_activity_refs: tuple[EntityRef, ...]
class stormlog.infer.correlation_accounting.ShareBudget(iteration_ref: 'EntityRef', device_clock: 'DeviceClock', budget_ns: 'int', shares: 'tuple[RequestShareEstimate, ...]', unattributed_ns: 'int')[source]

Bases: object

Parameters:
iteration_ref: EntityRef
device_clock: DeviceClock
budget_ns: int
shares: tuple[RequestShareEstimate, ...]
unattributed_ns: int
class stormlog.infer.correlation_accounting.UnresolvedReference(event_id: 'str', kind: 'str', ref: 'EntityRef')[source]

Bases: object

Parameters:
event_id: str
kind: str
ref: EntityRef
stormlog.infer.correlation_accounting.account_gpu_time(graph)[source]

Keep summed activity, interval union, and iteration elapsed separate.

Parameters:

graph (CorrelationGraph)

Return type:

RunAccounting

stormlog.infer.correlation_accounting.align_timestamp(timestamp_ns, *, from_clock_domain, to_clock_domain, alignments)[source]

Translate one timestamp while preserving calibration uncertainty.

Parameters:
  • timestamp_ns (int)

  • from_clock_domain (str)

  • to_clock_domain (str)

  • alignments (Iterable[ClockAlignmentEvent])

Return type:

AlignedTimestamp

stormlog.infer.correlation_accounting.covering_alignments(timestamp_ns, *, from_clock_domain, to_clock_domain, alignments)[source]

Return the alignments whose domains and validity window cover a timestamp.

align_timestamp needs exactly one; callers can use the count to tell a missing alignment from an ambiguous one.

Parameters:
  • timestamp_ns (int)

  • from_clock_domain (str)

  • to_clock_domain (str)

  • alignments (Iterable[ClockAlignmentEvent])

Return type:

list[ClockAlignmentEvent]

stormlog.infer.correlation_accounting.resolve_inference_events(records)[source]

Deduplicate events, then resolve references independent of delivery order.

Parameters:

records (Iterable[CorrelationEvent | LegacyInferenceRecord])

Return type:

CorrelationGraph

stormlog.infer.correlation_accounting.validate_request_shares(graph, accounting, *, iteration_ref, device_clock, shares, unattributed_ns)[source]

Validate an explicit model against one measured iteration GPU budget.

Parameters:
Return type:

ShareBudget