Skip to content

[BUG] CuTe DSL from_dlpack rejects float8_e4m3fn tensors (dtype_map lists Float8E5M2 only) #3716

Open

Description

@Vinnie6167

Describe the bug

cutlass.cute.runtime.from_dlpack rejects torch.float8_e4m3fn tensors:

KeyError: Unsupported element type in dlpack: 'Float8E4M3FN'. Supported types are:
['Bool', 'Int64', 'Int32', 'Int16', 'Int8', 'UInt64', 'UInt32', 'UInt16', 'UInt8',
 'Float64', 'Float32', 'Float16', 'BFloat16', 'Float8E5M2']

The runtime already decodes the DLPack type code and reports the element type as
Float8E4M3FN (the string comes out of libcute_dsl_runtime.so, which also knows
Float8E4M3, Float8E4M3FNUZ, Float8E8M0FNU, Float4E2M1FN, ...). Only the Python
lookup table in TensorDescriptor.element_type /
python/CuTeDSL/cutlass/base_dsl/runtime/tensor_descriptor.py stops at Float8E5M2, so
every other 8-bit float that the runtime recognizes is rejected at import time even though
cutlass.Float8E4M3FN is a fully supported kernel element type.

PyTorch is not the limiting side: torch.empty(8, dtype=torch.float8_e4m3fn).__dlpack__()
succeeds on torch 2.11 and the capsule round-trips through torch.from_dlpack.

Steps/Code to reproduce bug

import torch
from cutlass.cute.runtime import from_dlpack

x = torch.empty(8, dtype=torch.float8_e4m3fn, device="cuda")
t = from_dlpack(x, assumed_align=16)   # KeyError: Unsupported element type in dlpack: 'Float8E4M3FN'

Expected behavior

from_dlpack returns a cute.Tensor with element_type == cutlass.Float8E4M3FN, the same
way it does for torch.float8_e5m2.

Workaround in use

Callers currently export the storage as uint8/int8 and overwrite element_type
afterwards, e.g. FlashInfer does this in flashinfer/gemm/kernels/bmm_fp8_blackwell.py,
flashinfer/attention/cute_dsl/fmha.py, and pending PR flashinfer-ai/flashinfer#5533:

t = from_dlpack(x.view(torch.uint8), assumed_align=16)
t.element_type = cutlass.Float8E4M3FN

Adding the missing names to the dtype_map (at least Float8E4M3FN; ideally the other
strings the runtime emits) would let these call sites drop the reinterpretation.

Environment details

  • nvidia-cutlass-dsl 4.8.0 (nvidia_cutlass_dsl_libs_cu13-4.8.0), and main as of 2026-10-07
  • torch 2.11.0+cu130
  • Linux x86_64, CUDA 13.0

Activity

  1. Ammar-Alnagar commented on Oct 10, 2026

    @Ammar-Alnagar

    taking this !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions