MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / CreateGemmOperator

Function CreateGemmOperator

dnn/scripts/cutlass_generator/generator.py:38–91  ·  view source on GitHub ↗
(
    manifest,
    layouts,
    tile_descriptions,
    data_type,
    alignment_constraints,
    complex_transforms=None,
    epilogue_functor=EpilogueFunctor.LinearCombination,
    swizzling_functor=SwizzlingFunctor.Identity8,
)

Source from the content-addressed store, hash-verified

36
37#
38def CreateGemmOperator(
39 manifest,
40 layouts,
41 tile_descriptions,
42 data_type,
43 alignment_constraints,
44 complex_transforms=None,
45 epilogue_functor=EpilogueFunctor.LinearCombination,
46 swizzling_functor=SwizzlingFunctor.Identity8,
47):
48
49 if complex_transforms is None:
50 complex_transforms = [(ComplexTransform.none, ComplexTransform.none)]
51
52 element_a, element_b, element_c, element_epilogue = data_type
53
54 operations = []
55
56 # by default, only generate the largest tile and largest alignment
57 if manifest.args.kernels == "":
58 tile_descriptions = [tile_descriptions[0]]
59 alignment_constraints = [alignment_constraints[0]]
60
61 for layout in layouts:
62 for tile_description in tile_descriptions:
63 for alignment in alignment_constraints:
64 for complex_transform in complex_transforms:
65
66 alignment_c = min(8, alignment)
67
68 A = TensorDescription(
69 element_a, layout[0], alignment, complex_transform[0]
70 )
71 B = TensorDescription(
72 element_b, layout[1], alignment, complex_transform[1]
73 )
74 C = TensorDescription(element_c, layout[2], alignment_c)
75
76 new_operation = GemmOperation(
77 GemmKind.Universal,
78 tile_description.minimum_compute_capability,
79 tile_description,
80 A,
81 B,
82 C,
83 element_epilogue,
84 epilogue_functor,
85 swizzling_functor,
86 )
87
88 manifest.append(new_operation)
89 operations.append(new_operation)
90
91 return operations
92
93
94###########################################################################################################

Callers

nothing calls this directly

Calls 4

TensorDescriptionClass · 0.70
GemmOperationClass · 0.70
minFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected