Op_Name large_stringlengths 3 27 | Level_ID int64 1 3 | Task_ID int64 1 45 | Category large_stringlengths 3 19 | Input_Shapes large_stringlengths 7 68 | GitHub_URL large_stringlengths 86 110 | GitHub_Raw_URL large_stringlengths 85 109 | Status large_stringclasses 3
values | Correct bool 2
classes | Max_Diff float64 -1 0 | Pallas_Runtime float64 -1 6.35k | JAX_Native_Runtime float64 -1 0.25 | JAX_XLA_Compiled_Runtime float64 -1 0.25 | Pallas_Speedup_Native float64 0 0 | Pallas_Speedup_Compiled float64 0 0 | Pallas_Code large_stringlengths 0 2.23k | Pallas_Code_Original large_stringlengths 0 2.23k | JAX_Code_Module large_stringlengths 71 709 | JAX_Code_Functional large_stringlengths 71 709 | Diff large_stringlengths 227 1.06k ⌀ | Jaxpr_IR large_stringlengths 707 2.57k ⌀ | StableHLO_IR large_stringlengths 3.02k 8.28k ⌀ | Error large_stringclasses 4
values | Target_Hardware large_stringclasses 1
value | Framework large_stringclasses 1
value | Backend large_stringclasses 1
value | JAX_Version large_stringclasses 1
value | Triton_Version large_stringclasses 1
value | Kernel_Name large_stringlengths 13 37 | Original_Source large_stringlengths 0 2.23k | Fixed_Source large_stringlengths 0 2.23k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
relu | 1 | 1 | activation | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/relu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/relu.py | pass | true | 0 | 104.7967 | 0.2017 | 0.2017 | 0.0019 | 0.0019 | """Level 1: Elementwise ReLU via Pallas.
Demonstrates: basic pallas_call, grid, BlockSpec, program_id.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _relu_kernel(x... | """Level 1: Elementwise ReLU via Pallas.
Demonstrates: basic pallas_call, grid, BlockSpec, program_id.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _relu_kernel(x... | @jax.jit
def jax_relu(x: jax.Array) -> jax.Array:
return jnp.maximum(x, 0)
| @jax.jit
def jax_relu(x: jax.Array) -> jax.Array:
return jnp.maximum(x, 0)
| --- a/relu.py
+++ b/relu.py
@@ -18,16 +18,21 @@
def pallas_relu(x: jax.Array) -> jax.Array:
- n = x.shape[0]
- block_size = min(1024, n)
- grid_size = n // block_size
-
+ bm = min(128, x.shape[0])
+ bn = min(128, x.shape[1]) if x.ndim > 1 else x.shape[0]
+ grid = (x.shape[0] // bm, x.shape[1] // ... | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_relu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debu... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | relu_gpu_fixed | """Level 1: Elementwise ReLU via Pallas.
Demonstrates: basic pallas_call, grid, BlockSpec, program_id.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _relu_kernel(x... | """Level 1: Elementwise ReLU via Pallas.
Demonstrates: basic pallas_call, grid, BlockSpec, program_id.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _relu_kernel(x... |
gelu | 1 | 2 | activation | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/gelu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/gelu.py | pass | true | 0.000001 | 814.1361 | 0.2041 | 0.2041 | 0.0003 | 0.0003 | """Level 1: Elementwise GELU via Pallas.
Demonstrates: transcendental functions (tanh, erf) inside kernels.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _gelu_ker... | """Level 1: Elementwise GELU via Pallas.
Demonstrates: transcendental functions (tanh, erf) inside kernels.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _gelu_ker... | @jax.jit
def jax_gelu(x: jax.Array) -> jax.Array:
return jax.nn.gelu(x)
| @jax.jit
def jax_gelu(x: jax.Array) -> jax.Array:
return jax.nn.gelu(x)
| --- a/gelu.py
+++ b/gelu.py
@@ -20,16 +20,21 @@
def pallas_gelu(x: jax.Array) -> jax.Array:
- n = x.shape[0]
- block_size = min(1024, n)
- grid_size = n // block_size
-
+ bm = min(128, x.shape[0])
+ bn = min(128, x.shape[1]) if x.ndim > 1 else x.shape[0]
+ grid = (x.shape[0] // bm, x.shape[1] // ... | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_gelu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debu... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | gelu_gpu_fixed | """Level 1: Elementwise GELU via Pallas.
Demonstrates: transcendental functions (tanh, erf) inside kernels.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _gelu_ker... | """Level 1: Elementwise GELU via Pallas.
Demonstrates: transcendental functions (tanh, erf) inside kernels.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _gelu_ker... |
silu | 1 | 3 | activation | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/silu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/silu.py | pass | true | 0 | 334.4029 | 0.1975 | 0.1975 | 0.0006 | 0.0006 | """Level 1: SiLU (Swish) activation via Pallas.
Provenance: jax.nn.silu / openxla/tokamax gated_linear_unit uses SiLU gate
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... | """Level 1: SiLU (Swish) activation via Pallas.
Provenance: jax.nn.silu / openxla/tokamax gated_linear_unit uses SiLU gate
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... | @jax.jit
def jax_silu(x: jax.Array) -> jax.Array:
return jax.nn.silu(x)
| @jax.jit
def jax_silu(x: jax.Array) -> jax.Array:
return jax.nn.silu(x)
| --- a/silu.py
+++ b/silu.py
@@ -18,16 +18,21 @@
def pallas_silu(x: jax.Array) -> jax.Array:
- n = x.shape[0]
- block_size = min(1024, n)
- grid_size = n // block_size
-
+ bm = min(128, x.shape[0])
+ bn = min(128, x.shape[1]) if x.ndim > 1 else x.shape[0]
+ grid = (x.shape[0] // bm, x.shape[1] // ... | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_silu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debu... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | silu_gpu_fixed | """Level 1: SiLU (Swish) activation via Pallas.
Provenance: jax.nn.silu / openxla/tokamax gated_linear_unit uses SiLU gate
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... | """Level 1: SiLU (Swish) activation via Pallas.
Provenance: jax.nn.silu / openxla/tokamax gated_linear_unit uses SiLU gate
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... |
sigmoid | 1 | 4 | activation | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/sigmoid.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/sigmoid.py | pass | true | 0 | 283.8244 | 0.2116 | 0.2116 | 0.0007 | 0.0007 | """Level 1: Elementwise sigmoid via Pallas.
Provenance: jax.nn.sigmoid, used in loss functions and gating
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/sigmoid", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _sigmoid... | """Level 1: Elementwise sigmoid via Pallas.
Provenance: jax.nn.sigmoid, used in loss functions and gating
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/sigmoid", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _sigmoid... | @jax.jit
def jax_sigmoid(x: jax.Array) -> jax.Array:
return jax.nn.sigmoid(x)
| @jax.jit
def jax_sigmoid(x: jax.Array) -> jax.Array:
return jax.nn.sigmoid(x)
| --- a/sigmoid.py
+++ b/sigmoid.py
@@ -18,16 +18,21 @@
def pallas_sigmoid(x: jax.Array) -> jax.Array:
- n = x.shape[0]
- block_size = min(1024, n)
- grid_size = n // block_size
-
+ bm = min(128, x.shape[0])
+ bn = min(128, x.shape[1]) if x.ndim > 1 else x.shape[0]
+ grid = (x.shape[0] // bm, x.sha... | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_sigmoid attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {d... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | sigmoid_gpu_fixed | """Level 1: Elementwise sigmoid via Pallas.
Provenance: jax.nn.sigmoid, used in loss functions and gating
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/sigmoid", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _sigmoid... | """Level 1: Elementwise sigmoid via Pallas.
Provenance: jax.nn.sigmoid, used in loss functions and gating
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/sigmoid", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _sigmoid... |
tanh | 1 | 5 | activation | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/tanh.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/tanh.py | pass | true | 0 | 252.8305 | 0.2102 | 0.2102 | 0.0008 | 0.0008 | @jax.jit
def jax_tanh(x: jax.Array) -> jax.Array:
return jnp.tanh(x)
| @jax.jit
def jax_tanh(x: jax.Array) -> jax.Array:
return jnp.tanh(x)
| null | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_tanh attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debu... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | tanh_gpu_fixed | ||||
layernorm | 1 | 6 | normalization | [[2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/layernorm.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/layernorm.py | pass | true | 0.000001 | 348.5668 | 0.144 | 0.144 | 0.0004 | 0.0004 | """Level 1: Layer normalization via Pallas.
Demonstrates: mean/variance reduction, epsilon stability, row-parallel tiling.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/layernorm", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas a... | """Level 1: Layer normalization via Pallas.
Demonstrates: mean/variance reduction, epsilon stability, row-parallel tiling.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/layernorm", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas a... | @jax.jit
def jax_layernorm(x: jax.Array) -> jax.Array:
mean = jnp.mean(x, axis=-1, keepdims=True)
var = jnp.var(x, axis=-1, keepdims=True)
return (x - mean) / jnp.sqrt(var + 1e-5)
| @jax.jit
def jax_layernorm(x: jax.Array) -> jax.Array:
mean = jnp.mean(x, axis=-1, keepdims=True)
var = jnp.var(x, axis=-1, keepdims=True)
return (x - mean) / jnp.sqrt(var + 1e-5)
| --- a/layernorm.py
+++ b/layernorm.py
@@ -23,6 +23,8 @@
n_rows = x.shape[0]
block_rows = min(128, n_rows)
n_cols = x.shape[1]
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,1024]. let
b:f32[2048,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(Blocked(block_siz... | module @jit_pallas_layernorm attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>) -> (tensor<2048x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = ... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | layernorm_gpu_fixed | """Level 1: Layer normalization via Pallas.
Demonstrates: mean/variance reduction, epsilon stability, row-parallel tiling.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/layernorm", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas a... | """Level 1: Layer normalization via Pallas.
Demonstrates: mean/variance reduction, epsilon stability, row-parallel tiling.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/layernorm", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas a... |
rmsnorm | 1 | 7 | normalization | [[2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/rmsnorm.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/rmsnorm.py | pass | true | 0.000001 | 170.3765 | 0.0798 | 0.0798 | 0.0005 | 0.0005 | """Level 1: RMS normalization via Pallas.
Demonstrates: squared-mean reduction, rsqrt pattern.
Inspired by pallas-forge's RMSNorm kernel (3.44x over XLA).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/rmsnorm", __doc__)
import jax
import jax.numpy as jnp
from ja... | """Level 1: RMS normalization via Pallas.
Demonstrates: squared-mean reduction, rsqrt pattern.
Inspired by pallas-forge's RMSNorm kernel (3.44x over XLA).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/rmsnorm", __doc__)
import jax
import jax.numpy as jnp
from ja... | @jax.jit
def jax_rmsnorm(x: jax.Array) -> jax.Array:
ms = jnp.mean(x ** 2, axis=-1, keepdims=True)
return x / jnp.sqrt(ms + 1e-5)
| @jax.jit
def jax_rmsnorm(x: jax.Array) -> jax.Array:
ms = jnp.mean(x ** 2, axis=-1, keepdims=True)
return x / jnp.sqrt(ms + 1e-5)
| --- a/rmsnorm.py
+++ b/rmsnorm.py
@@ -23,6 +23,8 @@
n_rows = x.shape[0]
block_rows = min(128, n_rows)
n_cols = x.shape[1]
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,1024]. let
b:f32[2048,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(Blocked(block_siz... | module @jit_pallas_rmsnorm attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>) -> (tensor<2048x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {d... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | rmsnorm_gpu_fixed | """Level 1: RMS normalization via Pallas.
Demonstrates: squared-mean reduction, rsqrt pattern.
Inspired by pallas-forge's RMSNorm kernel (3.44x over XLA).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/rmsnorm", __doc__)
import jax
import jax.numpy as jnp
from ja... | """Level 1: RMS normalization via Pallas.
Demonstrates: squared-mean reduction, rsqrt pattern.
Inspired by pallas-forge's RMSNorm kernel (3.44x over XLA).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/rmsnorm", __doc__)
import jax
import jax.numpy as jnp
from ja... |
matmul | 1 | 8 | matmul | [[1024, 1024], [1024, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/matmul.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/matmul.py | pass | true | 0 | 699.1011 | 0.1664 | 0.1664 | 0.0002 | 0.0002 | """Level 1: Tiled matrix multiplication via Pallas.
Demonstrates: 2D grid, BlockSpec with K-dimension accumulation,
multi-block tiling pattern from the Pallas quickstart.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/matmul", __doc__)
import jax
import jax.numpy... | """Level 1: Tiled matrix multiplication via Pallas.
Demonstrates: 2D grid, BlockSpec with K-dimension accumulation,
multi-block tiling pattern from the Pallas quickstart.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/matmul", __doc__)
import jax
import jax.numpy... | @jax.jit
def jax_matmul(x: jax.Array, y: jax.Array) -> jax.Array:
return x @ y
| @jax.jit
def jax_matmul(x: jax.Array, y: jax.Array) -> jax.Array:
return x @ y
| --- a/matmul.py
+++ b/matmul.py
@@ -20,8 +20,8 @@
def pallas_matmul(x: jax.Array, y: jax.Array) -> jax.Array:
m, k = x.shape
_, n = y.shape
- bm = min(512, m)
- bn = min(512, n)
+ bm = min(16, m)
+ bn = min(16, n)
grid = (m // bm, n // bn)
return pl.pallas_call(
| { lambda ; a:f32[1024,1024] b:f32[1024,1024]. let
c:f32[1024,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(64, 64), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape... | module @jit_pallas_matmul attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x1024xf32>, %arg1: tensor<1024x1024xf32>) -> (tensor<1024x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_c... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | matmul_gpu_fixed | """Level 1: Tiled matrix multiplication via Pallas.
Demonstrates: 2D grid, BlockSpec with K-dimension accumulation,
multi-block tiling pattern from the Pallas quickstart.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/matmul", __doc__)
import jax
import jax.numpy... | """Level 1: Tiled matrix multiplication via Pallas.
Demonstrates: 2D grid, BlockSpec with K-dimension accumulation,
multi-block tiling pattern from the Pallas quickstart.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/matmul", __doc__)
import jax
import jax.numpy... |
batched_matmul | 1 | 9 | matmul | [[8, 256, 256], [8, 256, 256]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/batched_matmul.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/batched_matmul.py | pass | true | 0 | 241.3267 | 0.1036 | 0.1036 | 0.0004 | 0.0004 | """Level 1: Batched matrix multiplication via Pallas.
Provenance: jnp.matmul with batch dims, used in multi-head attention
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/batched_matmul", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pal... | """Level 1: Batched matrix multiplication via Pallas.
Provenance: jnp.matmul with batch dims, used in multi-head attention
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/batched_matmul", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pal... | @jax.jit
def jax_batched_matmul(x: jax.Array, y: jax.Array) -> jax.Array:
return x @ y
| @jax.jit
def jax_batched_matmul(x: jax.Array, y: jax.Array) -> jax.Array:
return x @ y
| --- a/batched_matmul.py
+++ b/batched_matmul.py
@@ -20,15 +20,17 @@
batch, m, k = x.shape
_, _, n = y.shape
+ bm_ = min(32, m)
+ bn_ = min(32, n)
return pl.pallas_call(
_batched_matmul_kernel,
out_shape=jax.ShapeDtypeStruct((batch, m, n), x.dtype),
- grid=(batch,),
+ ... | { lambda ; a:f32[8,256,256] b:f32[8,256,256]. let
c:f32[8,256,256] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(8, 8, 8), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=1), Blocked(block_size=32), Blocked(block_size=256))), B... | module @jit_pallas_batched_matmul attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<8x256x256xf32>, %arg1: tensor<8x256x256xf32>) -> (tensor<8x256x256xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {b... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | batched_matmul_gpu_fixed | """Level 1: Batched matrix multiplication via Pallas.
Provenance: jnp.matmul with batch dims, used in multi-head attention
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/batched_matmul", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pal... | """Level 1: Batched matrix multiplication via Pallas.
Provenance: jnp.matmul with batch dims, used in multi-head attention
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/batched_matmul", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pal... |
outer_product | 1 | 10 | matmul | [[1024], [1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/outer_product.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/outer_product.py | pass | true | 0 | 5,730.2626 | 0.0945 | 0.0945 | 0 | 0 | """Level 1: Outer product via Pallas.
Provenance: jnp.outer, rank-1 update pattern used in Evoformer/AlphaFold
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/outer_product", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
d... | """Level 1: Outer product via Pallas.
Provenance: jnp.outer, rank-1 update pattern used in Evoformer/AlphaFold
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/outer_product", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
d... | @jax.jit
def jax_outer_product(x: jax.Array, y: jax.Array) -> jax.Array:
return jnp.outer(x, y)
| @jax.jit
def jax_outer_product(x: jax.Array, y: jax.Array) -> jax.Array:
return jnp.outer(x, y)
| null | { lambda ; a:f32[1024] b:f32[1024]. let
c:f32[1024,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(1,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=1024),)), BlockMapping(block_shape=(Blocked(block_size=1024),)), BlockM... | module @jit_pallas_outer_product attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024xf32>, %arg1: tensor<1024xf32>) -> (tensor<1024x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_conf... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | outer_product_gpu_fixed | """Level 1: Outer product via Pallas.
Provenance: jnp.outer, rank-1 update pattern used in Evoformer/AlphaFold
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/outer_product", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
d... | """Level 1: Outer product via Pallas.
Provenance: jnp.outer, rank-1 update pattern used in Evoformer/AlphaFold
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/outer_product", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
d... |
reduce_sum | 1 | 11 | reduce | [[4096, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/reduce_sum.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/reduce_sum.py | pass | true | 0.000019 | 94.2345 | 0.1039 | 0.1039 | 0.0011 | 0.0011 | """Level 1: Row-wise sum reduction via Pallas.
Demonstrates: reduction along an axis, row-parallel BlockSpec.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_sum", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... | """Level 1: Row-wise sum reduction via Pallas.
Demonstrates: reduction along an axis, row-parallel BlockSpec.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_sum", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... | @jax.jit
def jax_reduce_sum(x: jax.Array) -> jax.Array:
return jnp.sum(x, axis=-1)
| @jax.jit
def jax_reduce_sum(x: jax.Array) -> jax.Array:
return jnp.sum(x, axis=-1)
| --- a/reduce_sum.py
+++ b/reduce_sum.py
@@ -20,6 +20,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(256, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[4096,2048]. let
b:f32[4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(512,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=8), Blocked(block_size=2048))), BlockMapping(block_shape=(Blocked(block_size=8),)... | module @jit_pallas_reduce_sum attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x2048xf32>) -> (tensor<4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {deb... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | reduce_sum_gpu_fixed | """Level 1: Row-wise sum reduction via Pallas.
Demonstrates: reduction along an axis, row-parallel BlockSpec.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_sum", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... | """Level 1: Row-wise sum reduction via Pallas.
Demonstrates: reduction along an axis, row-parallel BlockSpec.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_sum", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... |
reduce_max | 1 | 12 | reduce | [[4096, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/reduce_max.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/reduce_max.py | pass | true | 0 | 95.0869 | 0.127 | 0.127 | 0.0013 | 0.0013 | """Level 1: Row-wise max reduction via Pallas.
Provenance: jnp.max reduction, used in softmax numerics and argmax patterns
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_max", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... | """Level 1: Row-wise max reduction via Pallas.
Provenance: jnp.max reduction, used in softmax numerics and argmax patterns
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_max", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... | @jax.jit
def jax_reduce_max(x: jax.Array) -> jax.Array:
return jnp.max(x, axis=-1)
| @jax.jit
def jax_reduce_max(x: jax.Array) -> jax.Array:
return jnp.max(x, axis=-1)
| --- a/reduce_max.py
+++ b/reduce_max.py
@@ -21,6 +21,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(256, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[4096,2048]. let
b:f32[4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(512,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=8), Blocked(block_size=2048))), BlockMapping(block_shape=(Blocked(block_size=8),)... | module @jit_pallas_reduce_max attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x2048xf32>) -> (tensor<4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {deb... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | reduce_max_gpu_fixed | """Level 1: Row-wise max reduction via Pallas.
Provenance: jnp.max reduction, used in softmax numerics and argmax patterns
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_max", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... | """Level 1: Row-wise max reduction via Pallas.
Provenance: jnp.max reduction, used in softmax numerics and argmax patterns
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_max", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... |
reduce_mean | 1 | 13 | reduce | [[4096, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/reduce_mean.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/reduce_mean.py | pass | true | 0 | 97.0746 | 0.1352 | 0.1352 | 0.0014 | 0.0014 | """Level 1: Row-wise mean reduction via Pallas.
Provenance: jnp.mean reduction, used in normalization layers
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_mean", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def ... | """Level 1: Row-wise mean reduction via Pallas.
Provenance: jnp.mean reduction, used in normalization layers
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_mean", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def ... | @jax.jit
def jax_reduce_mean(x: jax.Array) -> jax.Array:
return jnp.mean(x, axis=-1)
| @jax.jit
def jax_reduce_mean(x: jax.Array) -> jax.Array:
return jnp.mean(x, axis=-1)
| --- a/reduce_mean.py
+++ b/reduce_mean.py
@@ -21,6 +21,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(256, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[4096,2048]. let
b:f32[4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(512,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=8), Blocked(block_size=2048))), BlockMapping(block_shape=(Blocked(block_size=8),)... | module @jit_pallas_reduce_mean attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x2048xf32>) -> (tensor<4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {de... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | reduce_mean_gpu_fixed | """Level 1: Row-wise mean reduction via Pallas.
Provenance: jnp.mean reduction, used in normalization layers
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_mean", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def ... | """Level 1: Row-wise mean reduction via Pallas.
Provenance: jnp.mean reduction, used in normalization layers
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/reduce_mean", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def ... |
softmax | 1 | 14 | softmax | [[2048, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/softmax.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/softmax.py | pass | true | 0 | 390.0773 | 0.1184 | 0.1184 | 0.0003 | 0.0003 | """Level 1: Row-wise softmax via Pallas.
Demonstrates: reductions within a block, numerical stability (max subtraction),
multi-pass pattern (max -> subtract -> exp -> sum -> divide).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/softmax", __doc__)
import jax
im... | """Level 1: Row-wise softmax via Pallas.
Demonstrates: reductions within a block, numerical stability (max subtraction),
multi-pass pattern (max -> subtract -> exp -> sum -> divide).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/softmax", __doc__)
import jax
im... | @jax.jit
def jax_softmax(x: jax.Array) -> jax.Array:
return jax.nn.softmax(x, axis=-1)
| @jax.jit
def jax_softmax(x: jax.Array) -> jax.Array:
return jax.nn.softmax(x, axis=-1)
| --- a/softmax.py
+++ b/softmax.py
@@ -27,6 +27,8 @@
n_rows = x.shape[0]
block_rows = min(128, n_rows)
n_cols = x.shape[1]
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,2048]. let
b:f32[2048,2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(256,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=8), Blocked(block_size=2048))), BlockMapping(block_shape=(Blocked(block_size... | module @jit_pallas_softmax attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x2048xf32>) -> (tensor<2048x2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {d... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | softmax_gpu_fixed | """Level 1: Row-wise softmax via Pallas.
Demonstrates: reductions within a block, numerical stability (max subtraction),
multi-pass pattern (max -> subtract -> exp -> sum -> divide).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/softmax", __doc__)
import jax
im... | """Level 1: Row-wise softmax via Pallas.
Demonstrates: reductions within a block, numerical stability (max subtraction),
multi-pass pattern (max -> subtract -> exp -> sum -> divide).
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/softmax", __doc__)
import jax
im... |
log_softmax | 1 | 15 | softmax | [[2048, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/log_softmax.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/log_softmax.py | pass | true | 0.000001 | 312.4499 | 0.1174 | 0.1174 | 0.0004 | 0.0004 | """Level 1: Row-wise log-softmax via Pallas.
Provenance: jax.nn.log_softmax, critical for cross-entropy loss computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/log_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas ... | """Level 1: Row-wise log-softmax via Pallas.
Provenance: jax.nn.log_softmax, critical for cross-entropy loss computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/log_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas ... | @jax.jit
def jax_log_softmax(x: jax.Array) -> jax.Array:
return jax.nn.log_softmax(x, axis=-1)
| @jax.jit
def jax_log_softmax(x: jax.Array) -> jax.Array:
return jax.nn.log_softmax(x, axis=-1)
| --- a/log_softmax.py
+++ b/log_softmax.py
@@ -25,6 +25,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(128, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,2048]. let
b:f32[2048,2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(256,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=8), Blocked(block_size=2048))), BlockMapping(block_shape=(Blocked(block_size... | module @jit_pallas_log_softmax attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x2048xf32>) -> (tensor<2048x2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config ... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | log_softmax_gpu_fixed | """Level 1: Row-wise log-softmax via Pallas.
Provenance: jax.nn.log_softmax, critical for cross-entropy loss computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/log_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas ... | """Level 1: Row-wise log-softmax via Pallas.
Provenance: jax.nn.log_softmax, critical for cross-entropy loss computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/log_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas ... |
exp | 1 | 16 | elementwise | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/exp.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/exp.py | pass | true | 0 | 179.5751 | 0.2054 | 0.2054 | 0.0011 | 0.0011 | @jax.jit
def jax_exp(x: jax.Array) -> jax.Array:
return jnp.exp(x)
| @jax.jit
def jax_exp(x: jax.Array) -> jax.Array:
return jnp.exp(x)
| null | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_exp attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debug... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | exp_gpu_fixed | ||||
log | 1 | 17 | elementwise | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/log.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/log.py | pass | true | 0 | 430.9604 | 0.2047 | 0.2047 | 0.0005 | 0.0005 | @jax.jit
def jax_log(x: jax.Array) -> jax.Array:
return jnp.log(x + 1e-7)
| @jax.jit
def jax_log(x: jax.Array) -> jax.Array:
return jnp.log(x + 1e-7)
| null | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_log attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debug... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | log_gpu_fixed | ||||
add | 1 | 18 | elementwise | [[4096, 4096], [4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/add.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/add.py | pass | true | 0 | 128.6307 | 0.2465 | 0.2465 | 0.0019 | 0.0019 | @jax.jit
def jax_add(x: jax.Array, y: jax.Array) -> jax.Array:
return x + y
| @jax.jit
def jax_add(x: jax.Array, y: jax.Array) -> jax.Array:
return x + y
| null | { lambda ; a:f32[4096,4096] b:f32[4096,4096]. let
c:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape... | module @jit_pallas_add attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>, %arg1: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_conf... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | add_gpu_fixed | ||||
multiply | 1 | 19 | elementwise | [[4096, 4096], [4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/multiply.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/multiply.py | pass | true | 0 | 129.6258 | 0.2472 | 0.2472 | 0.0019 | 0.0019 | @jax.jit
def jax_multiply(x: jax.Array, y: jax.Array) -> jax.Array:
return x * y
| @jax.jit
def jax_multiply(x: jax.Array, y: jax.Array) -> jax.Array:
return x * y
| null | { lambda ; a:f32[4096,4096] b:f32[4096,4096]. let
c:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape... | module @jit_pallas_multiply attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>, %arg1: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | multiply_gpu_fixed | ||||
rsqrt | 1 | 20 | elementwise | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/rsqrt.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/rsqrt.py | pass | true | 0 | 149.9465 | 0.2054 | 0.2054 | 0.0014 | 0.0014 | @jax.jit
def jax_rsqrt(x: jax.Array) -> jax.Array:
return jax.lax.rsqrt(x + 1e-5)
| @jax.jit
def jax_rsqrt(x: jax.Array) -> jax.Array:
return jax.lax.rsqrt(x + 1e-5)
| null | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_rsqrt attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {deb... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | rsqrt_gpu_fixed | ||||
clamp | 1 | 21 | elementwise | [[4096, 4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/clamp.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/clamp.py | pass | true | 0 | 114.9357 | 0.2023 | 0.2023 | 0.0018 | 0.0018 | """Level 1: Elementwise clamp via Pallas.
Provenance: jnp.clip, used in gradient clipping and activation clamping
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/clamp", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... | """Level 1: Elementwise clamp via Pallas.
Provenance: jnp.clip, used in gradient clipping and activation clamping
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/clamp", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... | @jax.jit
def jax_clamp(x: jax.Array) -> jax.Array:
return jnp.clip(x, -1.0, 1.0)
| @jax.jit
def jax_clamp(x: jax.Array) -> jax.Array:
return jnp.clip(x, -1.0, 1.0)
| --- a/clamp.py
+++ b/clamp.py
@@ -18,16 +18,21 @@
def pallas_clamp(x: jax.Array) -> jax.Array:
- n = x.shape[0]
- block_size = min(1024, n)
- grid_size = n // block_size
-
+ bm = min(128, x.shape[0])
+ bn = min(128, x.shape[1]) if x.ndim > 1 else x.shape[0]
+ grid = (x.shape[0] // bm, x.shape[1] ... | { lambda ; a:f32[4096,4096]. let
b:f32[4096,4096] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 32), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=128))), BlockMapping(block_shape=(Blocked(block_s... | module @jit_pallas_clamp attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096x4096xf32>) -> (tensor<4096x4096xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {deb... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | clamp_gpu_fixed | """Level 1: Elementwise clamp via Pallas.
Provenance: jnp.clip, used in gradient clipping and activation clamping
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/clamp", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... | """Level 1: Elementwise clamp via Pallas.
Provenance: jnp.clip, used in gradient clipping and activation clamping
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/clamp", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _... |
cross_entropy | 1 | 22 | loss | [[1024, 512], [1024, 512]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/cross_entropy.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/cross_entropy.py | pass | true | 0 | 1,308.4339 | 0.1209 | 0.1209 | 0.0001 | 0.0001 | """Level 1: Row-wise cross-entropy loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... | """Level 1: Row-wise cross-entropy loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... | @jax.jit
def jax_cross_entropy(logits: jax.Array, labels: jax.Array) -> jax.Array:
log_probs = jax.nn.log_softmax(logits, axis=-1)
return -jnp.sum(labels * log_probs, axis=-1)
| @jax.jit
def jax_cross_entropy(logits: jax.Array, labels: jax.Array) -> jax.Array:
log_probs = jax.nn.log_softmax(logits, axis=-1)
return -jnp.sum(labels * log_probs, axis=-1)
| --- a/cross_entropy.py
+++ b/cross_entropy.py
@@ -27,6 +27,8 @@
n_rows = logits.shape[0]
n_cols = logits.shape[1]
block_rows = min(128, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[1024,512] b:f32[1024,512]. let
c:f32[1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=32), Blocked(block_size=512))), BlockMapping(block_shape=(Blocked(b... | module @jit_pallas_cross_entropy attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x512xf32>, %arg1: tensor<1024x512xf32>) -> (tensor<1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_c... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | cross_entropy_gpu_fixed | """Level 1: Row-wise cross-entropy loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... | """Level 1: Row-wise cross-entropy loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... |
mse_loss | 1 | 23 | loss | [[2048, 1024], [2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/mse_loss.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/mse_loss.py | pass | true | 0 | 157.6705 | 0.1155 | 0.1155 | 0.0007 | 0.0007 | """Level 1: Mean squared error loss via Pallas.
Provenance: standard regression loss, (pred - target)^2 reduced per row
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/mse_loss", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as p... | """Level 1: Mean squared error loss via Pallas.
Provenance: standard regression loss, (pred - target)^2 reduced per row
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/mse_loss", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as p... | @jax.jit
def jax_mse_loss(pred: jax.Array, target: jax.Array) -> jax.Array:
diff = pred - target
return jnp.mean(diff * diff, axis=-1)
| @jax.jit
def jax_mse_loss(pred: jax.Array, target: jax.Array) -> jax.Array:
diff = pred - target
return jnp.mean(diff * diff, axis=-1)
| --- a/mse_loss.py
+++ b/mse_loss.py
@@ -22,6 +22,8 @@
n_rows = pred.shape[0]
n_cols = pred.shape[1]
block_rows = min(256, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,1024] b:f32[2048,1024]. let
c:f32[2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(Block... | module @jit_pallas_mse_loss attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>, %arg1: tensor<2048x1024xf32>) -> (tensor<2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_conf... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | mse_loss_gpu_fixed | """Level 1: Mean squared error loss via Pallas.
Provenance: standard regression loss, (pred - target)^2 reduced per row
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/mse_loss", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as p... | """Level 1: Mean squared error loss via Pallas.
Provenance: standard regression loss, (pred - target)^2 reduced per row
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/mse_loss", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as p... |
cosine_sim | 1 | 24 | loss | [[2048, 1024], [2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/cosine_sim.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/cosine_sim.py | pass | true | 0 | 413.7239 | 0.1271 | 0.1271 | 0.0003 | 0.0003 | """Level 1: Row-wise cosine similarity via Pallas.
Provenance: standard similarity metric for embeddings and retrieval
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cosine_sim", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as ... | """Level 1: Row-wise cosine similarity via Pallas.
Provenance: standard similarity metric for embeddings and retrieval
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cosine_sim", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as ... | @jax.jit
def jax_cosine_sim(x: jax.Array, y: jax.Array) -> jax.Array:
dot = jnp.sum(x * y, axis=-1)
norm_x = jnp.sqrt(jnp.sum(x * x, axis=-1))
norm_y = jnp.sqrt(jnp.sum(y * y, axis=-1))
return dot / (norm_x * norm_y + 1e-8)
| @jax.jit
def jax_cosine_sim(x: jax.Array, y: jax.Array) -> jax.Array:
dot = jnp.sum(x * y, axis=-1)
norm_x = jnp.sqrt(jnp.sum(x * x, axis=-1))
norm_y = jnp.sqrt(jnp.sum(y * y, axis=-1))
return dot / (norm_x * norm_y + 1e-8)
| --- a/cosine_sim.py
+++ b/cosine_sim.py
@@ -26,6 +26,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(256, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,1024] b:f32[2048,1024]. let
c:f32[2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(Block... | module @jit_pallas_cosine_sim attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>, %arg1: tensor<2048x1024xf32>) -> (tensor<2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_co... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | cosine_sim_gpu_fixed | """Level 1: Row-wise cosine similarity via Pallas.
Provenance: standard similarity metric for embeddings and retrieval
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cosine_sim", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as ... | """Level 1: Row-wise cosine similarity via Pallas.
Provenance: standard similarity metric for embeddings and retrieval
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/cosine_sim", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as ... |
embedding_lookup | 1 | 25 | index | [[32000, 768], [512]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/embedding_lookup.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/embedding_lookup.py | error | false | -1 | -1 | -1 | -1 | 0 | 0 | """Level 1: Embedding table lookup via Pallas.
Demonstrates: gather-style indexing, integer index handling,
non-contiguous memory access patterns.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/embedding_lookup", __doc__)
import jax
import jax.numpy as jnp
from ... | """Level 1: Embedding table lookup via Pallas.
Demonstrates: gather-style indexing, integer index handling,
non-contiguous memory access patterns.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/embedding_lookup", __doc__)
import jax
import jax.numpy as jnp
from ... | @jax.jit
def jax_embedding_lookup(table: jax.Array, indices: jax.Array) -> jax.Array:
return table[indices]
| @jax.jit
def jax_embedding_lookup(table: jax.Array, indices: jax.Array) -> jax.Array:
return table[indices]
| null | null | null | The Pallas Triton lowering currently requires that all operations have array arguments and results whose size is a power of 2. Encountered an array of shape (512, 768) | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | embedding_lookup_gpu_fixed | """Level 1: Embedding table lookup via Pallas.
Demonstrates: gather-style indexing, integer index handling,
non-contiguous memory access patterns.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/embedding_lookup", __doc__)
import jax
import jax.numpy as jnp
from ... | """Level 1: Embedding table lookup via Pallas.
Demonstrates: gather-style indexing, integer index handling,
non-contiguous memory access patterns.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/embedding_lookup", __doc__)
import jax
import jax.numpy as jnp
from ... |
one_hot | 1 | 26 | index | [[512]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/one_hot.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/one_hot.py | pass | true | 0 | 6,353.7239 | 0.1174 | 0.1174 | 0 | 0 | """Level 1: One-hot encoding via Pallas.
Provenance: jax.nn.one_hot, used in cross-entropy label preparation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/one_hot", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _one... | """Level 1: One-hot encoding via Pallas.
Provenance: jax.nn.one_hot, used in cross-entropy label preparation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/one_hot", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _one... | @jax.jit
def jax_one_hot(indices: jax.Array) -> jax.Array:
return jax.nn.one_hot(indices, 1024, dtype=jnp.float32)
| @jax.jit
def jax_one_hot(indices: jax.Array) -> jax.Array:
return jax.nn.one_hot(indices, 1024, dtype=jnp.float32)
| null | { lambda ; a:i32[512]. let
b:f32[512,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(1,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=512),)), BlockMapping(block_shape=(Blocked(block_size=512), Blocked(block_size=1024))... | module @jit_pallas_one_hot attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<512xi32>) -> (tensor<512x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = {debug = ... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | one_hot_gpu_fixed | """Level 1: One-hot encoding via Pallas.
Provenance: jax.nn.one_hot, used in cross-entropy label preparation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/one_hot", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _one... | """Level 1: One-hot encoding via Pallas.
Provenance: jax.nn.one_hot, used in cross-entropy label preparation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L1/one_hot", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _one... |
nucleotide_onehot | 1 | 27 | genomics | [[4096]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level1/nucleotide_onehot.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level1/nucleotide_onehot.py | pass | true | 0 | 83.01 | 0.0987 | 0.0987 | 0.0012 | 0.0012 | """Level 1: Nucleotide one-hot encoding via Pallas.
Encodes integer-encoded DNA sequences (A=0, C=1, G=2, T=3) into
4-channel one-hot representation used by genomics models (Enformer, etc).
Provenance: google-deepmind/deepmind-research Enformer
DNA sequence input encoding (one-hot 4-channel)
"""
from p... | """Level 1: Nucleotide one-hot encoding via Pallas.
Encodes integer-encoded DNA sequences (A=0, C=1, G=2, T=3) into
4-channel one-hot representation used by genomics models (Enformer, etc).
Provenance: google-deepmind/deepmind-research Enformer
DNA sequence input encoding (one-hot 4-channel)
"""
from p... | @jax.jit
def jax_nucleotide_onehot(seq: jax.Array) -> jax.Array:
return jax.nn.one_hot(seq, 4, dtype=jnp.float32)
| @jax.jit
def jax_nucleotide_onehot(seq: jax.Array) -> jax.Array:
return jax.nn.one_hot(seq, 4, dtype=jnp.float32)
| null | { lambda ; a:i32[4096]. let
b:f32[4096,4] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(1,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=4096),)), BlockMapping(block_shape=(Blocked(block_size=4096), Blocked(block_size=4))))... | module @jit_pallas_nucleotide_onehot attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<4096xi32>) -> (tensor<4096x4xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0) {backend_config = "", mhlo.backend_config = ... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | nucleotide_onehot_gpu_fixed | """Level 1: Nucleotide one-hot encoding via Pallas.
Encodes integer-encoded DNA sequences (A=0, C=1, G=2, T=3) into
4-channel one-hot representation used by genomics models (Enformer, etc).
Provenance: google-deepmind/deepmind-research Enformer
DNA sequence input encoding (one-hot 4-channel)
"""
from p... | """Level 1: Nucleotide one-hot encoding via Pallas.
Encodes integer-encoded DNA sequences (A=0, C=1, G=2, T=3) into
4-channel one-hot representation used by genomics models (Enformer, etc).
Provenance: google-deepmind/deepmind-research Enformer
DNA sequence input encoding (one-hot 4-channel)
"""
from p... |
matmul_relu | 2 | 28 | matmul_activation | [[1024, 1024], [1024, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/matmul_relu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/matmul_relu.py | pass | true | 0 | 697.8001 | 0.1503 | 0.1503 | 0.0002 | 0.0002 | """Level 2: Fused MatMul + ReLU via Pallas.
Demonstrates: operator fusion — single pallas_call replaces matmul + relu,
avoiding a round-trip through HBM between the two ops.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_relu", __doc__)
import jax
import ... | """Level 2: Fused MatMul + ReLU via Pallas.
Demonstrates: operator fusion — single pallas_call replaces matmul + relu,
avoiding a round-trip through HBM between the two ops.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_relu", __doc__)
import jax
import ... | @jax.jit
def jax_matmul_relu(x: jax.Array, w: jax.Array) -> jax.Array:
return jnp.maximum(x @ w, 0)
| @jax.jit
def jax_matmul_relu(x: jax.Array, w: jax.Array) -> jax.Array:
return jnp.maximum(x @ w, 0)
| --- a/matmul_relu.py
+++ b/matmul_relu.py
@@ -21,8 +21,8 @@
def pallas_matmul_relu(x: jax.Array, w: jax.Array) -> jax.Array:
m, k = x.shape
_, n = w.shape
- bm = min(512, m)
- bn = min(512, n)
+ bm = min(16, m)
+ bn = min(16, n)
grid = (m // bm, n // bn)
return pl.pallas_call(
| { lambda ; a:f32[1024,1024] b:f32[1024,1024]. let
c:f32[1024,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(64, 64), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape... | module @jit_pallas_matmul_relu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x1024xf32>, %arg1: tensor<1024x1024xf32>) -> (tensor<1024x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {back... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | matmul_relu_gpu_fixed | """Level 2: Fused MatMul + ReLU via Pallas.
Demonstrates: operator fusion — single pallas_call replaces matmul + relu,
avoiding a round-trip through HBM between the two ops.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_relu", __doc__)
import jax
import ... | """Level 2: Fused MatMul + ReLU via Pallas.
Demonstrates: operator fusion — single pallas_call replaces matmul + relu,
avoiding a round-trip through HBM between the two ops.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_relu", __doc__)
import jax
import ... |
matmul_gelu | 2 | 29 | matmul_activation | [[1024, 1024], [1024, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/matmul_gelu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/matmul_gelu.py | pass | true | 0.000001 | 711.9612 | 0.165 | 0.165 | 0.0002 | 0.0002 | """Level 2: Fused MatMul + GELU via Pallas.
Provenance: keras-team/keras-io define_custom_kernel guide FusedDense pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... | """Level 2: Fused MatMul + GELU via Pallas.
Provenance: keras-team/keras-io define_custom_kernel guide FusedDense pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... | @jax.jit
def jax_matmul_gelu(x: jax.Array, w: jax.Array) -> jax.Array:
return jax.nn.gelu(x @ w)
| @jax.jit
def jax_matmul_gelu(x: jax.Array, w: jax.Array) -> jax.Array:
return jax.nn.gelu(x @ w)
| --- a/matmul_gelu.py
+++ b/matmul_gelu.py
@@ -23,8 +23,8 @@
def pallas_matmul_gelu(x: jax.Array, w: jax.Array) -> jax.Array:
m, k = x.shape
_, n = w.shape
- bm = min(512, m)
- bn = min(512, n)
+ bm = min(16, m)
+ bn = min(16, n)
grid = (m // bm, n // bn)
return pl.pallas_call(
| { lambda ; a:f32[1024,1024] b:f32[1024,1024]. let
c:f32[1024,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(64, 64), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape... | module @jit_pallas_matmul_gelu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x1024xf32>, %arg1: tensor<1024x1024xf32>) -> (tensor<1024x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {back... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | matmul_gelu_gpu_fixed | """Level 2: Fused MatMul + GELU via Pallas.
Provenance: keras-team/keras-io define_custom_kernel guide FusedDense pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... | """Level 2: Fused MatMul + GELU via Pallas.
Provenance: keras-team/keras-io define_custom_kernel guide FusedDense pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_gelu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas... |
matmul_silu | 2 | 30 | matmul_activation | [[1024, 1024], [1024, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/matmul_silu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/matmul_silu.py | pass | true | 0 | 707.243 | 0.1617 | 0.1617 | 0.0002 | 0.0002 | """Level 2: Fused MatMul + SiLU via Pallas.
Provenance: openxla/tokamax gated_linear_unit uses SiLU gate path
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def... | """Level 2: Fused MatMul + SiLU via Pallas.
Provenance: openxla/tokamax gated_linear_unit uses SiLU gate path
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def... | @jax.jit
def jax_matmul_silu(x: jax.Array, w: jax.Array) -> jax.Array:
return jax.nn.silu(x @ w)
| @jax.jit
def jax_matmul_silu(x: jax.Array, w: jax.Array) -> jax.Array:
return jax.nn.silu(x @ w)
| --- a/matmul_silu.py
+++ b/matmul_silu.py
@@ -21,8 +21,8 @@
def pallas_matmul_silu(x: jax.Array, w: jax.Array) -> jax.Array:
m, k = x.shape
_, n = w.shape
- bm = min(512, m)
- bn = min(512, n)
+ bm = min(16, m)
+ bn = min(16, n)
grid = (m // bm, n // bn)
return pl.pallas_call(
| { lambda ; a:f32[1024,1024] b:f32[1024,1024]. let
c:f32[1024,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(64, 64), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape... | module @jit_pallas_matmul_silu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x1024xf32>, %arg1: tensor<1024x1024xf32>) -> (tensor<1024x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {back... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | matmul_silu_gpu_fixed | """Level 2: Fused MatMul + SiLU via Pallas.
Provenance: openxla/tokamax gated_linear_unit uses SiLU gate path
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def... | """Level 2: Fused MatMul + SiLU via Pallas.
Provenance: openxla/tokamax gated_linear_unit uses SiLU gate path
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/matmul_silu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def... |
rmsnorm_residual | 2 | 31 | norm_residual | [[2048, 1024], [2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/rmsnorm_residual.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/rmsnorm_residual.py | pass | true | 0.000001 | 215.7769 | 0.1216 | 0.1216 | 0.0006 | 0.0006 | """Level 2: Fused RMSNorm + Residual Add via Pallas.
Demonstrates: two-input fusion, norm + elementwise add in one kernel.
Inspired by pallas-forge's 3.44x speedup over XLA for this pattern.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/rmsnorm_residual", __doc_... | """Level 2: Fused RMSNorm + Residual Add via Pallas.
Demonstrates: two-input fusion, norm + elementwise add in one kernel.
Inspired by pallas-forge's 3.44x speedup over XLA for this pattern.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/rmsnorm_residual", __doc_... | @jax.jit
def jax_rmsnorm_residual(x: jax.Array, residual: jax.Array) -> jax.Array:
ms = jnp.mean(x ** 2, axis=-1, keepdims=True)
normed = x / jnp.sqrt(ms + 1e-5)
return normed + residual
| @jax.jit
def jax_rmsnorm_residual(x: jax.Array, residual: jax.Array) -> jax.Array:
ms = jnp.mean(x ** 2, axis=-1, keepdims=True)
normed = x / jnp.sqrt(ms + 1e-5)
return normed + residual
| --- a/rmsnorm_residual.py
+++ b/rmsnorm_residual.py
@@ -28,6 +28,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(128, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,1024] b:f32[2048,1024]. let
c:f32[2048,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(... | module @jit_pallas_rmsnorm_residual attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>, %arg1: tensor<2048x1024xf32>) -> (tensor<2048x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) ... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | rmsnorm_residual_gpu_fixed | """Level 2: Fused RMSNorm + Residual Add via Pallas.
Demonstrates: two-input fusion, norm + elementwise add in one kernel.
Inspired by pallas-forge's 3.44x speedup over XLA for this pattern.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/rmsnorm_residual", __doc_... | """Level 2: Fused RMSNorm + Residual Add via Pallas.
Demonstrates: two-input fusion, norm + elementwise add in one kernel.
Inspired by pallas-forge's 3.44x speedup over XLA for this pattern.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/rmsnorm_residual", __doc_... |
layernorm_residual | 2 | 32 | norm_residual | [[2048, 1024], [2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/layernorm_residual.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/layernorm_residual.py | pass | true | 0.000001 | 461.5373 | 0.1136 | 0.1136 | 0.0002 | 0.0002 | """Level 2: Fused LayerNorm + Residual Add via Pallas.
Provenance: standard transformer pre-norm pattern, MaxText attention blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/layernorm_residual", __doc__)
import jax
import jax.numpy as jnp
from jax.experiment... | """Level 2: Fused LayerNorm + Residual Add via Pallas.
Provenance: standard transformer pre-norm pattern, MaxText attention blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/layernorm_residual", __doc__)
import jax
import jax.numpy as jnp
from jax.experiment... | @jax.jit
def jax_layernorm_residual(x: jax.Array, residual: jax.Array) -> jax.Array:
mean = jnp.mean(x, axis=-1, keepdims=True)
var = jnp.var(x, axis=-1, keepdims=True)
normed = (x - mean) / jnp.sqrt(var + 1e-5)
return normed + residual
| @jax.jit
def jax_layernorm_residual(x: jax.Array, residual: jax.Array) -> jax.Array:
mean = jnp.mean(x, axis=-1, keepdims=True)
var = jnp.var(x, axis=-1, keepdims=True)
normed = (x - mean) / jnp.sqrt(var + 1e-5)
return normed + residual
| --- a/layernorm_residual.py
+++ b/layernorm_residual.py
@@ -26,6 +26,8 @@
n_rows = x.shape[0]
n_cols = x.shape[1]
block_rows = min(128, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
return pl.pallas_call(
| { lambda ; a:f32[2048,1024] b:f32[2048,1024]. let
c:f32[2048,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(... | module @jit_pallas_layernorm_residual attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>, %arg1: tensor<2048x1024xf32>) -> (tensor<2048x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | layernorm_residual_gpu_fixed | """Level 2: Fused LayerNorm + Residual Add via Pallas.
Provenance: standard transformer pre-norm pattern, MaxText attention blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/layernorm_residual", __doc__)
import jax
import jax.numpy as jnp
from jax.experiment... | """Level 2: Fused LayerNorm + Residual Add via Pallas.
Provenance: standard transformer pre-norm pattern, MaxText attention blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/layernorm_residual", __doc__)
import jax
import jax.numpy as jnp
from jax.experiment... |
swiglu | 2 | 33 | mlp_fusion | [[512, 1024], [1024, 2048], [1024, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/swiglu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/swiglu.py | pass | true | 0 | 2,441.6737 | 0.205 | 0.205 | 0.0001 | 0.0001 | """Level 2: Fused SwiGLU activation via Pallas.
SwiGLU: gate = silu(x @ W_gate), up = x @ W_up, output = gate * up.
Demonstrates: multi-input fusion, gated activation, silu transcendental.
Inspired by pallas-forge's SwiGLU kernel.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _des... | """Level 2: Fused SwiGLU activation via Pallas.
SwiGLU: gate = silu(x @ W_gate), up = x @ W_up, output = gate * up.
Demonstrates: multi-input fusion, gated activation, silu transcendental.
Inspired by pallas-forge's SwiGLU kernel.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _des... | @jax.jit
def jax_swiglu(x: jax.Array, w_gate: jax.Array, w_up: jax.Array) -> jax.Array:
gate = jax.nn.silu(x @ w_gate)
up = x @ w_up
return gate * up
| @jax.jit
def jax_swiglu(x: jax.Array, w_gate: jax.Array, w_up: jax.Array) -> jax.Array:
gate = jax.nn.silu(x @ w_gate)
up = x @ w_up
return gate * up
| --- a/swiglu.py
+++ b/swiglu.py
@@ -28,18 +28,19 @@
) -> jax.Array:
m, k = x.shape
_, n = w_gate.shape
- bm = min(256, m)
+ bm = min(16, m)
+ bn = min(16, n)
return pl.pallas_call(
_swiglu_kernel,
out_shape=jax.ShapeDtypeStruct((m, n), x.dtype),
- grid=(m // bm,),
+ ... | { lambda ; a:f32[512,1024] b:f32[1024,2048] c:f32[1024,2048]. let
d:f32[512,2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 128), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMap... | module @jit_pallas_swiglu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<512x1024xf32>, %arg1: tensor<1024x2048xf32>, %arg2: tensor<1024x2048xf32>) -> (tensor<512x2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.tri... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | swiglu_gpu_fixed | """Level 2: Fused SwiGLU activation via Pallas.
SwiGLU: gate = silu(x @ W_gate), up = x @ W_up, output = gate * up.
Demonstrates: multi-input fusion, gated activation, silu transcendental.
Inspired by pallas-forge's SwiGLU kernel.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _des... | """Level 2: Fused SwiGLU activation via Pallas.
SwiGLU: gate = silu(x @ W_gate), up = x @ W_up, output = gate * up.
Demonstrates: multi-input fusion, gated activation, silu transcendental.
Inspired by pallas-forge's SwiGLU kernel.
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _des... |
geglu | 2 | 34 | mlp_fusion | [[512, 1024], [1024, 2048], [1024, 2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/geglu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/geglu.py | pass | true | 0.000122 | 2,411.3861 | 0.2083 | 0.2083 | 0.0001 | 0.0001 | """Level 2: Fused GeGLU activation via Pallas.
Provenance: variant of gated linear unit, used in PaLM/Gemma MLPs
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/geglu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _g... | """Level 2: Fused GeGLU activation via Pallas.
Provenance: variant of gated linear unit, used in PaLM/Gemma MLPs
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/geglu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _g... | @jax.jit
def jax_geglu(x: jax.Array, w_gate: jax.Array, w_up: jax.Array) -> jax.Array:
gate = jax.nn.gelu(x @ w_gate)
up = x @ w_up
return gate * up
| @jax.jit
def jax_geglu(x: jax.Array, w_gate: jax.Array, w_up: jax.Array) -> jax.Array:
gate = jax.nn.gelu(x @ w_gate)
up = x @ w_up
return gate * up
| --- a/geglu.py
+++ b/geglu.py
@@ -26,18 +26,19 @@
def pallas_geglu(x: jax.Array, w_gate: jax.Array, w_up: jax.Array) -> jax.Array:
m, k = x.shape
_, n = w_gate.shape
- bm = min(256, m)
+ bm = min(16, m)
+ bn = min(16, n)
return pl.pallas_call(
_geglu_kernel,
out_shape=jax.Sh... | { lambda ; a:f32[512,1024] b:f32[1024,2048] c:f32[1024,2048]. let
d:f32[512,2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 128), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMap... | module @jit_pallas_geglu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<512x1024xf32>, %arg1: tensor<1024x2048xf32>, %arg2: tensor<1024x2048xf32>) -> (tensor<512x2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.trit... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | geglu_gpu_fixed | """Level 2: Fused GeGLU activation via Pallas.
Provenance: variant of gated linear unit, used in PaLM/Gemma MLPs
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/geglu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _g... | """Level 2: Fused GeGLU activation via Pallas.
Provenance: variant of gated linear unit, used in PaLM/Gemma MLPs
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/geglu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
def _g... |
linear_bias_relu | 2 | 35 | matmul_activation | [[1024, 1024], [1024, 2048], [2048]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/linear_bias_relu.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/linear_bias_relu.py | pass | true | 0.000107 | 1,272.4464 | 0.1869 | 0.1869 | 0.0001 | 0.0001 | """Level 2: Fused Linear + Bias + ReLU via Pallas.
Provenance: keras-team FusedDense pattern, standard MLP first layer
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/linear_bias_relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... | """Level 2: Fused Linear + Bias + ReLU via Pallas.
Provenance: keras-team FusedDense pattern, standard MLP first layer
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/linear_bias_relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... | @jax.jit
def jax_linear_bias_relu(x: jax.Array, w: jax.Array, b: jax.Array) -> jax.Array:
return jnp.maximum(x @ w + b, 0)
| @jax.jit
def jax_linear_bias_relu(x: jax.Array, w: jax.Array, b: jax.Array) -> jax.Array:
return jnp.maximum(x @ w + b, 0)
| --- a/linear_bias_relu.py
+++ b/linear_bias_relu.py
@@ -21,18 +21,19 @@
def pallas_linear_bias_relu(x: jax.Array, w: jax.Array, b: jax.Array) -> jax.Array:
m, k = x.shape
_, n = w.shape
- bm = min(512, m)
+ bm = min(32, m)
+ bn = min(32, n)
return pl.pallas_call(
_linear_bias_relu_ke... | { lambda ; a:f32[1024,1024] b:f32[1024,2048] c:f32[2048]. let
d:f32[1024,2048] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32, 64), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=32), Blocked(block_size=1024))), BlockMapping... | module @jit_pallas_linear_bias_relu attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x1024xf32>, %arg1: tensor<1024x2048xf32>, %arg2: tensor<2048xf32>) -> (tensor<1024x2048xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | linear_bias_relu_gpu_fixed | """Level 2: Fused Linear + Bias + ReLU via Pallas.
Provenance: keras-team FusedDense pattern, standard MLP first layer
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/linear_bias_relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... | """Level 2: Fused Linear + Bias + ReLU via Pallas.
Provenance: keras-team FusedDense pattern, standard MLP first layer
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/linear_bias_relu", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pall... |
qk_softmax | 2 | 36 | attention_component | [[256, 64], [256, 64]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/qk_softmax.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/qk_softmax.py | pass | true | 0 | 4,430.2044 | 0.1238 | 0.1238 | 0 | 0 | """Level 2: Fused QK^T + Softmax via Pallas.
Provenance: jax-ml/jax flash_attention.py attention score computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/qk_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... | """Level 2: Fused QK^T + Softmax via Pallas.
Provenance: jax-ml/jax flash_attention.py attention score computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/qk_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... | @jax.jit
def jax_qk_softmax(q: jax.Array, k: jax.Array) -> jax.Array:
d_k = q.shape[-1]
scores = q @ k.swapaxes(-2, -1) / jnp.sqrt(d_k)
return jax.nn.softmax(scores, axis=-1)
| @jax.jit
def jax_qk_softmax(q: jax.Array, k: jax.Array) -> jax.Array:
d_k = q.shape[-1]
scores = q @ k.swapaxes(-2, -1) / jnp.sqrt(d_k)
return jax.nn.softmax(scores, axis=-1)
| --- a/qk_softmax.py
+++ b/qk_softmax.py
@@ -26,6 +26,8 @@
def pallas_qk_softmax(q: jax.Array, k: jax.Array) -> jax.Array:
seq_len, d_model = q.shape
block_q = min(128, seq_len)
+ while block_q * d_model > 16384 and block_q > 1:
+ block_q //= 2
grid_size = seq_len // block_q
return pl.pa... | { lambda ; a:f32[256,64] b:f32[256,64]. let
c:f32[256,256] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(2,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=128), Blocked(block_size=64))), BlockMapping(block_shape=(Blocked(blo... | module @jit_pallas_qk_softmax attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<256x64xf32>, %arg1: tensor<256x64xf32>) -> (tensor<256x256xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {backend_confi... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | qk_softmax_gpu_fixed | """Level 2: Fused QK^T + Softmax via Pallas.
Provenance: jax-ml/jax flash_attention.py attention score computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/qk_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... | """Level 2: Fused QK^T + Softmax via Pallas.
Provenance: jax-ml/jax flash_attention.py attention score computation
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/qk_softmax", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl
... |
fused_softmax_cross_entropy | 2 | 37 | loss_fusion | [[1024, 512], [1024, 512]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/fused_softmax_cross_entropy.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/fused_softmax_cross_entropy.py | pass | true | 0 | 1,235.7604 | 0.0956 | 0.0956 | 0.0001 | 0.0001 | """Level 2: Fused Softmax + Cross-Entropy Loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/fused_softmax_cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.exp... | """Level 2: Fused Softmax + Cross-Entropy Loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/fused_softmax_cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.exp... | @jax.jit
def jax_fused_softmax_cross_entropy(logits: jax.Array, labels: jax.Array) -> jax.Array:
log_probs = jax.nn.log_softmax(logits, axis=-1)
return -jnp.sum(labels * log_probs, axis=-1)
| @jax.jit
def jax_fused_softmax_cross_entropy(logits: jax.Array, labels: jax.Array) -> jax.Array:
log_probs = jax.nn.log_softmax(logits, axis=-1)
return -jnp.sum(labels * log_probs, axis=-1)
| --- a/fused_softmax_cross_entropy.py
+++ b/fused_softmax_cross_entropy.py
@@ -29,6 +29,8 @@
n_rows = logits.shape[0]
n_cols = logits.shape[1]
block_rows = min(128, n_rows)
+ while block_rows * n_cols > 16384 and block_rows > 1:
+ block_rows //= 2
grid_size = n_rows // block_rows
ret... | { lambda ; a:f32[1024,512] b:f32[1024,512]. let
c:f32[1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(32,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=32), Blocked(block_size=512))), BlockMapping(block_shape=(Blocked(b... | module @jit_pallas_fused_softmax_cross_entropy attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<1024x512xf32>, %arg1: tensor<1024x512xf32>) -> (tensor<1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %ar... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | fused_softmax_cross_entropy_gpu_fixed | """Level 2: Fused Softmax + Cross-Entropy Loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/fused_softmax_cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.exp... | """Level 2: Fused Softmax + Cross-Entropy Loss via Pallas.
Provenance: openxla/tokamax linear_softmax_cross_entropy_loss pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/fused_softmax_cross_entropy", __doc__)
import jax
import jax.numpy as jnp
from jax.exp... |
sigmoid_bce | 2 | 38 | loss_fusion | [[2048, 1024], [2048, 1024]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/sigmoid_bce.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/sigmoid_bce.py | pass | true | 0 | 903.8407 | 0.1157 | 0.1157 | 0.0001 | 0.0001 | """Level 2: Fused Sigmoid + Binary Cross-Entropy via Pallas.
Provenance: standard binary classification loss fusion
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/sigmoid_bce", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl... | """Level 2: Fused Sigmoid + Binary Cross-Entropy via Pallas.
Provenance: standard binary classification loss fusion
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/sigmoid_bce", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl... | @jax.jit
def jax_sigmoid_bce(logits: jax.Array, targets: jax.Array) -> jax.Array:
max_val = jnp.maximum(-logits, 0.0)
loss = max_val + jnp.log(jnp.exp(-max_val) + jnp.exp(-logits - max_val))
return loss - targets * logits + targets * loss
| @jax.jit
def jax_sigmoid_bce(logits: jax.Array, targets: jax.Array) -> jax.Array:
max_val = jnp.maximum(-logits, 0.0)
loss = max_val + jnp.log(jnp.exp(-max_val) + jnp.exp(-logits - max_val))
return loss - targets * logits + targets * loss
| --- a/sigmoid_bce.py
+++ b/sigmoid_bce.py
@@ -23,7 +23,10 @@
def pallas_sigmoid_bce(logits: jax.Array, targets: jax.Array) -> jax.Array:
n = logits.shape[0]
- block_size = min(1024, n)
+ cols = 1
+ for s in logits.shape[1:]:
+ cols *= s
+ block_size = min(min(128, n), max(1, 16384 // cols))
... | { lambda ; a:f32[2048,1024] b:f32[2048,1024]. let
c:f32[2048,1024] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(128,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=16), Blocked(block_size=1024))), BlockMapping(block_shape=(... | module @jit_pallas_sigmoid_bce attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<2048x1024xf32>, %arg1: tensor<2048x1024xf32>) -> (tensor<2048x1024xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.triton(%arg0, %arg1) {back... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | sigmoid_bce_gpu_fixed | """Level 2: Fused Sigmoid + Binary Cross-Entropy via Pallas.
Provenance: standard binary classification loss fusion
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/sigmoid_bce", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl... | """Level 2: Fused Sigmoid + Binary Cross-Entropy via Pallas.
Provenance: standard binary classification loss fusion
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L2/sigmoid_bce", __doc__)
import jax
import jax.numpy as jnp
from jax.experimental import pallas as pl... |
pwm_scan | 2 | 39 | genomics | [[1024, 4], [4, 12]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/pwm_scan.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/pwm_scan.py | error | false | -1 | -1 | -1 | -1 | 0 | 0 | """Level 2: Position Weight Matrix (PWM) motif scanning via Pallas.
Scans a one-hot encoded DNA sequence with a PWM (4 x motif_len) to find
transcription factor binding sites. This is a 1D "convolution" over the
4-channel nucleotide representation — the core operation in genomics
motif discovery tools (MEME, PWMScan, ... | """Level 2: Position Weight Matrix (PWM) motif scanning via Pallas.
Scans a one-hot encoded DNA sequence with a PWM (4 x motif_len) to find
transcription factor binding sites. This is a 1D "convolution" over the
4-channel nucleotide representation — the core operation in genomics
motif discovery tools (MEME, PWMScan, ... | @jax.jit
def jax_pwm_scan(seq_onehot: jax.Array, pwm: jax.Array) -> jax.Array:
motif_len = pwm.shape[1]
seq_len = seq_onehot.shape[0]
out_len = seq_len - motif_len + 1
scores = jnp.zeros(out_len, dtype=seq_onehot.dtype)
for pos in range(motif_len):
scores = scores + jnp.sum(seq_onehot[pos:po... | @jax.jit
def jax_pwm_scan(seq_onehot: jax.Array, pwm: jax.Array) -> jax.Array:
motif_len = pwm.shape[1]
seq_len = seq_onehot.shape[0]
out_len = seq_len - motif_len + 1
scores = jnp.zeros(out_len, dtype=seq_onehot.dtype)
for pos in range(motif_len):
scores = scores + jnp.sum(seq_onehot[pos:po... | null | null | null | The Pallas Triton lowering currently requires that all operations have array arguments and results whose size is a power of 2. Encountered an array of shape (4, 12) | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | pwm_scan_gpu_fixed | """Level 2: Position Weight Matrix (PWM) motif scanning via Pallas.
Scans a one-hot encoded DNA sequence with a PWM (4 x motif_len) to find
transcription factor binding sites. This is a 1D "convolution" over the
4-channel nucleotide representation — the core operation in genomics
motif discovery tools (MEME, PWMScan, ... | """Level 2: Position Weight Matrix (PWM) motif scanning via Pallas.
Scans a one-hot encoded DNA sequence with a PWM (4 x motif_len) to find
transcription factor binding sites. This is a 1D "convolution" over the
4-channel nucleotide representation — the core operation in genomics
motif discovery tools (MEME, PWMScan, ... |
pairwise_distance | 2 | 40 | genomics | [[256, 32]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level2/pairwise_distance.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level2/pairwise_distance.py | error | false | -1 | -1 | -1 | -1 | 0 | 0 | """Level 2: Pairwise Euclidean distance matrix via Pallas.
Computes the N x N distance matrix from N points in d dimensions.
Core operation in structural biology (AlphaFold distance maps),
molecular dynamics (neighbor lists), and genomics (phylogenetics).
Provenance: google-deepmind/alphafold3 pair representation dis... | """Level 2: Pairwise Euclidean distance matrix via Pallas.
Computes the N x N distance matrix from N points in d dimensions.
Core operation in structural biology (AlphaFold distance maps),
molecular dynamics (neighbor lists), and genomics (phylogenetics).
Provenance: google-deepmind/alphafold3 pair representation dis... | @jax.jit
def jax_pairwise_distance(x: jax.Array) -> jax.Array:
diff = x[:, None, :] - x[None, :, :]
return jnp.sqrt(jnp.sum(diff * diff, axis=-1) + 1e-8)
| @jax.jit
def jax_pairwise_distance(x: jax.Array) -> jax.Array:
diff = x[:, None, :] - x[None, :, :]
return jnp.sqrt(jnp.sum(diff * diff, axis=-1) + 1e-8)
| null | null | null | Verification failed:
error: "reduce_sum:"("reduce_sum"("_pairwise_dist_kernel"("/mnt/data2/pallasbench_fix/pallasbench/kernels/level2/pairwise_distance.py":25:26 to :55))): Maximum allowed number of e | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | pairwise_distance_gpu_fixed | """Level 2: Pairwise Euclidean distance matrix via Pallas.
Computes the N x N distance matrix from N points in d dimensions.
Core operation in structural biology (AlphaFold distance maps),
molecular dynamics (neighbor lists), and genomics (phylogenetics).
Provenance: google-deepmind/alphafold3 pair representation dis... | """Level 2: Pairwise Euclidean distance matrix via Pallas.
Computes the N x N distance matrix from N points in d dimensions.
Core operation in structural biology (AlphaFold distance maps),
molecular dynamics (neighbor lists), and genomics (phylogenetics).
Provenance: google-deepmind/alphafold3 pair representation dis... |
flash_attention | 3 | 41 | attention | [[512, 64], [512, 64], [512, 64]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level3/flash_attention.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level3/flash_attention.py | pass | true | 0.000011 | 2,653.4589 | 0.1282 | 0.1282 | 0 | 0 | """Level 3: Tiled Flash Attention via Pallas.
Implements the core Flash Attention pattern: tiled QK^T computation with
online softmax accumulation to avoid materializing the full N x N attention
matrix.
Demonstrates: multi-dimensional grid, online accumulation with fori_loop,
memory-efficient tiling, the full Pallas ... | """Level 3: Tiled Flash Attention via Pallas.
Implements the core Flash Attention pattern: tiled QK^T computation with
online softmax accumulation to avoid materializing the full N x N attention
matrix.
Demonstrates: multi-dimensional grid, online accumulation with fori_loop,
memory-efficient tiling, the full Pallas ... | @jax.jit
def jax_flash_attention(
q: jax.Array, k: jax.Array, v: jax.Array
) -> jax.Array:
d_k = q.shape[-1]
scores = q @ k.swapaxes(-2, -1) / jnp.sqrt(d_k)
weights = jax.nn.softmax(scores, axis=-1)
return weights @ v
| @jax.jit
def jax_flash_attention(
q: jax.Array, k: jax.Array, v: jax.Array
) -> jax.Array:
d_k = q.shape[-1]
scores = q @ k.swapaxes(-2, -1) / jnp.sqrt(d_k)
weights = jax.nn.softmax(scores, axis=-1)
return weights @ v
| --- a/flash_attention.py
+++ b/flash_attention.py
@@ -38,7 +38,7 @@
q: jax.Array, k: jax.Array, v: jax.Array
) -> jax.Array:
seq_len, d_model = q.shape
- block_q = min(128, seq_len)
+ block_q = min(32, seq_len)
grid_size = seq_len // block_q
return pl.pallas_call(
| { lambda ; a:f32[512,64] b:f32[512,64] c:f32[512,64]. let
d:f32[512,64] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(16,), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=32), Blocked(block_size=64))), BlockMapping(block_shape... | module @jit_pallas_flash_attention attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<512x64xf32>, %arg1: tensor<512x64xf32>, %arg2: tensor<512x64xf32>) -> (tensor<512x64xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu$xla.gpu.trit... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | flash_attention_gpu_fixed | """Level 3: Tiled Flash Attention via Pallas.
Implements the core Flash Attention pattern: tiled QK^T computation with
online softmax accumulation to avoid materializing the full N x N attention
matrix.
Demonstrates: multi-dimensional grid, online accumulation with fori_loop,
memory-efficient tiling, the full Pallas ... | """Level 3: Tiled Flash Attention via Pallas.
Implements the core Flash Attention pattern: tiled QK^T computation with
online softmax accumulation to avoid materializing the full N x N attention
matrix.
Demonstrates: multi-dimensional grid, online accumulation with fori_loop,
memory-efficient tiling, the full Pallas ... |
multi_head_attention | 3 | 42 | attention | [[8, 256, 64], [8, 256, 64], [8, 256, 64]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level3/multi_head_attention.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level3/multi_head_attention.py | pass | true | 0.000045 | 710.0619 | 0.1116 | 0.1116 | 0.0002 | 0.0002 | """Level 3: Multi-Head Attention via Pallas.
Provenance: jax-ml/jax pallas/ops/tpu/flash_attention.py
AI-Hypercomputer/maxtext splash attention training kernel
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/multi_head_attention", __doc__)
import jax... | """Level 3: Multi-Head Attention via Pallas.
Provenance: jax-ml/jax pallas/ops/tpu/flash_attention.py
AI-Hypercomputer/maxtext splash attention training kernel
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/multi_head_attention", __doc__)
import jax... | @jax.jit
def jax_multi_head_attention(
q: jax.Array, k: jax.Array, v: jax.Array
) -> jax.Array:
d_k = q.shape[-1]
scores = q @ k.swapaxes(-2, -1) / jnp.sqrt(d_k)
weights = jax.nn.softmax(scores, axis=-1)
return weights @ v
| @jax.jit
def jax_multi_head_attention(
q: jax.Array, k: jax.Array, v: jax.Array
) -> jax.Array:
d_k = q.shape[-1]
scores = q @ k.swapaxes(-2, -1) / jnp.sqrt(d_k)
weights = jax.nn.softmax(scores, axis=-1)
return weights @ v
| --- a/multi_head_attention.py
+++ b/multi_head_attention.py
@@ -30,16 +30,17 @@
) -> jax.Array:
n_heads, seq_len, d_head = q.shape
+ bq = min(32, seq_len)
return pl.pallas_call(
_mha_kernel,
out_shape=jax.ShapeDtypeStruct(q.shape, q.dtype),
- grid=(n_heads,),
+ grid=(n_he... | { lambda ; a:f32[8,256,64] b:f32[8,256,64] c:f32[8,256,64]. let
d:f32[8,256,64] = pallas_call[
compiler_params=None
cost_estimate=None
debug=False
grid_mapping=GridMapping(grid=(8, 8), block_mappings=(BlockMapping(block_shape=(Blocked(block_size=1), Blocked(block_size=32), Blocked(block_size... | module @jit_pallas_multi_head_attention attributes {mhlo.num_partitions = 1 : i32, mhlo.num_replicas = 1 : i32} {
func.func public @main(%arg0: tensor<8x256x64xf32>, %arg1: tensor<8x256x64xf32>, %arg2: tensor<8x256x64xf32>) -> (tensor<8x256x64xf32> {jax.result_info = "result"}) {
%0 = stablehlo.custom_call @__gpu... | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | multi_head_attention_gpu_fixed | """Level 3: Multi-Head Attention via Pallas.
Provenance: jax-ml/jax pallas/ops/tpu/flash_attention.py
AI-Hypercomputer/maxtext splash attention training kernel
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/multi_head_attention", __doc__)
import jax... | """Level 3: Multi-Head Attention via Pallas.
Provenance: jax-ml/jax pallas/ops/tpu/flash_attention.py
AI-Hypercomputer/maxtext splash attention training kernel
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/multi_head_attention", __doc__)
import jax... |
gated_mlp | 3 | 43 | mlp | [[256, 512], [512, 1024], [512, 1024], [1024, 512]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level3/gated_mlp.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level3/gated_mlp.py | skip | false | -1 | -1 | -1 | -1 | 0 | 0 | """Level 3: Full Gated MLP Block (SwiGLU) via Pallas.
Provenance: openxla/tokamax gated_linear_unit
AI-Hypercomputer/maxtext Llama/Gemma MLP blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/gated_mlp", __doc__)
import jax
import jax.numpy as jn... | """Level 3: Full Gated MLP Block (SwiGLU) via Pallas.
Provenance: openxla/tokamax gated_linear_unit
AI-Hypercomputer/maxtext Llama/Gemma MLP blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/gated_mlp", __doc__)
import jax
import jax.numpy as jn... | @jax.jit
def jax_gated_mlp(
x: jax.Array, w_gate: jax.Array, w_up: jax.Array, w_down: jax.Array
) -> jax.Array:
gate = jax.nn.silu(x @ w_gate)
up = x @ w_up
hidden = gate * up
return hidden @ w_down
| @jax.jit
def jax_gated_mlp(
x: jax.Array, w_gate: jax.Array, w_up: jax.Array, w_down: jax.Array
) -> jax.Array:
gate = jax.nn.silu(x @ w_gate)
up = x @ w_up
hidden = gate * up
return hidden @ w_down
| --- a/gated_mlp.py
+++ b/gated_mlp.py
@@ -28,7 +28,7 @@
) -> jax.Array:
m, d_model = x.shape
_, d_ff = w_gate.shape
- bm = min(256, m)
+ bm = min(8, m)
return pl.pallas_call(
_gated_mlp_kernel,
| null | null | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | gated_mlp_gpu_fixed | """Level 3: Full Gated MLP Block (SwiGLU) via Pallas.
Provenance: openxla/tokamax gated_linear_unit
AI-Hypercomputer/maxtext Llama/Gemma MLP blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/gated_mlp", __doc__)
import jax
import jax.numpy as jn... | """Level 3: Full Gated MLP Block (SwiGLU) via Pallas.
Provenance: openxla/tokamax gated_linear_unit
AI-Hypercomputer/maxtext Llama/Gemma MLP blocks
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/gated_mlp", __doc__)
import jax
import jax.numpy as jn... |
transformer_block | 3 | 44 | full_model | [[128, 256], [256, 64], [256, 64], [256, 64], [64, 256], [256, 256]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level3/transformer_block.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level3/transformer_block.py | skip | false | -1 | -1 | -1 | -1 | 0 | 0 | """Level 3: Simplified Transformer Block (Attention + MLP) via Pallas.
Provenance: AI-Hypercomputer/maxtext Llama/Gemma model architecture
Standard pre-norm transformer block pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/transformer_block", ... | """Level 3: Simplified Transformer Block (Attention + MLP) via Pallas.
Provenance: AI-Hypercomputer/maxtext Llama/Gemma model architecture
Standard pre-norm transformer block pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/transformer_block", ... | @jax.jit
def jax_transformer_block(
x: jax.Array, wq: jax.Array, wk: jax.Array,
wv: jax.Array, wo: jax.Array, w_ff: jax.Array
) -> jax.Array:
d_head = wq.shape[-1]
# Pre-norm
ms = jnp.mean(x ** 2, axis=-1, keepdims=True)
x_norm = x * jax.lax.rsqrt(ms + 1e-5)
# Attention
q = x_norm @ wq
... | @jax.jit
def jax_transformer_block(
x: jax.Array, wq: jax.Array, wk: jax.Array,
wv: jax.Array, wo: jax.Array, w_ff: jax.Array
) -> jax.Array:
d_head = wq.shape[-1]
# Pre-norm
ms = jnp.mean(x ** 2, axis=-1, keepdims=True)
x_norm = x * jax.lax.rsqrt(ms + 1e-5)
# Attention
q = x_norm @ wq
... | null | null | null | null | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | transformer_block_gpu_fixed | """Level 3: Simplified Transformer Block (Attention + MLP) via Pallas.
Provenance: AI-Hypercomputer/maxtext Llama/Gemma model architecture
Standard pre-norm transformer block pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/transformer_block", ... | """Level 3: Simplified Transformer Block (Attention + MLP) via Pallas.
Provenance: AI-Hypercomputer/maxtext Llama/Gemma model architecture
Standard pre-norm transformer block pattern
"""
from pallasbench.provenance import describe_task as _describe_task
__doc__ = _describe_task("L3/transformer_block", ... |
triangle_update | 3 | 45 | genomics | [[64, 64, 32], [64, 64]] | https://github.com/Tyronita/PallasBench/blob/15f2a66/pallasbench/kernels/level3/triangle_update.py | https://github.com/Tyronita/PallasBench/raw/15f2a66/pallasbench/kernels/level3/triangle_update.py | error | false | -1 | -1 | -1 | -1 | 0 | 0 | """Level 3: Triangle Multiplicative Update via Pallas.
Implements the core triangular multiplicative update from AlphaFold2/3's
Evoformer / Pairformer: for each pair (i,j), aggregate information from
all intermediate positions k via element-wise product of edges (i,k)
and (k,j), enabling triplet reasoning for 3D struc... | """Level 3: Triangle Multiplicative Update via Pallas.
Implements the core triangular multiplicative update from AlphaFold2/3's
Evoformer / Pairformer: for each pair (i,j), aggregate information from
all intermediate positions k via element-wise product of edges (i,k)
and (k,j), enabling triplet reasoning for 3D struc... | @jax.jit
def jax_triangle_update(pair: jax.Array, mask: jax.Array) -> jax.Array:
n, _, c = pair.shape
left_proj = pair * mask[:, :, None]
right_proj = pair * mask[:, :, None]
left_t = left_proj.transpose(2, 0, 1)
right_t = right_proj.transpose(2, 0, 1)
update = jnp.sum(left_t[:, :, :, None] * ri... | @jax.jit
def jax_triangle_update(pair: jax.Array, mask: jax.Array) -> jax.Array:
n, _, c = pair.shape
left_proj = pair * mask[:, :, None]
right_proj = pair * mask[:, :, None]
left_t = left_proj.transpose(2, 0, 1)
right_t = right_proj.transpose(2, 0, 1)
update = jnp.sum(left_t[:, :, :, None] * ri... | null | null | null | Verification failed:
error: "reduce_sum:"("reduce_sum"("_triangle_update_kernel"("/mnt/data2/pallasbench_fix/pallasbench/kernels/level3/triangle_update.py":37:13 to :76))): Maximum allowed number of e | NVIDIA A100 80GB PCIe | jax.experimental.pallas | triton | 0.10.1 | 3.7.0 | triangle_update_gpu_fixed | """Level 3: Triangle Multiplicative Update via Pallas.
Implements the core triangular multiplicative update from AlphaFold2/3's
Evoformer / Pairformer: for each pair (i,j), aggregate information from
all intermediate positions k via element-wise product of edges (i,k)
and (k,j), enabling triplet reasoning for 3D struc... | """Level 3: Triangle Multiplicative Update via Pallas.
Implements the core triangular multiplicative update from AlphaFold2/3's
Evoformer / Pairformer: for each pair (i,j), aggregate information from
all intermediate positions k via element-wise product of edges (i,k)
and (k,j), enabling triplet reasoning for 3D struc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.