Skip to content

utils to get onednn version#146

Open
xinyu-intel wants to merge 3 commits intovllm-project:mainfrom
xinyu-intel:dev/onednn_version
Open

utils to get onednn version#146
xinyu-intel wants to merge 3 commits intovllm-project:mainfrom
xinyu-intel:dev/onednn_version

Conversation

@xinyu-intel
Copy link
Collaborator

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS ABOVE HAVE BEEN CONSIDERED.

Purpose

utils to get onednn version

Test Plan

Test Result

(Optional) Documentation Update

BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)

Signed-off-by: Xinyu Chen <xinyu1.chen@intel.com>
Signed-off-by: Xinyu Chen <xinyu1.chen@intel.com>
Copilot AI review requested due to automatic review settings February 6, 2026 06:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds utility functions to retrieve the oneDNN version from the library and expose it through the testing interface.

Changes:

  • Implements a C++ function get_onednn_version() that queries oneDNN for its version information
  • Exposes the version function through PyTorch bindings for use in Python tests
  • Adds a test to verify the oneDNN version matches expected values

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
csrc/xpu/onednn/onednn_runtime.cpp Implements the core version retrieval function using oneDNN API
csrc/xpu/onednn/onednn_runtime.h Declares the version retrieval function
csrc/xpu/ops.h Exposes the function to the XPU operations interface
csrc/xpu/torch_bindings.cpp Binds the version function to PyTorch operations
tests/register_ops.py Provides Python wrapper for the version function
tests/test_fp8_gemm_onednn.py Adds test case to validate oneDNN version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to +48
def test_onednn_version():
version = get_onednn_version()
major, minor, patch, hash = version.split(".")
hash = hash[:7] # only compare the first 7 characters of the hash
ref_major = 3
ref_minor = 10
ref_patch = 0
ref_hash = "704b0d6"
assert (int(major), int(minor), int(patch),
hash) == (ref_major, ref_minor, ref_patch,
ref_hash), f"Expected oneDNN version \
{ref_major}.{ref_minor}.{ref_patch}.{ref_hash}, but got {version}"
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded version values should be extracted as constants at the module level or read from configuration to make version updates easier to maintain.

Suggested change
def test_onednn_version():
version = get_onednn_version()
major, minor, patch, hash = version.split(".")
hash = hash[:7] # only compare the first 7 characters of the hash
ref_major = 3
ref_minor = 10
ref_patch = 0
ref_hash = "704b0d6"
assert (int(major), int(minor), int(patch),
hash) == (ref_major, ref_minor, ref_patch,
ref_hash), f"Expected oneDNN version \
{ref_major}.{ref_minor}.{ref_patch}.{ref_hash}, but got {version}"
ONEDNN_REF_MAJOR = 3
ONEDNN_REF_MINOR = 10
ONEDNN_REF_PATCH = 0
ONEDNN_REF_HASH = "704b0d6"
def test_onednn_version():
version = get_onednn_version()
major, minor, patch, hash = version.split(".")
hash = hash[:7] # only compare the first 7 characters of the hash
assert (int(major), int(minor), int(patch),
hash) == (ONEDNN_REF_MAJOR, ONEDNN_REF_MINOR, ONEDNN_REF_PATCH,
ONEDNN_REF_HASH), f"Expected oneDNN version \
{ONEDNN_REF_MAJOR}.{ONEDNN_REF_MINOR}.{ONEDNN_REF_PATCH}.{ONEDNN_REF_HASH}, but got {version}"

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +9
{
const dnnl_version_t* ver = dnnl_version();
ss << ver->major << '.' << ver->minor << '.' << ver->patch << "."
<< ver->hash;
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inner scope block appears unnecessary. The ver variable could be declared directly without the extra braces.

Suggested change
{
const dnnl_version_t* ver = dnnl_version();
ss << ver->major << '.' << ver->minor << '.' << ver->patch << "."
<< ver->hash;
}
const dnnl_version_t* ver = dnnl_version();
ss << ver->major << '.' << ver->minor << '.' << ver->patch << "."
<< ver->hash;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants