1//===-- Passes.td - Conversion pass definition file --------*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef MLIR_CONVERSION_PASSES 10#define MLIR_CONVERSION_PASSES 11 12include "mlir/Pass/PassBase.td" 13 14//===----------------------------------------------------------------------===// 15// AffineToStandard 16//===----------------------------------------------------------------------===// 17 18def ConvertAffineToStandard : Pass<"lower-affine"> { 19 let summary = "Lower Affine operations to a combination of Standard and SCF " 20 "operations"; 21 let description = [{ 22 23 Convert operations from the affine dialect into operations from the SCF and 24 standard dialects. 25 26 `affine.for` operations are converted to `scf.for` operations that are free 27 of certain structural restrictions (on their bounds and step). `affine.if` 28 is similarly converted to the `scf.if` operation. `affine.apply` operations 29 are converted into sequences of primitive arithmetic operations from the 30 standard dialect that have the same effect, using operands of the `index` 31 type. Consequently, named maps and sets thare are no longer in use may be 32 removed from the module. 33 34 For example, `%r = affine.apply affine_map<(d0, d1)[s0] -> (d0 + 2*d1 + 35 s0)>(%d0, %d1)[%s0]` 36 can be converted into: 37 38 ```mlir 39 %d0 = <...> 40 %d1 = <...> 41 %s0 = <...> 42 %0 = constant 2 : index 43 %1 = muli %0, %d1 44 %2 = addi %d0, %1 45 %r = addi %2, %s0 46 ``` 47 48 #### Input invariant 49 50 - no `Tensor` types; 51 52 These restrictions may be lifted in the future. 53 54 #### Output IR 55 56 Functions with `affine.for` and `affine.if` operations eliminated. These 57 functions may contain operations from the Standard dialect in addition to 58 those already present before the pass. 59 60 #### Invariants 61 62 - Functions without a body are not modified. 63 - The semantics of the other functions is preserved. 64 - Individual operations other than those mentioned above are not modified 65 if they do not depend on the loop iterator value or on the result of 66 `affine.apply`. 67 }]; 68 let constructor = "mlir::createLowerAffinePass()"; 69 let dependentDialects = [ 70 "memref::MemRefDialect", 71 "scf::SCFDialect", 72 "StandardOpsDialect", 73 "vector::VectorDialect" 74 ]; 75} 76 77//===----------------------------------------------------------------------===// 78// AsyncToLLVM 79//===----------------------------------------------------------------------===// 80 81def ConvertAsyncToLLVM : Pass<"convert-async-to-llvm", "ModuleOp"> { 82 let summary = "Convert the operations from the async dialect into the LLVM " 83 "dialect"; 84 let description = [{ 85 Convert `async.execute` operations to LLVM coroutines and use async runtime 86 API to execute them. 87 }]; 88 let constructor = "mlir::createConvertAsyncToLLVMPass()"; 89 let dependentDialects = ["LLVM::LLVMDialect"]; 90} 91 92//===----------------------------------------------------------------------===// 93// ComplexToLLVM 94//===----------------------------------------------------------------------===// 95 96def ConvertComplexToLLVM : Pass<"convert-complex-to-llvm", "ModuleOp"> { 97 let summary = "Convert Complex dialect to LLVM dialect"; 98 let constructor = "mlir::createConvertComplexToLLVMPass()"; 99 let dependentDialects = ["LLVM::LLVMDialect"]; 100} 101 102//===----------------------------------------------------------------------===// 103// ComplexToStandard 104//===----------------------------------------------------------------------===// 105 106def ConvertComplexToStandard : FunctionPass<"convert-complex-to-standard"> { 107 let summary = "Convert Complex dialect to standard dialect"; 108 let constructor = "mlir::createConvertComplexToStandardPass()"; 109 let dependentDialects = [ 110 "complex::ComplexDialect", 111 "math::MathDialect", 112 "StandardOpsDialect" 113 ]; 114} 115 116//===----------------------------------------------------------------------===// 117// GPUCommon 118//===----------------------------------------------------------------------===// 119 120def GpuToLLVMConversionPass : Pass<"gpu-to-llvm", "ModuleOp"> { 121 let summary = "Convert GPU dialect to LLVM dialect with GPU runtime calls"; 122 let constructor = "mlir::createGpuToLLVMConversionPass()"; 123 let dependentDialects = ["LLVM::LLVMDialect"]; 124} 125 126def LowerHostCodeToLLVM : Pass<"lower-host-to-llvm", "ModuleOp"> { 127 let summary = "Lowers the host module code and `gpu.launch_func` to LLVM"; 128 let constructor = "mlir::createLowerHostCodeToLLVMPass()"; 129 let dependentDialects = ["LLVM::LLVMDialect"]; 130} 131 132//===----------------------------------------------------------------------===// 133// GPUToNVVM 134//===----------------------------------------------------------------------===// 135 136def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> { 137 let summary = "Generate NVVM operations for gpu operations"; 138 let constructor = "mlir::createLowerGpuOpsToNVVMOpsPass()"; 139 let dependentDialects = ["NVVM::NVVMDialect", "memref::MemRefDialect"]; 140 let options = [ 141 Option<"indexBitwidth", "index-bitwidth", "unsigned", 142 /*default=kDeriveIndexBitwidthFromDataLayout*/"0", 143 "Bitwidth of the index type, 0 to use size of machine word"> 144 ]; 145} 146 147//===----------------------------------------------------------------------===// 148// GPUToROCDL 149//===----------------------------------------------------------------------===// 150 151def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> { 152 let summary = "Generate ROCDL operations for gpu operations"; 153 let constructor = "mlir::createLowerGpuOpsToROCDLOpsPass()"; 154 let dependentDialects = ["ROCDL::ROCDLDialect"]; 155 let options = [ 156 Option<"indexBitwidth", "index-bitwidth", "unsigned", 157 /*default=kDeriveIndexBitwidthFromDataLayout*/"0", 158 "Bitwidth of the index type, 0 to use size of machine word"> 159 ]; 160} 161 162//===----------------------------------------------------------------------===// 163// GPUToSPIRV 164//===----------------------------------------------------------------------===// 165 166def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv", "ModuleOp"> { 167 let summary = "Convert GPU dialect to SPIR-V dialect"; 168 let description = [{ 169 This pass converts supported GPU device ops to SPIR-V ops. It does not 170 handle GPU host ops. 171 172 A `gpu.func` op can have parameters to pass in resources. But in SPIR-V 173 entry functions cannot take parameters; they use descriptors to access 174 resources. By default, parameters to a `gpu.func` op will be converted to 175 global variables. These global variables will be assigned sequential binding 176 numbers following their order in the original `gpu.func` op, starting from 177 0, in set 0. One can attach `spv.interface_var_abi` to those parameters 178 to control the set and binding if wanted. 179 }]; 180 let constructor = "mlir::createConvertGPUToSPIRVPass()"; 181 let dependentDialects = ["spirv::SPIRVDialect"]; 182} 183 184//===----------------------------------------------------------------------===// 185// GPUToVulkan 186//===----------------------------------------------------------------------===// 187 188def ConvertGpuLaunchFuncToVulkanLaunchFunc 189 : Pass<"convert-gpu-launch-to-vulkan-launch", "ModuleOp"> { 190 let summary = "Convert gpu.launch_func to vulkanLaunch external call"; 191 let description = [{ 192 This pass is only intended for the mlir-vulkan-runner. 193 }]; 194 let constructor = "mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass()"; 195 let dependentDialects = ["spirv::SPIRVDialect"]; 196} 197 198def ConvertVulkanLaunchFuncToVulkanCalls 199 : Pass<"launch-func-to-vulkan", "ModuleOp"> { 200 let summary = "Convert vulkanLaunch external call to Vulkan runtime external " 201 "calls"; 202 let description = [{ 203 This pass is only intended for the mlir-vulkan-runner. 204 }]; 205 let constructor = "mlir::createConvertVulkanLaunchFuncToVulkanCallsPass()"; 206 let dependentDialects = ["LLVM::LLVMDialect"]; 207} 208 209//===----------------------------------------------------------------------===// 210// LinalgToLLVM 211//===----------------------------------------------------------------------===// 212 213def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm", "ModuleOp"> { 214 let summary = "Convert the operations from the linalg dialect into the LLVM " 215 "dialect"; 216 let constructor = "mlir::createConvertLinalgToLLVMPass()"; 217 let dependentDialects = ["scf::SCFDialect", "LLVM::LLVMDialect"]; 218} 219 220//===----------------------------------------------------------------------===// 221// LinalgToStandard 222//===----------------------------------------------------------------------===// 223 224def ConvertLinalgToStandard : Pass<"convert-linalg-to-std", "ModuleOp"> { 225 let summary = "Convert the operations from the linalg dialect into the " 226 "Standard dialect"; 227 let constructor = "mlir::createConvertLinalgToStandardPass()"; 228 let dependentDialects = ["memref::MemRefDialect", "StandardOpsDialect"]; 229} 230 231//===----------------------------------------------------------------------===// 232// LinalgToSPIRV 233//===----------------------------------------------------------------------===// 234 235def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv", "ModuleOp"> { 236 let summary = "Convert Linalg dialect to SPIR-V dialect"; 237 let description = [{ 238 This pass converts supported Linalg ops to SPIR-V ops. It's quite 239 experimental and are expected to migrate to other proper conversions. 240 }]; 241 let constructor = "mlir::createLinalgToSPIRVPass()"; 242 let dependentDialects = ["spirv::SPIRVDialect"]; 243} 244 245//===----------------------------------------------------------------------===// 246// MathToLibm 247//===----------------------------------------------------------------------===// 248 249def ConvertMathToLibm : Pass<"convert-math-to-libm", "ModuleOp"> { 250 let summary = "Convert Math dialect to libm calls"; 251 let description = [{ 252 This pass converts supported Math ops to libm calls. 253 }]; 254 let constructor = "mlir::createConvertMathToLibmPass()"; 255 let dependentDialects = ["StandardOpsDialect", "vector::VectorDialect"]; 256} 257 258//===----------------------------------------------------------------------===// 259// MathToLLVM 260//===----------------------------------------------------------------------===// 261 262def ConvertMathToLLVM : FunctionPass<"convert-math-to-llvm"> { 263 let summary = "Convert Math dialect to LLVM dialect"; 264 let description = [{ 265 This pass converts supported Math ops to LLVM dialect intrinsics. 266 }]; 267 let constructor = "mlir::createConvertMathToLLVMPass()"; 268 let dependentDialects = ["LLVM::LLVMDialect"]; 269} 270 271//===----------------------------------------------------------------------===// 272// MemRefToLLVM 273//===----------------------------------------------------------------------===// 274 275def ConvertMemRefToLLVM : Pass<"convert-memref-to-llvm", "ModuleOp"> { 276 let summary = "Convert operations from the MemRef dialect to the LLVM " 277 "dialect"; 278 let constructor = "mlir::createMemRefToLLVMPass()"; 279 let dependentDialects = ["LLVM::LLVMDialect"]; 280 let options = [ 281 Option<"useAlignedAlloc", "use-aligned-alloc", "bool", /*default=*/"false", 282 "Use aligned_alloc in place of malloc for heap allocations">, 283 Option<"indexBitwidth", "index-bitwidth", "unsigned", 284 /*default=kDeriveIndexBitwidthFromDataLayout*/"0", 285 "Bitwidth of the index type, 0 to use size of machine word">, 286 ]; 287} 288 289//===----------------------------------------------------------------------===// 290// OpenACCToSCF 291//===----------------------------------------------------------------------===// 292 293def ConvertOpenACCToSCF : Pass<"convert-openacc-to-scf", "ModuleOp"> { 294 let summary = "Convert the OpenACC ops to OpenACC with SCF dialect"; 295 let constructor = "mlir::createConvertOpenACCToSCFPass()"; 296 let dependentDialects = ["scf::SCFDialect", "acc::OpenACCDialect"]; 297} 298 299//===----------------------------------------------------------------------===// 300// OpenACCToLLVM 301//===----------------------------------------------------------------------===// 302 303def ConvertOpenACCToLLVM : Pass<"convert-openacc-to-llvm", "ModuleOp"> { 304 let summary = "Convert the OpenACC ops to LLVM dialect"; 305 let constructor = "mlir::createConvertOpenACCToLLVMPass()"; 306 let dependentDialects = ["LLVM::LLVMDialect"]; 307} 308 309//===----------------------------------------------------------------------===// 310// OpenMPToLLVM 311//===----------------------------------------------------------------------===// 312 313def ConvertOpenMPToLLVM : Pass<"convert-openmp-to-llvm", "ModuleOp"> { 314 let summary = "Convert the OpenMP ops to OpenMP ops with LLVM dialect"; 315 let constructor = "mlir::createConvertOpenMPToLLVMPass()"; 316 let dependentDialects = ["LLVM::LLVMDialect"]; 317} 318 319//===----------------------------------------------------------------------===// 320// PDLToPDLInterp 321//===----------------------------------------------------------------------===// 322 323def ConvertPDLToPDLInterp : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> { 324 let summary = "Convert PDL ops to PDL interpreter ops"; 325 let constructor = "mlir::createPDLToPDLInterpPass()"; 326 let dependentDialects = ["pdl_interp::PDLInterpDialect"]; 327} 328 329//===----------------------------------------------------------------------===// 330// SCFToOpenMP 331//===----------------------------------------------------------------------===// 332 333def ConvertSCFToOpenMP : FunctionPass<"convert-scf-to-openmp"> { 334 let summary = "Convert SCF parallel loop to OpenMP parallel + workshare " 335 "constructs."; 336 let constructor = "mlir::createConvertSCFToOpenMPPass()"; 337 let dependentDialects = ["omp::OpenMPDialect"]; 338} 339 340//===----------------------------------------------------------------------===// 341// SCFToSPIRV 342//===----------------------------------------------------------------------===// 343 344def SCFToSPIRV : Pass<"convert-scf-to-spirv", "ModuleOp"> { 345 let summary = "Convert SCF dialect to SPIR-V dialect."; 346 let description = [{ 347 This pass converts SCF ops into SPIR-V structured control flow ops. 348 SPIR-V structured control flow ops does not support yielding values. 349 So for SCF ops yielding values, SPIR-V variables are created for 350 holding the values and load/store operations are emitted for updating 351 them. 352 }]; 353 let constructor = "mlir::createConvertSCFToSPIRVPass()"; 354 let dependentDialects = ["spirv::SPIRVDialect"]; 355} 356 357//===----------------------------------------------------------------------===// 358// SCFToStandard 359//===----------------------------------------------------------------------===// 360 361def SCFToStandard : Pass<"convert-scf-to-std"> { 362 let summary = "Convert SCF dialect to Standard dialect, replacing structured" 363 " control flow with a CFG"; 364 let constructor = "mlir::createLowerToCFGPass()"; 365 let dependentDialects = ["StandardOpsDialect"]; 366} 367 368//===----------------------------------------------------------------------===// 369// SCFToGPU 370//===----------------------------------------------------------------------===// 371 372def ConvertAffineForToGPU : FunctionPass<"convert-affine-for-to-gpu"> { 373 let summary = "Convert top-level AffineFor Ops to GPU kernels"; 374 let constructor = "mlir::createAffineForToGPUPass()"; 375 let dependentDialects = ["gpu::GPUDialect"]; 376 let options = [ 377 Option<"numBlockDims", "gpu-block-dims", "unsigned", /*default=*/"1u", 378 "Number of GPU block dimensions for mapping">, 379 Option<"numThreadDims", "gpu-thread-dims", "unsigned", /*default=*/"1u", 380 "Number of GPU thread dimensions for mapping"> 381 ]; 382} 383 384def ConvertParallelLoopToGpu : Pass<"convert-parallel-loops-to-gpu"> { 385 let summary = "Convert mapped scf.parallel ops to gpu launch operations"; 386 let constructor = "mlir::createParallelLoopToGpuPass()"; 387 let dependentDialects = ["AffineDialect", "gpu::GPUDialect"]; 388} 389 390//===----------------------------------------------------------------------===// 391// ShapeToStandard 392//===----------------------------------------------------------------------===// 393 394def ConvertShapeToStandard : Pass<"convert-shape-to-std", "ModuleOp"> { 395 let summary = "Convert operations from the shape dialect into the standard " 396 "dialect"; 397 let constructor = "mlir::createConvertShapeToStandardPass()"; 398 let dependentDialects = [ 399 "StandardOpsDialect", 400 "scf::SCFDialect", 401 "tensor::TensorDialect" 402 ]; 403} 404 405def ConvertShapeConstraints: Pass<"convert-shape-constraints", "FuncOp"> { 406 let summary = "Convert shape constraint operations to the standard dialect"; 407 let description = [{ 408 This pass eliminates shape constraints from the program, converting them to 409 eager (side-effecting) error handling code. 410 411 This pass is separate from the regular convert-shape-to-standard, despite 412 converting between the same dialects, because converting shape constraints 413 can happen at a different part of the program than general shape 414 computation lowering. 415 }]; 416 let constructor = "mlir::createConvertShapeConstraintsPass()"; 417 let dependentDialects = ["StandardOpsDialect", "scf::SCFDialect"]; 418} 419 420//===----------------------------------------------------------------------===// 421// SPIRVToLLVM 422//===----------------------------------------------------------------------===// 423 424def ConvertSPIRVToLLVM : Pass<"convert-spirv-to-llvm", "ModuleOp"> { 425 let summary = "Convert SPIR-V dialect to LLVM dialect"; 426 let description = [{ 427 See https://mlir.llvm.org/docs/SPIRVToLLVMDialectConversion/ 428 for more details. 429 }]; 430 let constructor = "mlir::createConvertSPIRVToLLVMPass()"; 431 let dependentDialects = ["LLVM::LLVMDialect"]; 432} 433 434//===----------------------------------------------------------------------===// 435// StandardToLLVM 436//===----------------------------------------------------------------------===// 437 438def ConvertStandardToLLVM : Pass<"convert-std-to-llvm", "ModuleOp"> { 439 let summary = "Convert scalar and vector operations from the Standard to the " 440 "LLVM dialect"; 441 let description = [{ 442 Convert standard operations into the LLVM IR dialect operations. 443 444 #### Input invariant 445 446 - operations including: arithmetic on integers and floats, constants, 447 direct calls, returns and branches; 448 - no `tensor` types; 449 - all `vector` are one-dimensional; 450 - all blocks are reachable by following the successors of the first basic 451 block; 452 453 If other operations are present and their results are required by the LLVM 454 IR dialect operations, the pass will fail. Any LLVM IR operations or types 455 already present in the IR will be kept as is. 456 457 #### Output IR 458 459 Functions converted to LLVM IR. Function arguments types are converted 460 one-to-one. Function results are converted one-to-one and, in case more than 461 1 value is returned, packed into an LLVM IR struct type. Function calls and 462 returns are updated accordingly. Block argument types are updated to use 463 LLVM IR types. 464 }]; 465 let constructor = "mlir::createLowerToLLVMPass()"; 466 let dependentDialects = ["LLVM::LLVMDialect"]; 467 let options = [ 468 Option<"useBarePtrCallConv", "use-bare-ptr-memref-call-conv", "bool", 469 /*default=*/"false", 470 "Replace FuncOp's MemRef arguments with bare pointers to the MemRef " 471 "element types">, 472 Option<"emitCWrappers", "emit-c-wrappers", "bool", /*default=*/"false", 473 "Emit wrappers for C-compatible pointer-to-struct memref " 474 "descriptors">, 475 Option<"indexBitwidth", "index-bitwidth", "unsigned", 476 /*default=kDeriveIndexBitwidthFromDataLayout*/"0", 477 "Bitwidth of the index type, 0 to use size of machine word">, 478 Option<"dataLayout", "data-layout", "std::string", 479 /*default=*/"\"\"", 480 "String description (LLVM format) of the data layout that is " 481 "expected on the produced module"> 482 ]; 483} 484 485//===----------------------------------------------------------------------===// 486// StandardToSPIRV 487//===----------------------------------------------------------------------===// 488 489def ConvertStandardToSPIRV : Pass<"convert-std-to-spirv", "ModuleOp"> { 490 let summary = "Convert Standard dialect to SPIR-V dialect"; 491 let constructor = "mlir::createConvertStandardToSPIRVPass()"; 492 let dependentDialects = ["spirv::SPIRVDialect"]; 493 let options = [ 494 Option<"emulateNon32BitScalarTypes", "emulate-non-32-bit-scalar-types", 495 "bool", /*default=*/"true", 496 "Emulate non-32-bit scalar types with 32-bit ones if " 497 "missing native support"> 498 ]; 499} 500 501//===----------------------------------------------------------------------===// 502// TosaToLinalg 503//===----------------------------------------------------------------------===// 504 505def TosaToLinalgOnTensors : FunctionPass<"tosa-to-linalg-on-tensors"> { 506 let summary = "Lower TOSA to LinAlg on tensors"; 507 let description = [{ 508 Pass that converts TOSA operations to the equivalent operations using the 509 tensor operations in LinAlg. 510 }]; 511 512 let constructor = "tosa::createTosaToLinalgOnTensors()"; 513} 514 515//===----------------------------------------------------------------------===// 516// TosaToSCF 517//===----------------------------------------------------------------------===// 518 519def TosaToSCF : Pass<"tosa-to-scf"> { 520 let summary = "Lower TOSA to the SCF dialect"; 521 let dependentDialects = ["tensor::TensorDialect, scf::SCFDialect"]; 522 let description = [{ 523 Pass that converts TOSA's control flow operations to the equivalent SCF 524 operations. 525 }]; 526 527 let constructor = "tosa::createTosaToSCF()"; 528} 529 530//===----------------------------------------------------------------------===// 531// TosaToStandard 532//===----------------------------------------------------------------------===// 533 534def TosaToStandard : Pass<"tosa-to-standard"> { 535 let summary = "Lower TOSA to the Standard dialect"; 536 let dependentDialects = ["StandardOpsDialect", "tensor::TensorDialect"]; 537 let description = [{ 538 Pass that converts TOSA operations to the equivalent operations using the 539 operations in the Standard dialect. 540 }]; 541 542 let constructor = "tosa::createTosaToStandard()"; 543} 544 545//===----------------------------------------------------------------------===// 546// VectorToGPU 547//===----------------------------------------------------------------------===// 548 549def ConvertVectorToGPU : FunctionPass<"convert-vector-to-gpu"> { 550 let summary = "Lower the operations from the vector dialect into the GPU " 551 "dialect"; 552 let constructor = "mlir::createConvertVectorToGPUPass()"; 553 let dependentDialects = [ 554 "memref::MemRefDialect", 555 "gpu::GPUDialect" 556 ]; 557} 558 559//===----------------------------------------------------------------------===// 560// VectorToSCF 561//===----------------------------------------------------------------------===// 562 563def ConvertVectorToSCF : FunctionPass<"convert-vector-to-scf"> { 564 let summary = "Lower the operations from the vector dialect into the SCF " 565 "dialect"; 566 let constructor = "mlir::createConvertVectorToSCFPass()"; 567 let dependentDialects = [ 568 "AffineDialect", 569 "memref::MemRefDialect", 570 "scf::SCFDialect" 571 ]; 572 let options = [ 573 Option<"fullUnroll", "full-unroll", "bool", /*default=*/"false", 574 "Perform full unrolling when converting vector transfers to SCF">, 575 Option<"targetRank", "target-rank", "unsigned", /*default=*/"1", 576 "Target vector rank to which transfer ops should be lowered">, 577 Option<"lowerPermutationMaps", "lower-permutation-maps", "bool", 578 /*default=*/"false", "Replace permutation maps with vector " 579 "transposes/broadcasts before lowering transfer ops">, 580 Option<"lowerTensors", "lower-tensors", "bool", /*default=*/"false", 581 "Lower transfer ops that operate on tensors"> 582 ]; 583} 584 585//===----------------------------------------------------------------------===// 586// VectorToLLVM 587//===----------------------------------------------------------------------===// 588 589def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm", "ModuleOp"> { 590 let summary = "Lower the operations from the vector dialect into the LLVM " 591 "dialect"; 592 let description = [{ 593 594 Convert operations from the vector dialect into the LLVM IR dialect 595 operations. The lowering pass provides several options to control 596 the kinds of optimizations that are allowed. It also provides options 597 that enable the use of one or more architectural-specific dialects 598 (AMX, X86Vector, ArmNeon, ArmSVE, etc.) in combination with the 599 architectural-neutral vector dialect lowering. 600 601 }]; 602 let constructor = "mlir::createConvertVectorToLLVMPass()"; 603 // Override explicitly in C++ to allow conditional dialect dependence. 604 // let dependentDialects; 605 let options = [ 606 Option<"reassociateFPReductions", "reassociate-fp-reductions", 607 "bool", /*default=*/"false", 608 "Allows llvm to reassociate floating-point reductions for speed">, 609 Option<"enableIndexOptimizations", "enable-index-optimizations", 610 "bool", /*default=*/"true", 611 "Allows compiler to assume indices fit in 32-bit if that yields " 612 "faster code">, 613 Option<"enableAMX", "enable-amx", 614 "bool", /*default=*/"false", 615 "Enables the use of AMX dialect while lowering the vector " 616 "dialect.">, 617 Option<"enableArmNeon", "enable-arm-neon", 618 "bool", /*default=*/"false", 619 "Enables the use of ArmNeon dialect while lowering the vector " 620 "dialect.">, 621 Option<"enableArmSVE", "enable-arm-sve", 622 "bool", /*default=*/"false", 623 "Enables the use of ArmSVE dialect while lowering the vector " 624 "dialect.">, 625 Option<"enableX86Vector", "enable-x86vector", 626 "bool", /*default=*/"false", 627 "Enables the use of X86Vector dialect while lowering the vector " 628 "dialect."> 629 ]; 630} 631 632//===----------------------------------------------------------------------===// 633// VectorToROCDL 634//===----------------------------------------------------------------------===// 635 636def ConvertVectorToROCDL : Pass<"convert-vector-to-rocdl", "ModuleOp"> { 637 let summary = "Lower the operations from the vector dialect into the ROCDL " 638 "dialect"; 639 let constructor = "mlir::createConvertVectorToROCDLPass()"; 640 let dependentDialects = ["ROCDL::ROCDLDialect"]; 641} 642 643//===----------------------------------------------------------------------===// 644// VectorToSPIRV 645//===----------------------------------------------------------------------===// 646 647def ConvertVectorToSPIRV : Pass<"convert-vector-to-spirv", "ModuleOp"> { 648 let summary = "Convert Vector dialect to SPIR-V dialect"; 649 let constructor = "mlir::createConvertVectorToSPIRVPass()"; 650 let dependentDialects = ["spirv::SPIRVDialect"]; 651} 652 653//===----------------------------------------------------------------------===// 654// ArmNeon2dToIntr 655//===----------------------------------------------------------------------===// 656 657def ConvertArmNeon2dToIntr : Pass<"arm-neon-2d-to-intr", "FuncOp"> { 658 let summary = "Convert Arm NEON structured ops to intrinsics"; 659 let constructor = "mlir::createConvertArmNeon2dToIntrPass()"; 660 let dependentDialects = ["arm_neon::ArmNeonDialect", "vector::VectorDialect"]; 661} 662 663 664#endif // MLIR_CONVERSION_PASSES 665