{"record":{"id":"fac0b5b5219f0dd3","repo":"jax-ml/jax","slug":"unknown-gpu-platform-for-dlpack-platform-ver","errorCode":null,"errorMessage":"Unknown GPU platform for __dlpack__: {platform_version}","messagePattern":"Unknown GPU platform for __dlpack__: (.+?)","errorType":"exception","errorClass":"BufferError","httpStatus":null,"severity":"error","filePath":"jax/_src/array.py","lineNumber":460,"sourceCode":"    if self.platform() == \"cpu\":\n      return DLDeviceType.kDLCPU, 0\n\n    elif self.platform() == \"gpu\":\n      platform_version = _get_device(self).client.platform_version\n      if \"cuda\" in platform_version:\n        if self.sharding.memory_kind == \"pinned_host\":\n          dl_device_type = DLDeviceType.kDLCUDAHost\n        else:\n          dl_device_type = DLDeviceType.kDLCUDA\n      elif \"rocm\" in platform_version:\n        if self.sharding.memory_kind == \"pinned_host\":\n          dl_device_type = DLDeviceType.kDLROCMHost\n        else:\n          dl_device_type = DLDeviceType.kDLROCM\n      elif \"oneapi\" in platform_version:\n        dl_device_type = DLDeviceType.kDLOneAPI\n      else:\n        raise BufferError(\"Unknown GPU platform for __dlpack__: \"\n                         f\"{platform_version}\")\n\n      local_hardware_id = _get_device(self).local_hardware_id\n      if local_hardware_id is None:\n        raise BufferError(\"Couldn't get local_hardware_id for __dlpack__\")\n\n      return dl_device_type, local_hardware_id\n\n    elif self.platform() == \"tpu\":\n      if self.sharding.memory_kind == \"pinned_host\":\n        dl_device_type = DLDeviceType.kDLTPUHost\n      else:\n        raise BufferError(\n            \"__dlpack__ device only supported for TPU pinned host memory\"\n        )\n\n      local_hardware_id = _get_device(self).local_hardware_id\n      if local_hardware_id is None:","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/array.py#L442-L478","documentation":"When exporting via DLPack, JAX maps the CUDA platform_version string to a known GPU backend (CUDA, ROCm, OneAPI). If the runtime's platform_version string contains none of the recognized markers (e.g. 'cuda', 'rocm', 'oneapi'), JAX cannot determine which DLPack device type to advertise and raises BufferError.","triggerScenarios":"Calling __dlpack__/from_dlpack on a GPU array when jax's cuda/rocm extension reports an unrecognized platform_version string — e.g. development builds, patched drivers, or new backend variants not known to the installed JAX version.","commonSituations":"Newer GPU runtime or fork (e.g. a different HIP build) with an older JAX that doesn't recognize its version string; mismatched jax/jaxlib versions; source-built jaxlib with custom platform branding.","solutions":["Upgrade jax and jaxlib to matching versions that recognize the platform string","Inspect x.platform() and the extension's platform_version to confirm which backend is active","Route the transfer through host memory: np.asarray(x) then move to the target framework","Report the platform_version string upstream so it can be whitelisted"],"exampleFix":"// before\nt = torch.from_dlpack(gpu_x)  # BufferError: Unknown GPU platform\n// after\nimport numpy as np\nt = torch.as_tensor(np.asarray(gpu_x)).to('cuda')","handlingStrategy":"fallback","validationCode":"x_platform = x.platform()\nversion_ok = any(m in jax._src.xla_bridge.get_backend().platform_version\n                 for m in ('cuda', 'rocm', 'oneapi')) if x_platform != 'cpu' else True\nif not version_ok:\n    x = np.asarray(x)  # go via host instead of DLPack","typeGuard":null,"tryCatchPattern":"try:\n    t = torch.from_dlpack(x)\nexcept BufferError:\n    # unknown/unsupported platform: round-trip through host\n    t = torch.as_tensor(np.asarray(x)).to(x.platform())","preventionTips":["Pin jax and jaxlib to matching versions from the same release","Run a smoke-test from_dlpack transfer in CI for your exact GPU stack","Check x.platform() and backend platform_version when interop behaves oddly"],"tags":["jax","dlpack","gpu","platform-detection","version-mismatch"],"backgroundTag":"dlpack-unknown-device-platform","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}