Skip to content

Add direct channels_last (NHWC) SIMD fast path for Conv2d forward and backward #7

Open

Description

@voidstackloop

Summary

Oxideon supports MemoryFormat::ChannelsLast (Layout::channels_last, Tensor::to_channels_last(), Tensor::is_channels_last()). Currently, the fast CPU conv2d path (conv2d_winograd_3x3_f32 / conv2d_oc_block4_s1d1_f32 / im2col+GEMM in crates/oxideon-core/src/ops.rs) operates on contiguous NCHW tensors.

Adding a direct NHWC SIMD kernel (where C_in is contiguous in memory, enabling inner-loop AVX2/NEON FMA dot products without transposing or materializing im2col buffers) will speed up channels_last CNN workloads on CPU.

Relevant Files

  • crates/oxideon-core/src/ops.rs (Tensor::conv2d)
  • crates/oxideon-core/src/layout.rs (MemoryFormat::ChannelsLast)
  • crates/oxideon-core/tests/channels_last.rs
  • crates/oxideon-core/tests/conv_fast_paths.rs

Acceptance Criteria

  • Detect self.is_channels_last() && weight.is_channels_last() in Tensor::conv2d and dispatch to a direct NHWC kernel (producing a channels_last output tensor).
  • Match NCHW forward and backward results within 1e-4 and add a benchmark comparison.

Activity

  1. added
    enhancement
    help wanted
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions