isContiguous

abstract fun isContiguous(): Boolean(source)

Determines whether the mapped region represents contiguous memory access.

This optimization hint indicates whether elements accessed through this mapper are stored contiguously in memory within the parent tensor. Contiguous access patterns enable significant performance optimizations:

  • Vectorized operations (SIMD)

  • Cache-friendly memory access patterns

  • Bulk memory operations (memcpy-style transfers)

  • Reduced coordinate calculation overhead

Contiguity Criteria

A mapping is considered contiguous when:

  • Sequential view coordinates map to sequential parent coordinates

  • No gaps exist between mapped memory locations

  • The memory layout follows a predictable stride pattern

Use Cases

Contiguous mappings are common for:

  • Full dimension slices: tensor[:, :, 0:10, :]

  • Batch extraction: tensor[0:5, :, :, :]

  • Simple range slices without stepping

Return

true if the mapping represents contiguous memory access, false otherwise