-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added instr.sched options to tune_gemm.py
#649
base: main_perf
Are you sure you want to change the base?
Changes from all commits
ee13ad1
1a1adbb
f9cbf03
ee290f0
df063d4
b588ea0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,16 @@ def read_config(config): | |
waves_per_eu = config.get('waves_per_eu') | ||
mfma_instr_size = config.get('matrix_instr_nonkdim') | ||
kpack = config.get('kpack') | ||
return block_m, block_n, block_k, group_m, split_k, num_warps, num_stages, waves_per_eu, mfma_instr_size, kpack | ||
sched_variant = config.get('instruction_sched_variant') | ||
return block_m, block_n, block_k, group_m, split_k, num_warps, num_stages, waves_per_eu, mfma_instr_size, kpack, sched_variant | ||
|
||
|
||
def gen_configStr(config): | ||
block_m, block_n, block_k, group_m, split_k, num_warps, num_stages, waves_per_eu, mfmaInstrSize, kpack = read_config( | ||
block_m, block_n, block_k, group_m, split_k, num_warps, num_stages, waves_per_eu, mfmaInstrSize, kpack, sched_variant = read_config( | ||
config) | ||
|
||
## {M}_{N}_{K} is removed since the same kernel can be used for differen gemm sizes | ||
configStr = f"BM{block_m}_BN{block_n}_BK{block_k}_GM{group_m}_SK{split_k}_nW{num_warps}_nS{num_stages}_EU{waves_per_eu}_kP{kpack}_mfma{mfmaInstrSize}" | ||
configStr = f"BM{block_m}_BN{block_n}_BK{block_k}_GM{group_m}_SK{split_k}_nW{num_warps}_nS{num_stages}_EU{waves_per_eu}_kP{kpack}_mfma{mfmaInstrSize}_sched{sched_variant[1:-1].upper()}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we are using |
||
|
||
return configStr | ||
|
||
|
@@ -69,7 +70,7 @@ def generate_matmul_kernels(configs): | |
## construct the configStr and generate the wrapper function matmul_{configStr}() | ||
## If `warmup` is set, the generated kernel will be **compiled** | ||
def gen_kernel_and_configStr_from_config(config, EVEN_K, dtype_a, dtype_b, dtype_c, bias_size, warmup): | ||
block_m, block_n, block_k, group_m, split_k, num_warps, num_stages, waves_per_eu, mfmaInstrSize, kpack = read_config( | ||
block_m, block_n, block_k, group_m, split_k, num_warps, num_stages, waves_per_eu, mfmaInstrSize, kpack, sched_variant = read_config( | ||
config) | ||
|
||
configStr = gen_configStr(config) | ||
|
@@ -112,6 +113,7 @@ def matmul_{configStr}(M, N, K, am, ak, bk, bn, cm, cn, biasn): | |
EVEN_K = {EVEN_K}, | ||
GRID_MN = grid_mn, | ||
NUM_XCDS = {num_xcds}, | ||
instruction_sched_variant = {sched_variant}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing quotes |
||
grid=(1,), | ||
) | ||
return None | ||
|
@@ -145,7 +147,8 @@ def matmul_{configStr}(a, b, c, bias, M, N, K, am, ak, bk, bn, cm, cn, biasn): | |
BIAS = {use_bias}, | ||
EVEN_K = {EVEN_K}, | ||
GRID_MN = grid[0], | ||
NUM_XCDS = {num_xcds} | ||
NUM_XCDS = {num_xcds}, | ||
instruction_sched_variant = {sched_variant}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing quote |
||
) | ||
return c | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example output after adding '\n'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure.