Open
Conversation
Signed-off-by: Xinyu Chen <xinyu1.chen@intel.com>
Signed-off-by: Xinyu Chen <xinyu1.chen@intel.com>
Contributor
There was a problem hiding this comment.
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}" |
There was a problem hiding this comment.
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}" |
Comment on lines
+5
to
+9
| { | ||
| const dnnl_version_t* ver = dnnl_version(); | ||
| ss << ver->major << '.' << ver->minor << '.' << ver->patch << "." | ||
| << ver->hash; | ||
| } |
There was a problem hiding this comment.
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor 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)