Skip to content

flip vulkan implementation - #6907

Open
futz12 wants to merge 2 commits into
Tencent:masterfrom
futz12:flip-vulkan
Open

flip vulkan implementation#6907
futz12 wants to merge 2 commits into
Tencent:masterfrom
futz12:flip-vulkan

Conversation

@futz12

@futz12 futz12 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Add a Vulkan implementation of the Flip layer.

Previously Flip had no GPU path and fell back to CPU whenever a graph
contained a flip. This adds a dedicated Vulkan operator with pack1/pack4
shaders.

Implementation notes:

  • Mirrors the CPU flip semantics: dims(1-4) -> axis mapping, negative axis
    normalization, and pack4 lane reversal for channel-axis flips.
  • One invocation per element; pipeline local size tuned to the device
    subgroup size.
  • Empty-axes input is passed through without launching a shader.

Files:

  • src/layer/vulkan/flip_vulkan.cpp / flip_vulkan.h
  • src/layer/vulkan/shader/flip.comp, flip_pack4.comp

Motivation: RVC-style audio decoders use torch.flip on the GPU; this
keeps the whole graph on Vulkan instead of stalling on a CPU round-trip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant