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

Function GenerateGemm_Simt

dnn/scripts/cutlass_generator/generator.py:868–1059  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

866# L1 will have a single kernel for every unique shape
867# L2 will have everything else
868def GenerateGemm_Simt(args):
869 ################################################################################
870 # warps per threadblock
871 ################################################################################
872 warpsPerThreadblocks = []
873 for warpsPerThreadblock0 in warpsPerThreadblockEdge:
874 for warpsPerThreadblock1 in warpsPerThreadblockEdge:
875 if (
876 warpsPerThreadblock0 / warpsPerThreadblock1 <= warpsPerThreadblockRatio
877 and warpsPerThreadblock1 / warpsPerThreadblock0
878 <= warpsPerThreadblockRatio
879 and warpsPerThreadblock0 * warpsPerThreadblock1
880 <= warpsPerThreadblockMax
881 ):
882 warpsPerThreadblocks.append(
883 [warpsPerThreadblock0, warpsPerThreadblock1]
884 )
885
886 ################################################################################
887 # warp shapes
888 ################################################################################
889 warpNumThreads = 32
890 warpShapes = []
891 for warp0 in warpShapeEdges:
892 for warp1 in warpShapeEdges:
893 if (
894 warp0 / warp1 <= warpShapeRatio
895 and warp1 / warp0 <= warpShapeRatio
896 and warp0 * warp1 <= warpShapeMax
897 and warp0 * warp1 > warpShapeMin
898 ):
899 warpShapes.append([warp0, warp1])
900
901 # sgemm
902 (
903 precisionType,
904 precisionBits,
905 threadblockMaxElements,
906 threadblockTilesL0,
907 ) = precisions["s"]
908
909 layouts = [
910 (LayoutType.ColumnMajor, LayoutType.ColumnMajor, LayoutType.RowMajor), # nn
911 (LayoutType.ColumnMajor, LayoutType.RowMajor, LayoutType.RowMajor), # nt
912 (LayoutType.RowMajor, LayoutType.ColumnMajor, LayoutType.RowMajor), # tn
913 (LayoutType.RowMajor, LayoutType.RowMajor, LayoutType.RowMajor), # tt
914 ]
915
916 math_instructions = [
917 MathInstruction(
918 [1, 1, 1],
919 DataType.f32,
920 DataType.f32,
921 DataType.f32,
922 OpcodeClass.Simt,
923 MathOperation.multiply_add,
924 )
925 ]

Callers 1

GenerateGemmOperationsFunction · 0.85

Calls 6

MathInstructionClass · 0.85
maxFunction · 0.85
filterFunction · 0.85
GeneratesGemmFunction · 0.85
TileDescriptionClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected