jax.experimental.pallas.tpu_sc module

jax.experimental.pallas.tpu_sc module#

TPU SparseCore Extensions to Pallas.

This module is an alias of jax.pallas.tpu_sc, which is the preferred import path.

Classes#

Indices(values[, ignored_value])

Indices for a gather or a scatter on SparseCore.

PackFormat(value[, names, module, qualname, ...])

ScalarSubcoreMesh(*, axis_name, num_cores)

SparseCorePushStreamWarning

Warns that destination semaphores are ignored for push streams.

VectorSubcoreMesh(*, core_axis_name, ...)

Functions#

bitcast(x, dtype)

Bitcasts an array to a different dtype along the minormost dimension.

pack(a, b, /, *, format[, ...])

Packs two arrays according to the given format.

parallel_loop()

A parallel loop decorator.

sort_key_val()

Sorts keys and values, pushing invalid elements to the last positions.

unpack(ab, /, *, format[, ...])

Unpacks two arrays according to the given format.

Memory operations#

addupdate(ref, x)

Performs an atomic add to a ref.

addupdate_compressed(ref, x, *, mask)

Performs a masked atomic add to a ref.

addupdate_scatter(ref, indices, x, *[, mask])

Scatters an array to a ref, atomically adding to existing values.

fetch_and_add(x_ref, value, *, subcore_id)

Adds value to the x_ref on another subcore.

load_expanded(ref, *, mask)

Performs and expanded masked load from a ref.

load_gather(ref, indices, *[, mask])

Gathers an array from a ref.

slice_subcore_vmem_from_shared(ref)

Slices the current vector subcore's local VMEM from a VMEM_SHARED ref.

store_compressed(ref, x, *, mask)

Performs a compressed masked store to a ref.

store_scatter(ref, indices, x, *[, mask])

Scatters an array to a ref.

Reductions and scans#

all_reduce_ffs(x, *[, reduce])

Computes the index of the first true element in the array.

all_reduce_population_count(x, *[, reduce])

Computes the number of nonzero elements in the array.

cummax(x, *[, mask])

Returns the cumulative max of the array along its innermost axis.

cumsum(x, *[, mask])

Returns the cumulative sum of the array along its innermost axis.

scan_count(x[, mask])

Computes the running duplicate occurrence count of the array.

Miscellaneous#

get_sparse_core_info()

Returns the SparseCore information for the current device.

subcore_barrier()

Blocks until all subcores on the same core reach this instruction.