Commit 17449ae
authored
refactor(device): remove dead code from DeviceContext, add dsp_count guard (#7361)
* refactor(device): remove dead code from DeviceContext, add dsp_count guard
Remove unused device_type subsystem from DeviceContext:
- Delete set_device_type(), get_device_type(), is_cpu(), is_gpu(), is_dsp() methods (all zero callers verified via exhaustive search)
- Delete is_initialized(), is_gpu_enabled() (zero callers)
- Delete device_type_ private field (only consumed by removed methods)
- Delete standalone get_device_type(const DeviceContext*) function (zero callers; all 48 call sites use the template version get_device_type(const Device*))
- Delete forward declaration in device_helpers.h
Add assert(PARAM.inp.dsp_count > 0) guard in driver.cpp to prevent
modulo-by-zero undefined behavior.
All other DeviceContext members retained (init(), get_device_id(),
get_device_count(), get_local_rank() — all have active callers).
Build verified with cmake --build (MPI+LCAO).
* fix(dsp): replace assert with runtime WARNING_QUIT for dsp_count
assert() is removed in release builds (NDEBUG), leaving modulo-by-zero\nunprotected. Replace with WARNING_QUIT that works in all builds.\n\nAlso remove now-unused #include <cassert> from the #ifdef __DSP block.\n\nAddresses PR review feedback on #7361.1 parent 23e677e commit 17449ae
3 files changed
Lines changed: 4 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 120 | | |
133 | 121 | | |
134 | 122 | | |
| |||
147 | 135 | | |
148 | 136 | | |
149 | 137 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 138 | | |
181 | 139 | | |
182 | 140 | | |
| |||
190 | 148 | | |
191 | 149 | | |
192 | 150 | | |
193 | | - | |
194 | | - | |
195 | 151 | | |
196 | 152 | | |
197 | 153 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | 154 | | |
209 | 155 | | |
210 | 156 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 24 | | |
32 | 25 | | |
33 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
| |||
0 commit comments