Summary
Replace oneDNN C API calls in DnnlExt.h (and update the callsite in WoQMatmul.cpp) with their C++ API equivalents for a consistent programming style across the XPU oneDNN integration layer.
Motivation
The existing code mixed oneDNN C API (dnnl_* functions, dnnl_exec_arg_t, const_dnnl_memory_desc_t, etc.) with the C++ API (dnnl::memory::desc, dnnl::matmul::primitive_desc, etc.) within the same file. This inconsistency made the code harder to read and maintain.
The C++ API also provides RAII semantics — destructors automatically handle resource cleanup (e.g., memory::desc, memory, primitive_desc are all properly destroyed on scope exit), eliminating the need for manual destroy calls and reducing the risk of resource leaks.
Changes
DnnlExt.h — primitive_ext class rewrite:
| Before (C API) | After (C++ API) |
|---|---|
dnnl_primitive_desc_query_md() | matmul::primitive_desc::query_md() |
dnnl_sycl_interop_memory_create() | make_onednn_memory() (wraps dnnl::sycl_interop::make_memory()) |
dnnl_memory_desc_get_size() | memory::desc::get_size() |
dnnl_sycl_interop_primitive_execute() | dnnl::sycl_interop::execute() |
dnnl_exec_arg_t c_args[] (C struct array) | std::unordered_map<int, memory> |
const_dnnl_memory_desc_t return types | memory::desc return types |
#include <oneapi/dnnl/dnnl.h> (C header) | #include <oneapi/dnnl/dnnl_sycl.hpp> (C++ header) |
Key design change: primitive_ext now reconstructs a matmul::primitive_desc from the underlying primitive via get_primitive_desc(), enabling pure C++ query_md() calls.
WoQMatmul.cpp — callsite update:
set_attribute(): removed the manual slot index parameter; arguments are now keyed byarg_classin the internal map.execute(): removed theslot_offparameter.
Test
Verified with WoQ (weight-only quantization) INT4 inference on Phi-3-mini-4k-instruct (FP16, XPU). Functional correctness and performance unchanged on BMG.
| No Primitive Cache | Primitive Cache (before) | Primitive Cache (after PR) | |
|---|---|---|---|
| Next Token Latency (s) | baseline | -16.3% | -14.9% |
Pull Request resolved: ,
Community-Analysen & Experten-Meinungen 0
Verwandte Story-Cluster & Quellen (Vektor-KI)
Ähnliche Beiträge
Auch interessante Nachrichten trunk/e0d9cf97915baca1b5f2a6758f5028858609ef28: [xpu] Refactor OneDNN C API to C++ API (#184486)
Thematisch verwandte Begriffe: trunke0d9cf97915baca1b5f2a6758f5028858609ef28, Refactor, OneDNN, 184486 · 6 Treffer
How do I reverse engineer a local Unity WebGL IL2CPP game
[webapps] Langflow 1.8.4 - Path Traversal to Remote Code Execution
ai backed x64dbg or similar ?
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
Beiträge werden geladen ...
Videos werden geladen ...
SOCIAL SHARE CARD GENERATOR