Constructs a ``cutlass_cppgen.backend.Conv2dOperation`` based on the input parameters and current kernel specification of the ``Conv2d`` object. :param tile_description: tile description specifying shapes and operand types to use in the kernel :type tile_description
(
self, tile_description: TileDescription = None,
alignment_A: int = None, alignment_B: int = None, alignment_C: int = None,
iterator_algorithm: IteratorAlgorithm = None,
stride_support = None, swizzling_functor: cutlass_cppgen.swizzle = None,
epilogue_functor=None)
| 543 | # |
| 544 | |
| 545 | def construct( |
| 546 | self, tile_description: TileDescription = None, |
| 547 | alignment_A: int = None, alignment_B: int = None, alignment_C: int = None, |
| 548 | iterator_algorithm: IteratorAlgorithm = None, |
| 549 | stride_support = None, swizzling_functor: cutlass_cppgen.swizzle = None, |
| 550 | epilogue_functor=None) -> cutlass_cppgen.backend.Conv2dOperation: |
| 551 | """ |
| 552 | Constructs a ``cutlass_cppgen.backend.Conv2dOperation`` based on the input parameters and current |
| 553 | kernel specification of the ``Conv2d`` object. |
| 554 | |
| 555 | :param tile_description: tile description specifying shapes and operand types to use in the kernel |
| 556 | :type tile_description: cutlass_cppgen.backend.TileDescription |
| 557 | :param alignment_A: alignment of operand A |
| 558 | :type alignment_A: int |
| 559 | :param alignment_B: alignment of operand B |
| 560 | :type alignment_B: int |
| 561 | :param alignment_C: alignment of operand C |
| 562 | :type alignment_C: int |
| 563 | :param iterator_algorithm: the iterator algorithm used |
| 564 | :type iterator_algorithm: cutlass_library.library.IteratorAlgorithm |
| 565 | :param stride_support: the stride support of dgrad |
| 566 | :type stride_support: cutlass_library.library.StrideSupport |
| 567 | :param swizzling_functor: the swizzling functor |
| 568 | :type swizzling_functor: cutlass_cppgen.swizzle |
| 569 | :param epilogue_functor: the epilogue functor |
| 570 | |
| 571 | :return: operation that was constructed |
| 572 | :rtype: cutlass_cppgen.backend.Conv2dOperation |
| 573 | """ |
| 574 | # Get alignment |
| 575 | alignment_A = check.alignment_or_default(alignment_A, self.alignment_pref_A) |
| 576 | alignment_B = check.alignment_or_default(alignment_B, self.alignment_pref_B) |
| 577 | alignment_C = check.alignment_or_default(alignment_C, self.alignment_pref_C) |
| 578 | |
| 579 | tensor_A = TensorDescription(self._element_a, self._layout_b, alignment_A) |
| 580 | tensor_B = TensorDescription(self._element_b, self._layout_b, alignment_B) |
| 581 | tensor_C = TensorDescription(self._element_c, self._layout_c, alignment_C) |
| 582 | |
| 583 | if tile_description is None: |
| 584 | if self.tile_description is not None: |
| 585 | tile_description = self.tile_description |
| 586 | else: |
| 587 | op = self.possible_operations.operations(alignment_A, alignment_B, alignment_C, self._math_operation)[0] |
| 588 | tile_description = datatypes.td_from_profiler_op(op) |
| 589 | else: |
| 590 | valid, err_str = self._valid_tile_description(tile_description) |
| 591 | if not valid: |
| 592 | raise Exception(f"Invalid tile description. {err_str}") |
| 593 | self.tile_description = tile_description |
| 594 | |
| 595 | if iterator_algorithm is None: |
| 596 | # If the iterator algorithm is already set |
| 597 | if self.iterator_algorithm is not None: |
| 598 | iterator_algorithm = self.iterator_algorithm |
| 599 | else: |
| 600 | # Otherwise, we conservatively use the analytic iterator for correctness |
| 601 | iterator_algorithm = IteratorAlgorithm.Analytic |
| 602 |