Skip to main content
Enigma provides CuTe-style swizzle for threadgroup memory bank conflict avoidance.

enigma.Swizzle(bits, base, shift)

XOR-based address remapping. Apple Silicon threadgroup memory has 32 banks at 4-byte granularity. Transformation: extracts bits bits starting at position shift, XORs them into position base.

enigma.swizzle(layout, bits, base, shift)

Compose a Layout with a Swizzle, returning a SwizzledLayout.

enigma.SwizzledLayout

Behaves like a Layout but applies XOR remapping after coordinate-to-offset computation. Has the same shape, stride, size(), rank() properties as Layout.