Get optimization options.
(self, num_kernels: int)
| 276 | return [] |
| 277 | |
| 278 | def _get_options(self, num_kernels: int) -> Optional[Dict[str, Any]]: |
| 279 | """Get optimization options.""" |
| 280 | |
| 281 | # Variants |
| 282 | variant_choices = [(f"{i} variants", i) for i in [1, 2, 3, 5, 10]] |
| 283 | questions = [ |
| 284 | inquirer.List('variants', |
| 285 | message="How many optimization attempts per kernel?", |
| 286 | choices=variant_choices, |
| 287 | default=3, |
| 288 | carousel=True) |
| 289 | ] |
| 290 | |
| 291 | try: |
| 292 | answers = inquirer.prompt(questions) |
| 293 | if not answers: |
| 294 | return None |
| 295 | variants = answers['variants'] |
| 296 | except Exception as e: |
| 297 | console.print(f"[red]Error: {e}[/red]") |
| 298 | return None |
| 299 | |
| 300 | # GPU |
| 301 | gpu_choices = [ |
| 302 | ('sm_70 - Volta (V100)', 'sm_70'), |
| 303 | ('sm_75 - Turing (RTX 20xx)', 'sm_75'), |
| 304 | ('sm_80 - Ampere (A100)', 'sm_80'), |
| 305 | ('sm_86 - Ampere (RTX 3060/3070)', 'sm_86'), |
| 306 | ('sm_89 - Ada (RTX 40xx)', 'sm_89'), |
| 307 | ('sm_90 - Hopper (H100)', 'sm_90'), |
| 308 | ] |
| 309 | |
| 310 | questions = [ |
| 311 | inquirer.List('gpu', |
| 312 | message="Target GPU", |
| 313 | choices=gpu_choices, |
| 314 | default='sm_86', |
| 315 | carousel=True) |
| 316 | ] |
| 317 | |
| 318 | try: |
| 319 | answers = inquirer.prompt(questions) |
| 320 | if not answers: |
| 321 | return None |
| 322 | gpu = answers['gpu'] |
| 323 | except Exception as e: |
| 324 | console.print(f"[red]Error: {e}[/red]") |
| 325 | return None |
| 326 | |
| 327 | return { |
| 328 | 'variants': variants, |
| 329 | 'target_gpu': gpu, |
| 330 | 'max_registers': 255, |
| 331 | 'shared_mem_kb': 48, |
| 332 | 'iterations': 100 |
| 333 | } |
| 334 | |
| 335 | def _run_optimization(self, file: Path, kernels: List[Dict], options: Dict): |