IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo module

bit_layout

Defines BitLayout, a layout that is linear over F2.

A layout whose extents are powers of two is linear over F2: each domain bit goes to a fixed set of codomain bits, and a point goes to the XOR of the images of its set bits. Strided modes and swizzles are both linear in this sense, so one BitLayout describes either. Points are UInt64s in whatever encoding the domain and codomain spaces define.

You can import these APIs from the layout.bit_layout module:

from layout.bit_layout import BitLayout, placement

comptime pairs = BitLayout().run(0, 1, 0).run(16, 5, 1)

comptime values​

BIT_LAYOUT_BITS​

comptime BIT_LAYOUT_BITS = 64

The number of domain bits a BitLayout can map.

Structs​

  • ​BitLayout: A linear map over F2: domain bit i goes to img[i].

Functions​

  • ​bit: Returns the point with only bit i set.
  • ​bits: Returns the mask of bits lo through lo + n - 1.
  • ​is_bit_linear: Returns whether a static layout is linear over F2.
  • ​placement: Returns a static layout as a BitLayout from coordinate bits to offset bits.

Was this page helpful?