microsoft / microsoft/onnxruntime-genai

Question: Can onnxruntime-genai.so be used in vanilla onnxruntime as a custom ops library?

Open
#2,080 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.1k
Forks
354
Avg merge
2d 16h
Merged PRs (30d)
85

Description

Hello,

I am using vanilla onnxruntime. When running a single loop cycle of a model such as Gemma 3, neither of CPU nor DNNL execution providers seem to do much (or even any) kernel fusion, thus performance is far from great.

I thought that GenAI might provide some LLM-specific operations and kernel fusions, so I registered onnxruntime-genai.so through RegisterCustomOpsLibrary_V2. I'm using the C API. The call returned a success status. So this part seems to be OK, it seems the library does export some custom operations, but I cant' be sure that any of this is recognized, since it seems that there's no way to inspect this in onnxruntime's api.

But then, when genai is registered as a custom ops provider, nothing changes. The log outputs are virtually the same, there seems to be no improvement with neither CPU ep nor DNNL ep, and the performance is virtually the same (poor).

Now, the main question is whether GenAI provides any specialized LLM stuff and whether it's supposed to be loaded as a custom ops library, or there's no effect because, although registered, it offers nothing in that domain, so nothing is used. If it is supposed to be used as a custom ops library, what might be the reason I'm not seeing any improvement? I'm using onnxruntime 1.24.1, and the latest onnxruntime-genai unpacked from the official tar.gz, on linux.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C API call to RegisterCustomOpsLibrary_V2 and compare the CPU and DNNL execution-provider logs described in the issue. Check how onnxruntime-genai is intended to integrate with onnxruntime 1.24.1 on Linux and whether its custom operations apply to the Gemma 3 model. Done means documenting whether this loading path is supported and explaining the unchanged behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
ai, backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.