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 function

warpgroup_fence

def warpgroup_fence[accum_type: DType, accum_layout: Layout, //](accum: LayoutTensor[accum_type, accum_layout, address_space=AddressSpace.LOCAL, element_layout=accum.element_layout, layout_int_type=accum.layout_int_type, linear_idx_type=accum.linear_idx_type, masked=accum.masked, alignment=accum.alignment])

Code motion fence to ensure the registers of the WGMMA instruction do not get touched by anything.

This has no impact on kernel correctness. It serves purely as an NVVM code motion barrier, preventing other operations from modifying the WGMMA instruction's registers during execution of the WGMMA instruction batch.

Parameters:

  • ​accum_type (DType): Element data type of the tensor.
  • ​accum_layout (Layout): Register layout of the accumulator.

Args:

def warpgroup_fence[accum_type: DType, //](accum: TileTensor[accum_type, address_space=AddressSpace.LOCAL, linear_idx_type=accum.linear_idx_type]) where (Int(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)))) == Int(2)) if (accum.LayoutType.rank == Int(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))))) else (accum.LayoutType.rank == Int(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(#kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))), [idx: __mlir_type.index] #kgen.param_list.concat(#kgen.param_list.tabulate(len(accum.LayoutType.__shape_types), [idx: __mlir_type.index] accum.LayoutType.__shape_types[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType))[idx]._ParamListType)))))

Fences Hopper WGMMA accumulator registers against code motion.

The pointer walk requires contiguous scalar register storage so every accumulator register receives the code-motion fence exactly once.

Parameters:

  • ​accum_type (DType): Element data type of the accumulator; must be float32.

Args:

Was this page helpful?