(
profiler: PerformanceProfiler,
args: argparse.Namespace,
device: torch.device,
dtype: torch.dtype,
batch_size: int,
seq_len: int,
vocab_size: int,
)
| 682 | |
| 683 | |
| 684 | def _run_sampling_native_workload( |
| 685 | profiler: PerformanceProfiler, |
| 686 | args: argparse.Namespace, |
| 687 | device: torch.device, |
| 688 | dtype: torch.dtype, |
| 689 | batch_size: int, |
| 690 | seq_len: int, |
| 691 | vocab_size: int, |
| 692 | ) -> BenchmarkMetrics: |
| 693 | try: |
| 694 | fn = _sampling_fn( |
| 695 | batch_size=batch_size, |
| 696 | vocab_size=vocab_size, |
| 697 | dtype=torch.float32 if device.type == "cpu" else dtype, |
| 698 | device=device, |
| 699 | seed=args.seed + 2, |
| 700 | top_k=args.top_k, |
| 701 | top_p=args.top_p, |
| 702 | ) |
| 703 | return profiler.profile_sampling( |
| 704 | fn, |
| 705 | batch_size=batch_size, |
| 706 | seq_len=seq_len, |
| 707 | vocab_size=vocab_size, |
| 708 | benchmark_name="sampling_native", |
| 709 | ) |
| 710 | except Exception as exc: |
| 711 | return _blocked_metric( |
| 712 | profiler=profiler, |
| 713 | benchmark_name="sampling_native", |
| 714 | batch_size=batch_size, |
| 715 | seq_len=seq_len, |
| 716 | vocab_size=vocab_size, |
| 717 | exc=exc, |
| 718 | ) |
| 719 | |
| 720 | |
| 721 | WORKLOAD_REGISTRY: dict[str, WorkloadRunner] = { |
nothing calls this directly
no test coverage detected