This document is relevant for: Inf2, Trn1, Trn2, Trn3

NCC_EOCP001#

Error message: Tensor <legacy_tensor> has legacy type float8e4 but tensor <ocp_tensor> has OCP-compliant type float8_e4m3fn. Mixed use of the two mutually-exclusive types is not supported.

Neuron supports two 8-bit floating-point formats with a 4-bit exponent and a 3-bit mantissa:

  • The legacy float8e4 format (float8_e4m3 in frameworks).

  • The OCP-compliant float8_e4m3fn format.

The two formats encode the same bit patterns as different values. Each compiled module (one per NeuronCore) selects a single FP8 E4M3 conversion mode, which the hardware engines and DMA use for all FP8 E4M3 data in that module. A module cannot use both formats, so the compiler raises this error when it finds tensors of both types in the same module. Previous compiler versions compiled such modules and could produce incorrect values for the tensors of one of the two types.

This error often comes from a custom kernel, such as an NKI kernel, that declares internal or scratch tensors with a different FP8 E4M3 type than the rest of the model.

To fix this error, use only one of the two FP8 E4M3 types in the model and in every kernel it calls. For example, if the model stores data in float8_e4m3fn, declare the kernel’s FP8 E4M3 tensors as float8_e4m3fn as well. The error message names one tensor of each type to help you find the mismatch.

This document is relevant for: Inf2, Trn1, Trn2, Trn3