GainSight Frontend Python API Documentation
This page documents the frontend Python scripts in gainsight/frontend/ using mkdocstrings.
Please refer to the frontend wiki for a summary of implementation details and usage instructions.
Frontend Script for Accel-Sim Backend
gain_cell_frontend.py
Module for analyzing gain cell memory behavior in GPU workloads.
Provides the GainCellFrontend class to process profiling data and compute write frequencies, retention times, refresh requirements, area, and energy for different gain cell technologies.
Contains helper functions for JSON serialization and command line execution.
GainCellFrontend
Frontend class for analyzing gain cell memory behavior in GPU workloads.
Processes profiling data and computes write frequencies, retention times, refresh requirements,
area, and energy for different gain cell technologies. Use the run method to execute
the full analysis pipeline and return the results as a JSON-serializable dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_results_path
|
str
|
Path to the profiling results CSV file. |
required |
simulation
|
bool
|
Whether the profiling results are from simulation. Defaults to True. |
True
|
sample
|
bool
|
Whether the profiling used sampling techniques. Defaults to False. |
False
|
cluster_path
|
str | None
|
CSV path for cluster data when sampling is used. Defaults to None. |
None
|
freq_retention_dict_path
|
str
|
Path to frequency-retention JSON dict. Defaults to "simple_gc_list.json". |
'simple_gc_list.json'
|
area_power_dict_path
|
str
|
Path to area-power JSON dict. Defaults to "area_power.json". |
'area_power.json'
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
Initializes the frontend instance. |
Source code in frontend/gain_cell_frontend.py
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 145 146 147 148 149 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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | |
__dict__()
Convert analysis results into a JSON-serializable dictionary.
Gathers computed metrics for write frequency, retention, refresh, area, and energy.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary containing all analysis results ready for JSON serialization. |
Source code in frontend/gain_cell_frontend.py
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | |
__init__(profile_results_path, simulation=True, sample=False, cluster_path=None, freq_retention_dict_path='simple_gc_list.json', area_power_dict_path='area_power.json')
Initialize the GainCellFrontend with profiling data.
Sets up constants, loads dictionaries, and imports profile data for analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile_results_path
|
str
|
Path to the profiling results CSV file. |
required |
simulation
|
bool
|
Indicates if data is from simulation. Defaults to True. |
True
|
sample
|
bool
|
Indicates if sampling was used. Defaults to False. |
False
|
cluster_path
|
str | None
|
Path to cluster CSV when sampling. Defaults to None. |
None
|
freq_retention_dict_path
|
str
|
Path to frequency-retention JSON dict. Defaults to "simple_gc_list.json". |
'simple_gc_list.json'
|
area_power_dict_path
|
str
|
Path to area-power JSON dict. Defaults to "area_power.json". |
'area_power.json'
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in frontend/gain_cell_frontend.py
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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
analyze_area(block_size=32, area_efficiency=0.6)
Analyze area requirements for different gain cell technologies.
Computes cache area based on unique addresses, block size, and device area factors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_size
|
int
|
Block size in bytes. Defaults to 32. |
32
|
area_efficiency
|
float
|
Area efficiency factor. Defaults to 0.6. |
0.6
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Sets |
Source code in frontend/gain_cell_frontend.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
analyze_energy(block_size=32)
Analyze energy requirements for different gain cell technologies.
Calculates energy (uJ) for SRAM, silicon, and hybrid designs including refresh overheads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_size
|
int
|
Block size in bytes. Defaults to 32. |
32
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Sets |
Source code in frontend/gain_cell_frontend.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | |
analyze_refresh()
Analyze refresh requirements for gain cell technologies.
Computes the total number of refresh operations needed for each device across all kernels for L1 and L2 caches.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Sets |
Source code in frontend/gain_cell_frontend.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
analyze_retention(percentile=100)
Analyze retention times for different gain cell technologies.
Determines retention times (in microseconds) for 5nm/16nm silicon, Hybrid, and Oxide based on computed write frequencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
percentile
|
int
|
Percentile for selecting write frequency metric. Defaults to 100 (max). |
100
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Populates |
Source code in frontend/gain_cell_frontend.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
analyze_write_freq(percentile=90)
Analyze write frequency for L1 and L2 caches across all kernels.
Calculates maximum, percentile, and weighted average write frequencies based on kernel counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
percentile
|
int
|
Percentile to compute (e.g., 90 for 90th percentile). Defaults to 90. |
90
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Sets attributes |
Source code in frontend/gain_cell_frontend.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
run()
Run the full analysis pipeline.
Executes methods for write frequency, retention, refresh, area, and energy analysis sequentially.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
JSON-serializable dictionary of complete analysis results. |
Source code in frontend/gain_cell_frontend.py
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | |
Frontend Script for SCALE-Sim Backend
convert_to_json_serializable(obj)
Convert NumPy types to native Python types for JSON serialization.
Handles numpy integers, floats, arrays, dicts, and lists by converting them to native Python integers, floats, lists, and dicts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
object
|
The object to convert (list, dict, numpy types). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
object |
object
|
JSON-serializable version of the input object. |
Source code in frontend/scale_sim_frontend.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
get_area_power(area_power_dict_path=None)
Load area and power dictionaries from JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area_power_dict_path
|
str
|
Path to area-power JSON dict. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple
|
Two dictionaries (gain_cell_size, gain_cell_power) mapping device names to area and power values. |
Source code in frontend/scale_sim_frontend.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
get_freq_retention(gc_list_path=None)
Load and convert gain cell frequency retention data.
Reads JSON gain cell list and converts to NumPy arrays for write frequencies and retention times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gc_list_path
|
str
|
Path to gain cell frequency retention JSON. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary with keys 'write_freq', 'hybrid_retention', 'oxide_retention' containing numpy arrays. |
Source code in frontend/scale_sim_frontend.py
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 | |
get_full_path(workload_name, workload_size, dataflow)
Construct full path to Scale-Sim log directory for a given workload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workload_name
|
str
|
Name of the workload. |
required |
workload_size
|
str
|
Size identifier of the workload. |
required |
dataflow
|
str
|
Dataflow type string. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Full filesystem path to the workload's Scale-Sim logs. |
Source code in frontend/scale_sim_frontend.py
87 88 89 90 91 92 93 94 95 96 97 98 | |
process_workload(full_path)
Process a Scale-Sim workload directory and generate frontend JSON summary.
Loads aggregate and detail CSVs for each layer, computes write frequencies, refresh counts, area, and energy for different gain cell devices, and dumps the results to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
Filesystem path to the workload logs directory. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
JSON-serializable dictionary summarizing the workload results. |
Source code in frontend/scale_sim_frontend.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |