-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
144 lines (120 loc) · 4.24 KB
/
config.py
File metadata and controls
144 lines (120 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
"""
Configuration settings for LLM-Bisect.
This module centralizes all configuration parameters including paths,
model settings, and runtime options.
"""
import os
from dataclasses import dataclass, field
from typing import Optional, List
from pathlib import Path
@dataclass
class PathConfig:
"""File system paths configuration."""
kernel_repo: str = "/home/zzhan173/repos/linux"
store_path: str = "/data4/zzhan173/SymTool/cases/"
results_dir: str = "./results"
def __post_init__(self):
Path(self.results_dir).mkdir(parents=True, exist_ok=True)
@dataclass
class LLMConfig:
"""LLM API configuration."""
model: str = "o1" # OpenAI o1 model
temperature: float = 0.0
max_tokens: int = 4000
top_p: float = 1.0
frequency_penalty: float = 0.0
presence_penalty: float = 0.0
max_retries: int = 3
rate_limit_delay: float = 30.0
max_context_tokens: int = 30000
@dataclass
class BisectConfig:
"""Bisect algorithm configuration."""
pool_size: int = 10
max_candidates: int = 100
enable_parallel: bool = True
initial_commit: str = "1da177e4c3f4"
@dataclass
class Config:
"""Main configuration container."""
paths: PathConfig = field(default_factory=PathConfig)
llm: LLMConfig = field(default_factory=LLMConfig)
bisect: BisectConfig = field(default_factory=BisectConfig)
debug: bool = False
@classmethod
def from_env(cls) -> "Config":
"""Create configuration from environment variables."""
config = cls()
if kernel_path := os.getenv("LLM_BISECT_KERNEL_PATH"):
config.paths.kernel_repo = kernel_path
if store_path := os.getenv("LLM_BISECT_STORE_PATH"):
config.paths.store_path = store_path
if model := os.getenv("LLM_BISECT_MODEL"):
config.llm.model = model
if os.getenv("LLM_BISECT_DEBUG"):
config.debug = True
return config
# Global configuration instance
_config: Optional[Config] = None
def get_config() -> Config:
"""Get the global configuration instance."""
global _config
if _config is None:
_config = Config.from_env()
return _config
def set_config(config: Config) -> None:
"""Set the global configuration instance."""
global _config
_config = config
# Linux kernel version tags
MAINLINE_TAGS = [
"v2.6", "v3.0", "v3.1", "v3.2", "v3.3", "v3.4", "v3.5", "v3.6", "v3.7",
"v3.8", "v3.9", "v3.10", "v3.11", "v3.12", "v3.13", "v3.14", "v3.15",
"v3.16", "v3.17", "v3.18", "v3.19", "v4.0", "v4.1", "v4.2", "v4.3",
"v4.4", "v4.5", "v4.6", "v4.7", "v4.8", "v4.9", "v4.10", "v4.11",
"v4.12", "v4.13", "v4.14", "v4.15", "v4.16", "v4.17", "v4.18", "v4.19",
"v4.20", "v5.0", "v5.1", "v5.2", "v5.3", "v5.4", "v5.5", "v5.6", "v5.7",
"v5.8", "v5.9", "v5.10", "v5.11", "v5.12", "v5.13", "v5.14", "v5.15",
"v5.16", "v5.17", "v5.18", "v5.19", "v6.0", "v6.1", "v6.2", "v6.3",
"v6.4", "v6.5", "v6.6", "v6.7", "v6.8", "v6.9", "v6.10", "v6.11",
]
LTS_TAGS = ["v5.4", "v5.10", "v5.15", "v6.1", "v6.6"]
# Known fix tag corrections (some fix tags in commits are incorrect)
FIX_TAG_CORRECTIONS = {
"10f9f426ac6e": "5031ffcc79b81",
"206c857dd17d": "0058ff2befe37",
"34cf99c250d5": "b69a2afd5afce",
"1581dafaf0d3": "d8ae72427187",
"02a4d923e440": "6e73dffbb93cb",
"08ac6f132dd7": "f4319f72a9bc",
"2e07e8348ea4": "43cbeee9f9b2",
"189ff16722ee": "ecced8ba8759",
"30cf57da176c": "9db0fb182ea8",
"3f77c7d605b2": "d0f390eae072",
"0c83842df40f": "c2f12630c60f",
"0c9ae0b86050": "a93e7b3315682",
"3bb2a01caa81": "ca2f37dbc532",
"3cffa2ddc4d3": "75c78500ddad",
"08ae9ef829b8": "f9e90b1ac63b",
"08e50cf07184": "1ef6f7c9390f",
"0d92e4a7ffd5": "dbd9733ab674",
"118a8cf504d7": "72bb52620fdf",
}
# Commits to skip due to known issues
SKIP_COMMITS = [
"b3dc6e8003b500861fa3",
"2d8527f2f911fab84aec",
"65e6a2773d655172143c",
"1cb7fdb1dfde1aab6678",
"f1acb109505d983779bb",
"961ebd120565cb60cebe",
"be0384bf599cf1eb8d33",
"6fef2d4c00b5b8561ad6",
"c2af060d1c18beaec563",
"6f7d0f5fd8e440c34465",
"3d5918477f94e4c2f064",
"c9d9eb9c53d37cdebbad",
"24729b307eefcd7c4760",
"e7870cf13d20f56bfc19",
"1ba5bf993c6a3142e18e",
]