1//===-- SPIRVNonUniformOps.td - MLIR SPIR-V NonUniform Ops -*- 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// This file contains non-uniform ops for the SPIR-V dialect. It corresponds to 10// "3.32.24. Non-Uniform Instructions" of the SPIR-V specification. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef SPIRV_NON_UNIFORM_OPS 15#define SPIRV_NON_UNIFORM_OPS 16 17class SPV_GroupNonUniformArithmeticOp<string mnemonic, Type type, 18 list<OpTrait> traits = []> : SPV_Op<mnemonic, traits> { 19 20 let availability = [ 21 MinVersion<SPV_V_1_3>, 22 MaxVersion<SPV_V_1_5>, 23 Extension<[]>, 24 Capability<[SPV_C_GroupNonUniformArithmetic, 25 SPV_C_GroupNonUniformClustered, 26 SPV_C_GroupNonUniformPartitionedNV]> 27 ]; 28 29 let arguments = (ins 30 SPV_ScopeAttr:$execution_scope, 31 SPV_GroupOperationAttr:$group_operation, 32 SPV_ScalarOrVectorOf<type>:$value, 33 Optional<SPV_Integer>:$cluster_size 34 ); 35 36 let results = (outs 37 SPV_ScalarOrVectorOf<type>:$result 38 ); 39 40 let parser = [{ return parseGroupNonUniformArithmeticOp(parser, result); }]; 41 let printer = [{ printGroupNonUniformArithmeticOp(getOperation(), p); }]; 42 let verifier = [{ return ::verifyGroupNonUniformArithmeticOp(getOperation()); }]; 43 44} 45 46// ----- 47 48def SPV_GroupNonUniformBallotOp : SPV_Op<"GroupNonUniformBallot", []> { 49 let summary = [{ 50 Returns a bitfield value combining the Predicate value from all 51 invocations in the group that execute the same dynamic instance of this 52 instruction. The bit is set to one if the corresponding invocation is 53 active and the Predicate for that invocation evaluated to true; 54 otherwise, it is set to zero. 55 }]; 56 57 let description = [{ 58 Result Type must be a vector of four components of integer type scalar, 59 whose Signedness operand is 0. 60 61 Result is a set of bitfields where the first invocation is represented 62 in the lowest bit of the first vector component and the last (up to the 63 size of the group) is the higher bit number of the last bitmask needed 64 to represent all bits of the group invocations. 65 66 Execution must be Workgroup or Subgroup Scope. 67 68 Predicate must be a Boolean type. 69 70 <!-- End of AutoGen section --> 71 72 ``` 73 scope ::= `"Workgroup"` | `"Subgroup"` 74 non-uniform-ballot-op ::= ssa-id `=` `spv.GroupNonUniformBallot` scope 75 ssa-use `:` `vector` `<` 4 `x` `integer-type` `>` 76 ``` 77 78 #### Example: 79 80 ```mlir 81 %0 = spv.GroupNonUniformBallot "SubGroup" %predicate : vector<4xi32> 82 ``` 83 }]; 84 85 let availability = [ 86 MinVersion<SPV_V_1_3>, 87 MaxVersion<SPV_V_1_5>, 88 Extension<[]>, 89 Capability<[SPV_C_GroupNonUniformBallot]> 90 ]; 91 92 let arguments = (ins 93 SPV_ScopeAttr:$execution_scope, 94 SPV_Bool:$predicate 95 ); 96 97 let results = (outs 98 SPV_IOrUIVec4:$result 99 ); 100 101 let assemblyFormat = [{ 102 $execution_scope $predicate attr-dict `:` type($result) 103 }]; 104} 105 106// ----- 107 108def SPV_GroupNonUniformBroadcastOp : SPV_Op<"GroupNonUniformBroadcast", 109 [NoSideEffect, AllTypesMatch<["value", "result"]>]> { 110 let summary = [{ 111 Return the Value of the invocation identified by the id Id to all active 112 invocations in the group. 113 }]; 114 115 let description = [{ 116 Result Type must be a scalar or vector of floating-point type, integer 117 type, or Boolean type. 118 119 Execution must be Workgroup or Subgroup Scope. 120 121 The type of Value must be the same as Result Type. 122 123 Id must be a scalar of integer type, whose Signedness operand is 0. 124 125 Before version 1.5, Id must come from a constant instruction. Starting 126 with version 1.5, Id must be dynamically uniform. 127 128 The resulting value is undefined if Id is an inactive invocation, or is 129 greater than or equal to the size of the group. 130 131 <!-- End of AutoGen section --> 132 133 ``` 134 scope ::= `"Workgroup"` | `"Subgroup"` 135 integer-float-scalar-vector-type ::= integer-type | float-type | 136 `vector<` integer-literal `x` integer-type `>` | 137 `vector<` integer-literal `x` float-type `>` 138 group-non-uniform-broadcast-op ::= ssa-id `=` 139 `spv.GroupNonUniformBroadcast` scope ssa_use, 140 ssa_use `:` integer-float-scalar-vector-type `,` integer-type 141 ```mlir 142 143 #### Example: 144 145 ``` 146 %scalar_value = ... : f32 147 %vector_value = ... : vector<4xf32> 148 %id = ... : i32 149 %0 = spv.GroupNonUniformBroadcast "Subgroup" %scalar_value, %id : f32, i32 150 %1 = spv.GroupNonUniformBroadcast "Workgroup" %vector_value, %id : 151 vector<4xf32>, i32 152 ``` 153 }]; 154 155 let availability = [ 156 MinVersion<SPV_V_1_3>, 157 MaxVersion<SPV_V_1_5>, 158 Extension<[]>, 159 Capability<[SPV_C_GroupNonUniformBallot]> 160 ]; 161 162 let arguments = (ins 163 SPV_ScopeAttr:$execution_scope, 164 SPV_Type:$value, 165 SPV_Integer:$id 166 ); 167 168 let results = (outs 169 SPV_Type:$result 170 ); 171 172 let assemblyFormat = [{ 173 $execution_scope operands attr-dict `:` type($value) `,` type($id) 174 }]; 175} 176 177// ----- 178 179def SPV_GroupNonUniformElectOp : SPV_Op<"GroupNonUniformElect", []> { 180 let summary = [{ 181 Result is true only in the active invocation with the lowest id in the 182 group, otherwise result is false. 183 }]; 184 185 let description = [{ 186 Result Type must be a Boolean type. 187 188 Execution must be Workgroup or Subgroup Scope. 189 190 <!-- End of AutoGen section --> 191 192 ``` 193 scope ::= `"Workgroup"` | `"Subgroup"` 194 non-uniform-elect-op ::= ssa-id `=` `spv.GroupNonUniformElect` scope 195 `:` `i1` 196 ``` 197 198 #### Example: 199 200 ```mlir 201 %0 = spv.GroupNonUniformElect : i1 202 ``` 203 }]; 204 205 let availability = [ 206 MinVersion<SPV_V_1_3>, 207 MaxVersion<SPV_V_1_5>, 208 Extension<[]>, 209 Capability<[SPV_C_GroupNonUniform]> 210 ]; 211 212 let arguments = (ins 213 SPV_ScopeAttr:$execution_scope 214 ); 215 216 let results = (outs 217 SPV_Bool:$result 218 ); 219 220 let builders = [OpBuilderDAG<(ins "spirv::Scope")>]; 221 222 let assemblyFormat = "$execution_scope attr-dict `:` type($result)"; 223} 224 225// ----- 226 227def SPV_GroupNonUniformFAddOp : 228 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformFAdd", SPV_Float, []> { 229 let summary = [{ 230 A floating point add group operation of all Value operands contributed 231 by active invocations in the group. 232 }]; 233 234 let description = [{ 235 Result Type must be a scalar or vector of floating-point type. 236 237 Execution must be Workgroup or Subgroup Scope. 238 239 The identity I for Operation is 0. If Operation is ClusteredReduce, 240 ClusterSize must be specified. 241 242 The type of Value must be the same as Result Type. The method used to 243 perform the group operation on the contributed Value(s) from active 244 invocations is implementation defined. 245 246 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 247 of integer type, whose Signedness operand is 0. ClusterSize must come 248 from a constant instruction. ClusterSize must be at least 1, and must be 249 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 250 executing this instruction results in undefined behavior. 251 252 <!-- End of AutoGen section --> 253 254 ``` 255 scope ::= `"Workgroup"` | `"Subgroup"` 256 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 257 float-scalar-vector-type ::= float-type | 258 `vector<` integer-literal `x` float-type `>` 259 non-uniform-fadd-op ::= ssa-id `=` `spv.GroupNonUniformFAdd` scope operation 260 ssa-use ( `cluster_size` `(` ssa_use `)` )? 261 `:` float-scalar-vector-type 262 ``` 263 264 #### Example: 265 266 ```mlir 267 %four = spv.constant 4 : i32 268 %scalar = ... : f32 269 %vector = ... : vector<4xf32> 270 %0 = spv.GroupNonUniformFAdd "Workgroup" "Reduce" %scalar : f32 271 %1 = spv.GroupNonUniformFAdd "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xf32> 272 ``` 273 }]; 274} 275 276// ----- 277 278def SPV_GroupNonUniformFMaxOp : 279 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformFMax", SPV_Float, []> { 280 let summary = [{ 281 A floating point maximum group operation of all Value operands 282 contributed by active invocations in by group. 283 }]; 284 285 let description = [{ 286 Result Type must be a scalar or vector of floating-point type. 287 288 Execution must be Workgroup or Subgroup Scope. 289 290 The identity I for Operation is -INF. If Operation is ClusteredReduce, 291 ClusterSize must be specified. 292 293 The type of Value must be the same as Result Type. The method used to 294 perform the group operation on the contributed Value(s) from active 295 invocations is implementation defined. From the set of Value(s) provided 296 by active invocations within a subgroup, if for any two Values one of 297 them is a NaN, the other is chosen. If all Value(s) that are used by the 298 current invocation are NaN, then the result is an undefined value. 299 300 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 301 of integer type, whose Signedness operand is 0. ClusterSize must come 302 from a constant instruction. ClusterSize must be at least 1, and must be 303 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 304 executing this instruction results in undefined behavior. 305 306 <!-- End of AutoGen section --> 307 308 ``` 309 scope ::= `"Workgroup"` | `"Subgroup"` 310 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 311 float-scalar-vector-type ::= float-type | 312 `vector<` integer-literal `x` float-type `>` 313 non-uniform-fmax-op ::= ssa-id `=` `spv.GroupNonUniformFMax` scope operation 314 ssa-use ( `cluster_size` `(` ssa_use `)` )? 315 `:` float-scalar-vector-type 316 ``` 317 318 #### Example: 319 320 ```mlir 321 %four = spv.constant 4 : i32 322 %scalar = ... : f32 323 %vector = ... : vector<4xf32> 324 %0 = spv.GroupNonUniformFMax "Workgroup" "Reduce" %scalar : f32 325 %1 = spv.GroupNonUniformFMax "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xf32> 326 ``` 327 }]; 328} 329 330// ----- 331 332def SPV_GroupNonUniformFMinOp : 333 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformFMin", SPV_Float, []> { 334 let summary = [{ 335 A floating point minimum group operation of all Value operands 336 contributed by active invocations in the group. 337 }]; 338 339 let description = [{ 340 Result Type must be a scalar or vector of floating-point type. 341 342 Execution must be Workgroup or Subgroup Scope. 343 344 The identity I for Operation is +INF. If Operation is ClusteredReduce, 345 ClusterSize must be specified. 346 347 The type of Value must be the same as Result Type. The method used to 348 perform the group operation on the contributed Value(s) from active 349 invocations is implementation defined. From the set of Value(s) provided 350 by active invocations within a subgroup, if for any two Values one of 351 them is a NaN, the other is chosen. If all Value(s) that are used by the 352 current invocation are NaN, then the result is an undefined value. 353 354 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 355 of integer type, whose Signedness operand is 0. ClusterSize must come 356 from a constant instruction. ClusterSize must be at least 1, and must be 357 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 358 executing this instruction results in undefined behavior. 359 360 <!-- End of AutoGen section --> 361 362 ``` 363 scope ::= `"Workgroup"` | `"Subgroup"` 364 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 365 float-scalar-vector-type ::= float-type | 366 `vector<` integer-literal `x` float-type `>` 367 non-uniform-fmin-op ::= ssa-id `=` `spv.GroupNonUniformFMin` scope operation 368 ssa-use ( `cluster_size` `(` ssa_use `)` )? 369 `:` float-scalar-vector-type 370 ``` 371 372 #### Example: 373 374 ```mlir 375 %four = spv.constant 4 : i32 376 %scalar = ... : f32 377 %vector = ... : vector<4xf32> 378 %0 = spv.GroupNonUniformFMin "Workgroup" "Reduce" %scalar : f32 379 %1 = spv.GroupNonUniformFMin "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xf32> 380 ``` 381 }]; 382} 383 384// ----- 385 386def SPV_GroupNonUniformFMulOp : 387 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformFMul", SPV_Float, []> { 388 let summary = [{ 389 A floating point multiply group operation of all Value operands 390 contributed by active invocations in the group. 391 }]; 392 393 let description = [{ 394 Result Type must be a scalar or vector of floating-point type. 395 396 Execution must be Workgroup or Subgroup Scope. 397 398 The identity I for Operation is 1. If Operation is ClusteredReduce, 399 ClusterSize must be specified. 400 401 The type of Value must be the same as Result Type. The method used to 402 perform the group operation on the contributed Value(s) from active 403 invocations is implementation defined. 404 405 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 406 of integer type, whose Signedness operand is 0. ClusterSize must come 407 from a constant instruction. ClusterSize must be at least 1, and must be 408 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 409 executing this instruction results in undefined behavior. 410 411 <!-- End of AutoGen section --> 412 413 ``` 414 scope ::= `"Workgroup"` | `"Subgroup"` 415 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 416 float-scalar-vector-type ::= float-type | 417 `vector<` integer-literal `x` float-type `>` 418 non-uniform-fmul-op ::= ssa-id `=` `spv.GroupNonUniformFMul` scope operation 419 ssa-use ( `cluster_size` `(` ssa_use `)` )? 420 `:` float-scalar-vector-type 421 ``` 422 423 #### Example: 424 425 ```mlir 426 %four = spv.constant 4 : i32 427 %scalar = ... : f32 428 %vector = ... : vector<4xf32> 429 %0 = spv.GroupNonUniformFMul "Workgroup" "Reduce" %scalar : f32 430 %1 = spv.GroupNonUniformFMul "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xf32> 431 ``` 432 }]; 433} 434 435// ----- 436 437def SPV_GroupNonUniformIAddOp : 438 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformIAdd", SPV_Integer, []> { 439 let summary = [{ 440 An integer add group operation of all Value operands contributed by 441 active invocations in the group. 442 }]; 443 444 let description = [{ 445 Result Type must be a scalar or vector of integer type. 446 447 Execution must be Workgroup or Subgroup Scope. 448 449 The identity I for Operation is 0. If Operation is ClusteredReduce, 450 ClusterSize must be specified. 451 452 The type of Value must be the same as Result Type. 453 454 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 455 of integer type, whose Signedness operand is 0. ClusterSize must come 456 from a constant instruction. ClusterSize must be at least 1, and must be 457 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 458 executing this instruction results in undefined behavior. 459 460 <!-- End of AutoGen section --> 461 462 ``` 463 scope ::= `"Workgroup"` | `"Subgroup"` 464 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 465 integer-scalar-vector-type ::= integer-type | 466 `vector<` integer-literal `x` integer-type `>` 467 non-uniform-iadd-op ::= ssa-id `=` `spv.GroupNonUniformIAdd` scope operation 468 ssa-use ( `cluster_size` `(` ssa_use `)` )? 469 `:` integer-scalar-vector-type 470 ``` 471 472 #### Example: 473 474 ```mlir 475 %four = spv.constant 4 : i32 476 %scalar = ... : i32 477 %vector = ... : vector<4xi32> 478 %0 = spv.GroupNonUniformIAdd "Workgroup" "Reduce" %scalar : i32 479 %1 = spv.GroupNonUniformIAdd "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xi32> 480 ``` 481 }]; 482} 483 484// ----- 485 486def SPV_GroupNonUniformIMulOp : 487 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformIMul", SPV_Integer, []> { 488 let summary = [{ 489 An integer multiply group operation of all Value operands contributed by 490 active invocations in the group. 491 }]; 492 493 let description = [{ 494 Result Type must be a scalar or vector of integer type. 495 496 Execution must be Workgroup or Subgroup Scope. 497 498 The identity I for Operation is 1. If Operation is ClusteredReduce, 499 ClusterSize must be specified. 500 501 The type of Value must be the same as Result Type. 502 503 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 504 of integer type, whose Signedness operand is 0. ClusterSize must come 505 from a constant instruction. ClusterSize must be at least 1, and must be 506 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 507 executing this instruction results in undefined behavior. 508 509 <!-- End of AutoGen section --> 510 511 ``` 512 scope ::= `"Workgroup"` | `"Subgroup"` 513 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 514 integer-scalar-vector-type ::= integer-type | 515 `vector<` integer-literal `x` integer-type `>` 516 non-uniform-imul-op ::= ssa-id `=` `spv.GroupNonUniformIMul` scope operation 517 ssa-use ( `cluster_size` `(` ssa_use `)` )? 518 `:` integer-scalar-vector-type 519 ``` 520 521 #### Example: 522 523 ```mlir 524 %four = spv.constant 4 : i32 525 %scalar = ... : i32 526 %vector = ... : vector<4xi32> 527 %0 = spv.GroupNonUniformIMul "Workgroup" "Reduce" %scalar : i32 528 %1 = spv.GroupNonUniformIMul "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xi32> 529 ``` 530 }]; 531} 532 533// ----- 534 535def SPV_GroupNonUniformSMaxOp : 536 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformSMax", SPV_Integer, []> { 537 let summary = [{ 538 A signed integer maximum group operation of all Value operands 539 contributed by active invocations in the group. 540 }]; 541 542 let description = [{ 543 Result Type must be a scalar or vector of integer type. 544 545 Execution must be Workgroup or Subgroup Scope. 546 547 The identity I for Operation is INT_MIN. If Operation is 548 ClusteredReduce, ClusterSize must be specified. 549 550 The type of Value must be the same as Result Type. 551 552 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 553 of integer type, whose Signedness operand is 0. ClusterSize must come 554 from a constant instruction. ClusterSize must be at least 1, and must be 555 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 556 executing this instruction results in undefined behavior. 557 558 <!-- End of AutoGen section --> 559 560 ``` 561 scope ::= `"Workgroup"` | `"Subgroup"` 562 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 563 integer-scalar-vector-type ::= integer-type | 564 `vector<` integer-literal `x` integer-type `>` 565 non-uniform-smax-op ::= ssa-id `=` `spv.GroupNonUniformSMax` scope operation 566 ssa-use ( `cluster_size` `(` ssa_use `)` )? 567 `:` integer-scalar-vector-type 568 ``` 569 570 #### Example: 571 572 ```mlir 573 %four = spv.constant 4 : i32 574 %scalar = ... : i32 575 %vector = ... : vector<4xi32> 576 %0 = spv.GroupNonUniformSMax "Workgroup" "Reduce" %scalar : i32 577 %1 = spv.GroupNonUniformSMax "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xi32> 578 ``` 579 }]; 580} 581 582// ----- 583 584def SPV_GroupNonUniformSMinOp : 585 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformSMin", SPV_Integer, []> { 586 let summary = [{ 587 A signed integer minimum group operation of all Value operands 588 contributed by active invocations in the group. 589 }]; 590 591 let description = [{ 592 Result Type must be a scalar or vector of integer type. 593 594 Execution must be Workgroup or Subgroup Scope. 595 596 The identity I for Operation is INT_MAX. If Operation is 597 ClusteredReduce, ClusterSize must be specified. 598 599 The type of Value must be the same as Result Type. 600 601 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 602 of integer type, whose Signedness operand is 0. ClusterSize must come 603 from a constant instruction. ClusterSize must be at least 1, and must be 604 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 605 executing this instruction results in undefined behavior. 606 607 <!-- End of AutoGen section --> 608 609 ``` 610 scope ::= `"Workgroup"` | `"Subgroup"` 611 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 612 integer-scalar-vector-type ::= integer-type | 613 `vector<` integer-literal `x` integer-type `>` 614 non-uniform-smin-op ::= ssa-id `=` `spv.GroupNonUniformSMin` scope operation 615 ssa-use ( `cluster_size` `(` ssa_use `)` )? 616 `:` integer-scalar-vector-type 617 ``` 618 619 #### Example: 620 621 ```mlir 622 %four = spv.constant 4 : i32 623 %scalar = ... : i32 624 %vector = ... : vector<4xi32> 625 %0 = spv.GroupNonUniformSMin "Workgroup" "Reduce" %scalar : i32 626 %1 = spv.GroupNonUniformSMin "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xi32> 627 ``` 628 }]; 629} 630 631// ----- 632 633def SPV_GroupNonUniformUMaxOp : 634 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformUMax", SPV_Integer, []> { 635 let summary = [{ 636 An unsigned integer maximum group operation of all Value operands 637 contributed by active invocations in the group. 638 }]; 639 640 let description = [{ 641 Result Type must be a scalar or vector of integer type, whose 642 Signedness operand is 0. 643 644 Execution must be Workgroup or Subgroup Scope. 645 646 The identity I for Operation is 0. If Operation is ClusteredReduce, 647 ClusterSize must be specified. 648 649 The type of Value must be the same as Result Type. 650 651 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 652 of integer type, whose Signedness operand is 0. ClusterSize must come 653 from a constant instruction. ClusterSize must be at least 1, and must be 654 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 655 executing this instruction results in undefined behavior. 656 657 <!-- End of AutoGen section --> 658 659 ``` 660 scope ::= `"Workgroup"` | `"Subgroup"` 661 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 662 integer-scalar-vector-type ::= integer-type | 663 `vector<` integer-literal `x` integer-type `>` 664 non-uniform-umax-op ::= ssa-id `=` `spv.GroupNonUniformUMax` scope operation 665 ssa-use ( `cluster_size` `(` ssa_use `)` )? 666 `:` integer-scalar-vector-type 667 ``` 668 669 #### Example: 670 671 ```mlir 672 %four = spv.constant 4 : i32 673 %scalar = ... : i32 674 %vector = ... : vector<4xi32> 675 %0 = spv.GroupNonUniformUMax "Workgroup" "Reduce" %scalar : i32 676 %1 = spv.GroupNonUniformUMax "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xi32> 677 ``` 678 }]; 679} 680 681// ----- 682 683def SPV_GroupNonUniformUMinOp : 684 SPV_GroupNonUniformArithmeticOp<"GroupNonUniformUMin", SPV_Integer, []> { 685 let summary = [{ 686 An unsigned integer minimum group operation of all Value operands 687 contributed by active invocations in the group. 688 }]; 689 690 let description = [{ 691 Result Type must be a scalar or vector of integer type, whose 692 Signedness operand is 0. 693 694 Execution must be Workgroup or Subgroup Scope. 695 696 The identity I for Operation is UINT_MAX. If Operation is 697 ClusteredReduce, ClusterSize must be specified. 698 699 The type of Value must be the same as Result Type. 700 701 ClusterSize is the size of cluster to use. ClusterSize must be a scalar 702 of integer type, whose Signedness operand is 0. ClusterSize must come 703 from a constant instruction. ClusterSize must be at least 1, and must be 704 a power of 2. If ClusterSize is greater than the declared SubGroupSize, 705 executing this instruction results in undefined behavior. 706 707 <!-- End of AutoGen section --> 708 709 ``` 710 scope ::= `"Workgroup"` | `"Subgroup"` 711 operation ::= `"Reduce"` | `"InclusiveScan"` | `"ExclusiveScan"` | ... 712 integer-scalar-vector-type ::= integer-type | 713 `vector<` integer-literal `x` integer-type `>` 714 non-uniform-umin-op ::= ssa-id `=` `spv.GroupNonUniformUMin` scope operation 715 ssa-use ( `cluster_size` `(` ssa_use `)` )? 716 `:` integer-scalar-vector-type 717 ``` 718 719 #### Example: 720 721 ```mlir 722 %four = spv.constant 4 : i32 723 %scalar = ... : i32 724 %vector = ... : vector<4xi32> 725 %0 = spv.GroupNonUniformUMin "Workgroup" "Reduce" %scalar : i32 726 %1 = spv.GroupNonUniformUMin "Subgroup" "ClusteredReduce" %vector cluster_size(%four) : vector<4xi32> 727 ``` 728 }]; 729} 730 731// ----- 732 733#endif // SPIRV_NON_UNIFORM_OPS 734