Skip to content

Add enough of the graph API to do mobilenet#22

Merged
boydjohnson merged 3 commits intomainfrom
feature/graph
Jul 8, 2025
Merged

Add enough of the graph API to do mobilenet#22
boydjohnson merged 3 commits intomainfrom
feature/graph

Conversation

@boydjohnson
Copy link
Owner

No description provided.

@boydjohnson boydjohnson requested a review from Copilot July 8, 2025 20:50
Copy link

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 exposes enough of the oneDNN Graph API to support MobileNet by making memory constants public, adding a new graph module, and implementing core graph, tensor, op, and partition types.

  • Expose public memory handle constants for graph tensor allocation.
  • Register the new graph module in lib.rs.
  • Introduce graph API: logical tensors, physical tensors, operation builders, partitions, and execution.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/memory.rs Make DNNL_MEMORY_NONE and DNNL_MEMORY_ALLOCATE public
src/lib.rs Add pub mod graph to library root
src/graph/tensor/tensor.rs Add Tensor wrapper for graph tensors and data handle methods
src/graph/tensor/logical.rs Implement LogicalTensor initialization and dimension queries
src/graph/spec.rs Define OpSpec, RequiredAttrs, and AttrValue enum
src/graph/partition.rs Implement OneDNNGraphPartition for querying and compiling parts
src/graph/ops_builders.rs Provide generic OpBuilder and type aliases for all ops
src/graph/ops_builders/* Add individual OpSpec and attribute specs for various ops
src/graph/op.rs Low-level wrapper for dnnl_graph_op_* functions
src/graph/graph.rs High-level OneDNNGraph API to build, finalize, and partition
src/graph/compiled_partition.rs Implement CompiledPartition for executing compiled partitions
src/graph.rs Re-export graph submodules
Comments suppressed due to low confidence (3)

src/memory.rs:22

  • [nitpick] These newly public constants lack documentation. Consider adding /// comments to explain their purpose and usage.
pub const DNNL_MEMORY_NONE: *mut c_void = std::ptr::null_mut();

src/graph/tensor/tensor.rs:60

  • [nitpick] The size parameter is ambiguous (bytes vs. element count). Consider renaming to element_count or documenting exactly what it represents.
    pub fn get_data_handle(&self, size: usize) -> Result<Vec<f32>, DnnlError> {

src/graph/spec.rs:3

  • [nitpick] The public trait OpSpec and enum AttrValue lack doc comments. Adding documentation would clarify their roles in defining operation specs and attributes.
pub trait OpSpec {


use crate::graph::spec::RequiredAttrs;

pub struct BatchNormInferenceSpec;
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

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

BatchNormInferenceSpec is missing an impl OpSpec block, so it can’t be used with OpBuilder. Add something like:

impl OpSpec for BatchNormInferenceSpec {
    const KIND: OneDNNGraphOpType = OneDNNGraphOp::BATCH_NORM_INFERENCE;
}

Copilot uses AI. Check for mistakes.
@boydjohnson boydjohnson merged commit 2aa3116 into main Jul 8, 2025
2 checks passed
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.

2 participants