@@ -252,6 +252,11 @@ def affine_expand_index_ops(self):
252252 self .add_pass ("affine-expand-index-ops" )
253253 return self
254254
255+ def affine_expand_index_ops_as_affine (self ):
256+ """Lower affine operations operating on indices into affine.apply operations"""
257+ self .add_pass ("affine-expand-index-ops-as-affine" )
258+ return self
259+
255260 def affine_loop_coalescing (self ):
256261 """Coalesce nested loops with independent bounds into a single loop"""
257262 self .add_pass ("affine-loop-coalescing" )
@@ -1363,10 +1368,6 @@ def convert_func_to_llvm(
13631368 returns are updated accordingly. Block argument types are updated to use
13641369 LLVM IR types.
13651370
1366- Note that until https://github.com/llvm/llvm-project/issues/70982 is resolved,
1367- this pass includes patterns that lower `arith` and `cf` to LLVM. This is legacy
1368- code due to when they were all converted in the same pass.
1369-
13701371 Args:
13711372 use-bare-ptr-memref-call-conv: Replace FuncOp's MemRef arguments with bare pointers to the MemRef element types
13721373 index-bitwidth: Bitwidth of the index type, 0 to use size of machine word
@@ -1398,12 +1399,12 @@ def convert_gpu_launch_to_vulkan_launch(self):
13981399 self .add_pass ("convert-gpu-launch-to-vulkan-launch" )
13991400 return self
14001401
1401- def convert_gpu_to_llvm_spv (self , index_bitwidth : int = None ):
1402+ def convert_gpu_to_llvm_spv (self , use_64bit_index : bool = None ):
14021403 """Generate LLVM operations to be ingested by a SPIR-V backend for gpu operations
14031404 Args:
1404- index-bitwidth: Bitwidth of the index type, 0 to use size of machine word
1405+ use-64bit-index: Use 64-bit integers to convert index types
14051406 """
1406- self .add_pass ("convert-gpu-to-llvm-spv" , index_bitwidth = index_bitwidth )
1407+ self .add_pass ("convert-gpu-to-llvm-spv" , use_64bit_index = use_64bit_index )
14071408 return self
14081409
14091410 def convert_gpu_to_nvvm (
@@ -1597,6 +1598,20 @@ def convert_memref_to_spirv(
15971598 )
15981599 return self
15991600
1601+ def convert_mesh_to_mpi (self ):
1602+ """Convert Mesh dialect to MPI dialect.
1603+
1604+ This pass converts communication operations from the Mesh dialect to the
1605+ MPI dialect.
1606+ If it finds a global named "static_mpi_rank" it will use that splat value
1607+ instead of calling MPI_Comm_rank. This allows optimizations like constant
1608+ shape propagation and fusion because shard/partition sizes depend on the
1609+ rank.
1610+
1611+ """
1612+ self .add_pass ("convert-mesh-to-mpi" )
1613+ return self
1614+
16001615 def convert_nvgpu_to_nvvm (self ):
16011616 """Convert NVGPU dialect to NVVM dialect
16021617
@@ -1715,17 +1730,26 @@ def convert_tensor_to_spirv(self, emulate_lt_32_bit_scalar_types: bool = None):
17151730 )
17161731 return self
17171732
1718- def convert_to_llvm (self , filter_dialects : List [str ] = None ):
1733+ def convert_to_llvm (self , filter_dialects : List [str ] = None , dynamic : bool = None ):
17191734 """Convert to LLVM via dialect interfaces found in the input IR
17201735
17211736 This is a generic pass to convert to LLVM, it uses the
17221737 `ConvertToLLVMPatternInterface` dialect interface to delegate to dialects
17231738 the injection of conversion patterns.
17241739
1740+ If `dynamic` is set to `true`, the pass will look for
1741+ `ConvertToLLVMAttrInterface` attributes and use them to further configure
1742+ the conversion process. This option also uses the `DataLayoutAnalysis`
1743+ analysis to configure the type converter. Enabling this option incurs in
1744+ extra overhead.
1745+
17251746 Args:
17261747 filter-dialects: Test conversion patterns of only the specified dialects
1748+ dynamic: Use op conversion attributes to configure the conversion
17271749 """
1728- self .add_pass ("convert-to-llvm" , filter_dialects = filter_dialects )
1750+ self .add_pass (
1751+ "convert-to-llvm" , filter_dialects = filter_dialects , dynamic = dynamic
1752+ )
17291753 return self
17301754
17311755 def convert_to_spirv (
@@ -2082,23 +2106,6 @@ def finalize_memref_to_llvm(
20822106 )
20832107 return self
20842108
2085- def finalizing_bufferize (self ):
2086- """Finalize a partial bufferization
2087-
2088- A bufferize pass that finalizes a partial bufferization by removing
2089- remaining `bufferization.to_tensor` and `bufferization.to_buffer` operations.
2090-
2091- The removal of those operations is only possible if the operations only
2092- exist in pairs, i.e., all uses of `bufferization.to_tensor` operations are
2093- `bufferization.to_buffer` operations.
2094-
2095- This pass will fail if not all operations can be removed or if any operation
2096- with tensor typed operands remains.
2097-
2098- """
2099- self .add_pass ("finalizing-bufferize" )
2100- return self
2101-
21022109 def fold_memref_alias_ops (self ):
21032110 """Fold memref alias ops into consumer load/store ops
21042111
@@ -2201,6 +2208,7 @@ def gpu_module_to_binary(
22012208 l : List [str ] = None ,
22022209 opts : str = None ,
22032210 format : str = None ,
2211+ section : str = None ,
22042212 ):
22052213 """Transforms a GPU module into a GPU binary.
22062214
@@ -2219,9 +2227,15 @@ def gpu_module_to_binary(
22192227 l: Extra files to link to.
22202228 opts: Command line options to pass to the tools.
22212229 format: The target representation of the compilation process.
2230+ section: ELF section where binary is to be located.
22222231 """
22232232 self .add_pass (
2224- "gpu-module-to-binary" , toolkit = toolkit , l = l , opts = opts , format = format
2233+ "gpu-module-to-binary" ,
2234+ toolkit = toolkit ,
2235+ l = l ,
2236+ opts = opts ,
2237+ format = format ,
2238+ section = section ,
22252239 )
22262240 return self
22272241
@@ -2893,6 +2907,7 @@ def one_shot_bufferize(
28932907 no_analysis_func_filter : List [str ] = None ,
28942908 function_boundary_type_conversion : str = None ,
28952909 must_infer_memory_space : bool = None ,
2910+ use_encoding_for_memory_space : bool = None ,
28962911 test_analysis_only : bool = None ,
28972912 print_conflicts : bool = None ,
28982913 unknown_type_conversion : str = None ,
@@ -3017,6 +3032,7 @@ def one_shot_bufferize(
30173032 no-analysis-func-filter: Skip analysis of functions with these symbol names.Set copyBeforeWrite to true when bufferizing them.
30183033 function-boundary-type-conversion: Controls layout maps when bufferizing function signatures.
30193034 must-infer-memory-space: The memory space of an memref types must always be inferred. If unset, a default memory space of 0 is used otherwise.
3035+ use-encoding-for-memory-space: Use the Tensor encoding attribute for the memory space. Exclusive to the 'must-infer-memory-space' option
30203036 test-analysis-only: Test only: Only run inplaceability analysis and annotate IR
30213037 print-conflicts: Test only: Annotate IR with RaW conflicts. Requires test-analysis-only.
30223038 unknown-type-conversion: Controls layout maps for non-inferrable memref types.
@@ -3036,6 +3052,7 @@ def one_shot_bufferize(
30363052 no_analysis_func_filter = no_analysis_func_filter ,
30373053 function_boundary_type_conversion = function_boundary_type_conversion ,
30383054 must_infer_memory_space = must_infer_memory_space ,
3055+ use_encoding_for_memory_space = use_encoding_for_memory_space ,
30393056 test_analysis_only = test_analysis_only ,
30403057 print_conflicts = print_conflicts ,
30413058 unknown_type_conversion = unknown_type_conversion ,
0 commit comments