For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
derive_drain_mask
derive_drain_mask(program: PipelineProgram, config: PipelineConfig) -> Int
Derive per-block lgkm drain mask from block content analysis.
Drains LDS reads (wait_lgkm(0)) before DRAM→LDS writes when a block's fragment loads and global loads target different channels. This avoids LDS port contention between concurrent reads and writes to different LDS regions.
Skips the drain when fragment loads and the global load share the same channel — sequential access to the same LDS region has less contention.
Returns a bitmask where bit i=1 means block i should drain lgkm before its global loads.
Returns:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!