torch.compile (inductor)
PyTorch · python · MIT
Use it
Vendorable · source mirrored · MITView source →
No package. Vendor the mirrored source: 34 lines, MIT.
15_Matmul_for_lower_triangular_matrices.py
curl "https://kernelindex.com/api/v1/implementations/kernelbench-l1-15-matmul-for-lower-triangular-matrices-torch-compile-inductor?include=source"interfacepython · torch_compile_inductor
symbolModel.forward
Compatibility
measured onNVIDIA H100
declared hardwaredeclared only
architectures—
dtypes
Benchmark evidence
2 measurements across 1 GPU, fastest first.
Operation / workload
Hardware
Latency
Rank
Observed
Reported · How evidence levels are derived →
Source and license
sourceavailable
revision digestsha256:c430cefdbfd242868317b432c2baf077a13f0f490d1316cf65b5c42d43a26be1
license declaredMIT
license concludedMIT
imported2026-08-26
Kernel source
15_Matmul_for_lower_triangular_matrices.py34 lines
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Simple model that performs a matrix multiplication (C = A * B) where A and B are lower triangular matrices.
"""
def __init__(self):
super(Model, self).__init__()
def forward(self, A, B):
"""
Performs matrix multiplication of lower triangular matrices A and B.
Args:
A (torch.Tensor): Lower triangular matrix of shape (N, N).
B (torch.Tensor): Lower triangular matrix of shape (N, N).
Returns:
torch.Tensor: The result of matrix multiplication C of shape (N, N).
"""
return torch.tril(torch.matmul(A, B))
M = 4096
def get_inputs():
A = torch.rand(M, M)
B = torch.rand(M, M)
A = torch.tril(A)
B = torch.tril(B)
return [A, B]
def get_init_inputs():
return [] # No special initialization inputs neededscrolls · 34 lines total
Source code from KernelBench, © 2023 Anne Ouyang, Simon Guo, Azalia Mirhoseini (Scaling Intelligence Lab, Stanford University), MIT License · MIT
Best evidence level for this revision: reported
JSON