Skip to content
KernelIndex
Search⌘K

submission 544931

rajesh0042 · python · License unknown

Use it

Vendorable · source mirrored · license unknownView source →

No package. Vendor the mirrored source: 19 lines, June 9 Researcher Reciprocity License v1.0.

matmul_v3.py
curl "https://kernelindex.com/api/v1/implementations/kernelbot-matmul-v2-544931?include=source"
interfacepython
Compatibility
measured onNVIDIA A100
declared hardwareNVIDIA A100
architecturessm_80
dtypesfp16

Benchmark evidence

1 measurement across 1 GPU, fastest first.

Operation / workload
Hardware
Latency
Rank
Observed
FP16 matmulsuite of 8 cases
NVIDIA A100
652.3µs
#8 of 27
2026-03-13

Reported · How evidence levels are derived →

Source and license

sourceavailable
revision digestsha256:cf2d9793b840e42057acd2cb17f5851cbebfb0df3565dbf7e7d200a9aaadcbdc
license declaredunknown
license concludedunknown
authorsrajesh0042
imported2026-08-15

Kernel source

matmul_v3.py19 lines
import os
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"

import torch
from task import input_t, output_t

# Enable TF32 for faster matmul on A100 (trades some precision for speed)
# FP16 inputs should still benefit from TF32 internal accumulation
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True

# Set preferred cuBLAS algorithm
torch.backends.cuda.preferred_linalg_library("default")

def custom_kernel(data: input_t) -> output_t:
    a, b, c = data
    torch.mm(a, b, out=c)
    return c

Source code from GPU Mode and the KernelBot dataset · June 9 Researcher Reciprocity License v1.0

Changes from previous submission

Against this author's previous submission submission 544928.

⋯ 1 unchanged lines
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
import torch
- import torch.nn.functional as F
from task import input_t, output_t
- # cuBLAS is already highly optimized for A100
- # Try torch.mm which goes through cuBLAS internally but avoid overhead
- # Also try torch.matmul with contiguous tensors
+ # Enable TF32 for faster matmul on A100 (trades some precision for speed)
+ # FP16 inputs should still benefit from TF32 internal accumulation
+ torch.backends.cuda.matmul.allow_tf32 = True
+ torch.backends.cudnn.allow_tf32 = True
+ # Set preferred cuBLAS algorithm
+ torch.backends.cuda.preferred_linalg_library("default")
+
def custom_kernel(data: input_t) -> output_t:
a, b, c = data
- # torch.mm writes to c in-place via addmm with beta=0
torch.mm(a, b, out=c)
return c
scrolls · 23 diff lines total

Best evidence level for this revision: reported

JSON