Skip to content

DNNL Execution Provider produces incorrect output for LayerNormalization with axis = -1 #26407

@eKevinHoang

Description

@eKevinHoang

Describe the issue

Description:

When using the DNNL Execution Provider (EP) in ONNX Runtime, LayerNormalization nodes with the attribute axis=-1 produce incorrect results. Currently, DNNL does not resolve negative axes, which leads to wrong outputs.

Environment:

  • ONNX Runtime version: 1.23.1
  • Platform:(no CUDA, Intel + AMD Graphics)
  • Models with LayerNormalization using axis=-1 (e.g., SAM2)

Expected behavior:

The negative axis should be correctly resolved before DNNL execution, or DNNL EP should handle negative axes to produce correct output.

Current workaround:

Exclude LayerNormalization nodes with axis=-1 when using DNNL EP.

Additional notes:

DNNL provides excellent performance, but this issue causes incorrect results if negative axes are not handled.

To reproduce

  1. Load a model containing LayerNormalization nodes with axis=-1.
  2. Run inference using the DNNL Execution Provider.
  3. Observe that the output differs from other (e.g., CPU)

Urgency

No response

Platform

Mac

OS Version

15.7.1

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.23.1

ONNX Runtime API

C++

Architecture

X64

Execution Provider

oneDNN

Execution Provider Library Version

oneDNN-3.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    ep:oneDNNquestions/issues related to DNNL EP

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions