Home / Function/ benchmark() — pytorch Function Reference

benchmark() — pytorch Function Reference

Architecture documentation for the benchmark() function in kernels.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  ac0bb274_6e2a_862f_4e64_142f3728825b["benchmark()"]
  2e5be751_fe13_2369_c193_edfcf2c3d83b["get_shapes()"]
  ac0bb274_6e2a_862f_4e64_142f3728825b -->|calls| 2e5be751_fe13_2369_c193_edfcf2c3d83b
  38cd02c9_bda5_f921_f4c9_f7772e1a880b["benchmark_single_shape()"]
  ac0bb274_6e2a_862f_4e64_142f3728825b -->|calls| 38cd02c9_bda5_f921_f4c9_f7772e1a880b
  style ac0bb274_6e2a_862f_4e64_142f3728825b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/genai_layers/kernels.py lines 88–95

    def benchmark(self):
        for M, N in self.get_shapes():
            print(f"\n Tensor dimensions: [{M}, {N}]")
            # quack requires cutlass dtype
            torch_dtype = cutlass_torch.dtype(cutlass.BFloat16)
            x = 0.1 * torch.randn(M, N, device="cuda", dtype=torch_dtype)
            target = torch.randint(0, N, (M,), device="cuda", dtype=torch.int64)
            self.benchmark_single_shape((x, target), setting=f"shape: [{M}, {N}]")

Subdomains

Frequently Asked Questions

What does benchmark() do?
benchmark() is a function in the pytorch codebase.
What does benchmark() call?
benchmark() calls 2 function(s): benchmark_single_shape, get_shapes.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free