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
  3f9404a0_b5ca_d039_2c4e_873e66d4608d["benchmark()"]
  5fc0e2cf_eb29_ca36_919f_3d0adc7f386e["get_shapes()"]
  3f9404a0_b5ca_d039_2c4e_873e66d4608d -->|calls| 5fc0e2cf_eb29_ca36_919f_3d0adc7f386e
  38cd02c9_bda5_f921_f4c9_f7772e1a880b["benchmark_single_shape()"]
  3f9404a0_b5ca_d039_2c4e_873e66d4608d -->|calls| 38cd02c9_bda5_f921_f4c9_f7772e1a880b
  style 3f9404a0_b5ca_d039_2c4e_873e66d4608d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmarks/dynamo/genai_layers/kernels.py lines 561–568

    def benchmark(self):
        for M, N in self.get_shapes():
            print(f"Tensor dimensions: [{M}, {N}]")
            torch_dtype = cutlass_torch.dtype(cutlass.BFloat16)
            x = torch.randn(M, N, device="cuda", dtype=torch_dtype, requires_grad=True)
            w = torch.randn(N, device="cuda", dtype=torch.float32, requires_grad=True)
            dy = torch.randn(M, N, device="cuda", dtype=torch_dtype)
            self.benchmark_single_shape((x, w, dy), 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