Skip to content

Uncaught dnnl::error terminates the process when oneDNN cannot serve a dtype #33

Description

@lwandrebeck

Summary

Every oneDNN entry point can throw dnnl::error, and primitive-descriptor
creation does so when the host ISA cannot serve the requested dtype — BF16 without
AVX-512 or AVX2-VNNI-2, for instance. Nothing in matmul_onednn_wrapper() catches
it, so the exception reaches std::terminate and takes the process down.

Reproduce

On a host without AVX-512:

benchdnn --op=matmul --lowoha=true --m=512 --k=512 --n=512 \
         --sdt=bf16 --wdt=bf16 --ddt=bf16 --kernel_name=onednn
terminate called after throwing an instance of 'dnnl::error'
  what():  could not create a primitive descriptor for the matmul primitive.
Aborted (core dumped)          # exit 134

Suggested fix

Catch inside matmul_onednn_wrapper() rather than at the call sites: three of the
five callers (bmm_kernel, bmm_looper, matmul_partitioner) invoke it from
inside an OpenMP parallel region, where an escaping exception may not cross the
region boundary. The AOCL-DLP tail in lowoha_matmul.cpp already documents the
same reasoning for run_dlp.

On failure, mark the AOCL-DLP fallback — the convention the dispatch already uses
for "did not compute" — and let the call sites fall through rather than returning
success on an untouched C.

Reference branch: https://github.com/lwandrebeck/BullDNN/tree/upstream/onednn-uncaught-error-abort

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