Skip to content

Add efficient CPU block execution with fibers #1638

Description

@shi-eric

Description

Support explicit block_dim > 1 values in wp.launch() and wp.launch_tiled() on CPU.

CPU kernels should observe the requested block dimension and logical thread indices while supporting block-shared tile state and block-wide barriers consistent with CUDA block semantics.

Run logical threads within each CPU block as cooperative user-space fibers scheduled on a single host thread. For cooperative tile primitives, execute the shared operation once per block where possible, avoiding redundant per-fiber dispatch and synchronization while retaining required lane-local work and allocation bookkeeping.

Kernels that omit block_dim or use block_dim=1 should retain their existing behavior and direct-call fast path without fiber overhead.

Multi-core execution across blocks and CPU SIMD/SPMD vectorization are out of scope.

Context

The CPU backend currently forces block_dim to 1, even when a larger value is requested. Tiled kernels can therefore behave differently on CPU and CUDA, leading to invalid tile indexing, incorrect results, or memory corruption.

Providing real CPU block semantics will make tiled kernels portable across backends. Avoiding redundant cooperative-operation dispatch should also improve tile-heavy CPU performance compared with executing those operations from every fiber.

Representative benchmarks should verify the performance improvement and confirm that the block_dim=1 path does not regress.

Metadata

Metadata

Assignees

Labels

feature requestRequest for something to be added

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions