Coverage for  / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / auto_parallel / hyper_offload / ir / replay.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-07-06 05:41 +0800

1# Copyright 2026 Huawei Technologies Co., Ltd 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14# ============================================================================ 

15"""Pre-computed per-op data structures for the replay executor. 

16 

17The replay executor uses a list of :class:`OpGuide` instead of directly 

18accessing :class:`~offload.ir.trace.ActivationTrace`. This 

19decouples the two consumers of the trace data: 

20 

21* **Planner** reads the raw :class:`ActivationTrace` (op access 

22 intervals + storage sizes + opaque intervals). 

23* **Replay executor** reads the pre-digested list of :class:`OpGuide` 

24 (output binding slots + metadata for validation). 

25""" 

26 

27from __future__ import annotations 

28 

29from dataclasses import dataclass, field 

30 

31 

32@dataclass 

33class OpGuide: 

34 """Pre-computed per-op information for the replay executor. 

35 

36 Unlike :class:`~offload.ir.trace.TraceOp` which stores raw 

37 :class:`~offload.ir.trace.StorageAccess` objects with 

38 ``AccessKind``, this guide stores only the pre-classified key lists 

39 and output binding slots that the replay executor actually needs. 

40 """ 

41 

42 name: str 

43 output_leaf_count: int = 0 

44 output_bindings: dict[int, int] = field(default_factory=dict)