{"record":{"id":"dbdf22cf01608a25","repo":"jax-ml/jax","slug":"get-only-supports-slices-with-stride-1-got-strid","errorCode":null,"errorMessage":"Get only supports slices with stride 1, got {strides}","messagePattern":"Get only supports slices with stride 1, got (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/sc_lowering.py","lineNumber":120,"sourceCode":"  ref_block_shape, *_ = ctx.block_shapes\n  ref, ref_block_shape = _transform_ref(\n      ref, ref_aval, ref_block_shape, prev_transforms\n  )\n  starts, sizes, strides, squeeze_dims, _ = tc_lowering._indexer_to_start_size_stride(\n      indexer, ref_block_shape, cast_to_index=True\n  )\n  for first_nontrivial_dim, s in enumerate(sizes):\n    if s != 1:\n      break\n  else:\n    first_nontrivial_dim = len(sizes)\n  if any(squeeze_dims[first_nontrivial_dim:]):\n    raise NotImplementedError(\n        \"Integer indexing of refs that follows a non-trivial slice is not\"\n        \" supported on SC\"\n    )\n  if not all(s == 1 for s in strides):\n    raise NotImplementedError(\n        \"Get only supports slices with stride 1, got {strides}\"\n    )\n\n  if (out_aval.ndim == 0) != (ref_memory_space is MemorySpace.SMEM):\n    message = \"Get only supports loading scalars from SMEM.\"\n    if ref_memory_space is MemorySpace.SMEM:\n      message += \" Trying to load an array of shape {out_aval.shape}.\"\n    elif ref_memory_space is MemorySpace.VMEM:\n      message += (\n          \" To load a scalar from VMEM, load an array first and then extract a\"\n          \" particular element, e.g. ``v = ref[pl.ds(idx, ...)]; v[0]``.\"\n      )\n    else:\n      message += f\" Trying to load a scalar from {ref_memory_space!r}.\"\n    raise NotImplementedError(message)\n  if out_aval.ndim == 0:\n    if mask is not None:\n      raise NotImplementedError(\"Get does not support masked scalar loads\")","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/sc_lowering.py#L102-L138","documentation":"SparseCore loads only lower contiguous slices: every stride in the index expression must be 1. Strided slices like ref[::2] raise NotImplementedError in the Get lowering rule.","triggerScenarios":"Using a step != 1 slice on a ref inside an SC kernel, e.g. ref[0:n:2] or ref[:, ::4].","commonSituations":"Downsampling/decimation patterns ported from TensorCore or CPU code.","solutions":["Load the contiguous range and decimate afterwards on the returned array","Adjust data layout so the needed elements are contiguous"],"exampleFix":"# before\nv = ref[0:128:2]\n# after\nv = ref[0:128]\nv = v[::2]","handlingStrategy":"validation","validationCode":"assert all(s == 1 for s in strides)","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Load contiguous ranges; decimate on the loaded array"],"tags":["jax","pallas","tpu","sparsecore","slicing","strides"],"backgroundTag":"unsupported-strided-slice","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}