{"record":{"id":"f7c7bbd13f013faa","repo":"jax-ml/jax","slug":"loading-from-a-block-pointer-is-not-supported","errorCode":null,"errorMessage":"loading from a block pointer is not supported","messagePattern":"loading from a block pointer is not supported","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/triton/lowering.py","lineNumber":2038,"sourceCode":"    cache = tt_dialect.CacheModifier.NONE\n  elif cache_modifier == \".ca\" or cache_modifier == \".cg\":\n    cache = _STR_TO_CACHE_MODIFIER[cache_modifier]\n  else:\n    raise ValueError(f\"unsupported cache modifier: {cache_modifier}\")\n  if eviction_policy is None:\n    evict = tt_dialect.EvictionPolicy.NORMAL\n  else:\n    try:\n      evict = _STR_TO_EVICTION_POLICY[eviction_policy]\n    except KeyError:\n      raise ValueError(\n          f\"unsupported eviction policy: {eviction_policy}\"\n      ) from None\n\n  if _is_triton_pointer_type(ptr.type):\n    ptr_type = tt_dialect.PointerType(ptr.type)\n    if isinstance(ptr_type.pointee_type, ir.RankedTensorType):\n      raise NotImplementedError(\"loading from a block pointer is not supported\")\n\n  ptr_type = _element_type(ptr.type)\n  if not _is_triton_pointer_type(ptr_type):\n    raise ValueError(f\"unsupported pointer type: {ptr_type}\")\n  ptr_type = tt_dialect.PointerType(ptr_type)\n  if other is not None and mask is None:\n    raise ValueError(\"other requires mask to be provided\")\n  if not isinstance(ptr.type, ir.RankedTensorType):\n    if other is not None and isinstance(other.type, ir.RankedTensorType):\n      raise ValueError(\"other cannot be a block if pointer is not a block\")\n    if mask is not None and isinstance(mask.type, ir.RankedTensorType):\n      raise ValueError(\"mask cannot be a block if pointer is not a block\")\n\n  pointee_type = ptr_type.pointee_type\n  is_int1 = isinstance(pointee_type, ir.IntegerType) and pointee_type.width == 1\n  if is_int1:\n    pointee_type = ir.IntegerType.get_signless(8)\n    ptr = _ir_cast(","sourceCodeStart":2020,"sourceCodeEnd":2056,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/triton/lowering.py#L2020-L2056","documentation":"The Triton Pallas lowering only supports loading from scalar/tensor-of pointers. A tt pointer whose pointee is itself a RankedTensorType (a 'block pointer') has no load lowering implemented.","triggerScenarios":"Loading through a value typed as tensor<...x !tt.ptr<tensor<...>>> — i.e. a block of pointers to blocks — produced by unusual pointer arithmetic or kernel shapes inside a Triton Pallas kernel.","commonSituations":"Experimental kernels doing pointer-to-pointer tricks; shapes where offset broadcasting yields a pointer tensor with tensor pointee; running kernels written against newer Triton block-pointer APIs.","solutions":["Keep the pointer's pointee a scalar element type: use base_ptr + flat integer offsets rather than nested pointer tensors","Flatten the block so loads use a 1D pointer tensor","Simplify the BlockMapping/grid so pointers stay element-level; report if it still reproduces"],"exampleFix":"// before\np = some_ptr_block  # ptr<tensor<...>>\nv = tt.load(p)\n\n// after\noff = compute_flat_indices(...)\nv = pl.load(base_ref.at[off])  # element-level pointer","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"# conceptual: ensure loads use element-level pointers, not ptr<tensor<...>>\ndef is_element_pointer_load(ptr_ir_type) -> bool:\n    pointee = tt.PointerType(ptr_ir_type).pointee_type\n    return not isinstance(pointee, ir.RankedTensorType)","tryCatchPattern":"try:\n    v = pl.load(ref, mask=m)\nexcept NotImplementedError as e:\n    if 'block pointer' in str(e):\n        # flatten: load via flat indices into base reference\n        v = base_ref[flat_idx]","preventionTips":["Use flat integer offsets plus a base reference instead of block-of-block pointers","Flatten multi-dim indexing before loading","Keep loads expressed through public pl.load / ref indexing APIs"],"tags":["jax","triton","pallas","load","block-pointer","not-implemented"],"backgroundTag":"unsupported-operation-not-implemented","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}