|
44 | 44 | import sys |
45 | 45 | import copy |
46 | 46 | from typing import Any, Dict, Optional, Sequence, Tuple |
| 47 | +import json |
47 | 48 |
|
48 | 49 | _LOGGER = logging.getLogger(__name__) |
49 | 50 |
|
@@ -200,12 +201,10 @@ def CreateGemmUniversal3xOperator( |
200 | 201 |
|
201 | 202 | operations = [] |
202 | 203 |
|
203 | | - # by default, only generate the largest tile and largest alignment |
204 | | - # but generate all tiles when --kernels=all is specified |
| 204 | + # generate all tiles when --kernels=all is specified |
205 | 205 | if manifest.kernel_filter == '' or manifest.kernel_filter == 'all': |
206 | 206 | if len(tile_descriptions) == 0: |
207 | 207 | return operations |
208 | | - tile_descriptions = [tile_descriptions[0]] |
209 | 208 |
|
210 | 209 | combinations = product(layouts, tile_descriptions, data_types, complex_transforms, schedules, tile_schedulers) |
211 | 210 | for layout, tile_description, data_type, complex_transform, schedules, tile_scheduler in combinations: |
@@ -10901,21 +10900,33 @@ def GenerateXe_TensorOp_16b_DPAS_gemm(manifest, cuda_version, min_cc=20): |
10901 | 10900 | MathOperation.multiply_add) |
10902 | 10901 | ] |
10903 | 10902 |
|
| 10903 | + default_tiles_wg_sg = [ |
| 10904 | + ([256, 256, 32],[8,4,1]), |
| 10905 | + ([128, 256, 32],[4,8,1]), |
| 10906 | + ([256, 128, 32],[8,4,1]), |
| 10907 | + ([128, 128, 32],[4,4,1]), |
| 10908 | + ([64, 128, 32],[2,4,1]), |
| 10909 | + ] |
| 10910 | + |
10904 | 10911 | max_cc = min_cc |
10905 | 10912 |
|
| 10913 | + # Expecting JSON of format i.e list of dictionaries [{"wg": [256, 256, 32], "sg": [8,4,1]}, ...] |
| 10914 | + custom_tile_shapes = [] |
| 10915 | + if os.getenv("SYCL_TLA_ADDITIONAL_TILE_SHAPES"): |
| 10916 | + custom_json = os.getenv("SYCL_TLA_ADDITIONAL_TILE_SHAPES") |
| 10917 | + with open(custom_json, "r") as f: |
| 10918 | + try: |
| 10919 | + custom_tile_shapes = json.load(f) |
| 10920 | + except json.JSONDecodeError: |
| 10921 | + raise ValueError(f"Error decoding JSON : {custom_json}") |
| 10922 | + for tile in custom_tile_shapes: |
| 10923 | + default_tiles_wg_sg.append((tile["wg"],tile["sg"])) |
| 10924 | + |
| 10925 | + tile_descriptions=[] |
10906 | 10926 | for math_inst in math_instructions: |
10907 | | - tile_descriptions = [ |
10908 | | - TileDescription([256, 256, 32], |
10909 | | - 0, [8, 4, 1], math_inst, min_cc, max_cc, [1, 1, 1]), |
10910 | | - TileDescription([128, 256, 32], |
10911 | | - 0, [4, 8, 1], math_inst, min_cc, max_cc, [1, 1, 1]), |
10912 | | - TileDescription([256, 128, 32], |
10913 | | - 0, [8, 4, 1], math_inst, min_cc, max_cc, [1, 1, 1]), |
10914 | | - TileDescription([128, 128, 32], |
10915 | | - 0, [4, 4, 1], math_inst, min_cc, max_cc, [1, 1, 1]), |
10916 | | - TileDescription([64, 128, 32], |
10917 | | - 0, [2, 4, 1], math_inst, min_cc, max_cc, [1, 1, 1]), |
10918 | | - ] |
| 10927 | + for wg_tile,sg_tile in default_tiles_wg_sg: |
| 10928 | + tile_descriptions.append(TileDescription(wg_tile, |
| 10929 | + 0, sg_tile, math_inst, min_cc, max_cc, [1, 1, 1])) |
10919 | 10930 |
|
10920 | 10931 | # Generate kernels for different output (D) types |
10921 | 10932 | # Default: accumulator type (FP32 for mixed precision, same as input for native precision) |
|
0 commit comments