{"record":{"id":"15002fc7dbd57d57","repo":"jax-ml/jax","slug":"can-t-print-the-type-arg-type","errorCode":null,"errorMessage":"Can't print the type {arg.type}","messagePattern":"Can't print the type (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/utils.py","lineNumber":181,"sourceCode":"\ndef _debug_scalar_ty_format(arg):\n  if isinstance(arg.type, ir.IndexType):\n    return \"%llu\", arg\n  if isinstance(arg.type, ir.IntegerType):\n    if ir.IntegerType(arg.type).width < 64:\n      arg = arith.extui(ir.IntegerType.get_signless(64), arg)\n    return \"%llu\", arg\n  if isinstance(arg.type, ir.F32Type):\n    return \"%f\", arg\n  if isinstance(arg.type, ir.Float8E8M0FNUType):\n    return \"%u\", arith.extui(\n        ir.IntegerType.get_signless(32),\n        arith.bitcast(ir.IntegerType.get_signless(8), arg),\n    )\n  if isinstance(arg.type, (ir.BF16Type, ir.F16Type)):\n    arg = arith.extf(ir.F32Type.get(), arg)\n    return \"%f\", arg\n  raise NotImplementedError(f\"Can't print the type {arg.type}\")\n\n\ndef debug_print(fmt, *args, uniform=True, scope=None):\n  if not uniform and scope is not None:\n    raise ValueError(\"Cannot specify scope to a non-uniform debug_print.\")\n  if scope is None:\n    scope = ThreadSubset.WARPGROUP\n  type_formats = []\n  new_args = []\n  for arg in args:\n    if isinstance(arg.type, ir.VectorType):\n      vec_ty = ir.VectorType(arg.type)\n      if len(vec_ty.shape) > 1:\n        raise NotImplementedError(\n            f\"2D+ vectors are not supported in debug_print: {vec_ty}\"\n        )\n      vec_args = [\n          vector.extract(","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/utils.py#L163-L199","documentation":"Raised by _debug_scalar_ty_format, the helper behind debug_print, when asked to produce a printf format string for a scalar type it doesn't know how to print. Currently supported: index/integer (via %llu with i32/i8 handling), f32/f64, and bf16/f16 (extended to f32 and printed with %f). Any other scalar (e.g. f8, complex, bool-like custom types) has no format mapping.","triggerScenarios":"Calling utils.debug_print('fmt {}', arg) where arg is an f8e4m3fn value, a complex value, or any scalar type outside index/integer/float16-family/f32/f64.","commonSituations":"Debugging FP8 matmul kernels on Blackwell and trying to print raw operand values; passing values that were bitcast to unusual integer widths (e.g. i4-packed) before printing.","solutions":["Bitcast the value to a printable width first (e.g. bitcast f8 -> i8, or extend to f32 where semantics allow) and print as integer/float","Print a numeric proxy: convert to f32 via arith.extf only for types that support it, else bitcast to i32","Remove the debug_print for unsupported dtypes and inspect via IR dumps or dumps to memory instead"],"exampleFix":"# before\ndebug_print('x={}', f8_val)  # NotImplementedError\n# after\nx_bits = arith.bitcast(i8_ty, f8_val)\ndebug_print('x_bits={}', x_bits)","handlingStrategy":"fallback","validationCode":"supported = (ir.IndexType, ir.IntegerType, ir.F32Type, ir.F64Type, ir.BF16Type, ir.F16Type)\nif not isinstance(arg.type, supported):\n    arg = arith.bitcast(ir.IntegerType.get_signless(32), arg)  # print raw bits\ndebug_print('v={}', arg)","typeGuard":"def is_printable_scalar(arg):\n    return isinstance(arg.type, (ir.IndexType, ir.IntegerType, ir.F32Type, ir.F64Type, ir.BF16Type, ir.F16Type))","tryCatchPattern":null,"preventionTips":["Bitcast exotic dtypes (f8, i4) to i8/i32 before debug_print","Extend f16/bf16 by arith.extf to f32 for readable values"],"tags":["gpu","mosaic","debug-print","unsupported-type","dtype"],"backgroundTag":"unsupported-type","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}