Skip to content

Fix BiasDataTypeList #1897

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,12 @@ def trans_map(trans):
else:
return None

def bias_datatype_map(dtype):
if dtype == "f16_r":
return [datatype_map('f32_r'), datatype_map('f16_r')]
elif dtype == "f32_r":
return [datatype_map('f32_r')]
elif dtype == "xf32_r":
return [datatype_map('xf32_r')]
elif dtype == "bf16_r":
return [datatype_map('f32_r'), datatype_map('bf16_r')]
elif dtype == "f8_r":
return [datatype_map('f32_r'), datatype_map('f8_r')]
else:
def bias_datatype_map(bias_type, data_type, compute_type, dest_type):
bias_list = list(set([data_type, compute_type, dest_type]))
if bias_type in bias_list:
return []
bias_list.append(bias_type)
return bias_list

def get_high_precision_accumulate(DataType):
if DataType in ["H", "B", "F8"]:
Expand Down Expand Up @@ -282,7 +275,10 @@ def extract_dtype(match):
if bias_source:
res["UseBias"] = 1
res["BiasSrc"] = bias_source
res["BiasDataTypeList"] = list(bias_datatype_map(gdict.get("BIAS_TYPE", '').strip()))
bias_type = datatype_map(gdict.get("BIAS_TYPE", '').strip())
bias_list = bias_datatype_map(bias_type, DataType, ComputeDataType, DestDataType)
if bias_list:
res["BiasDataTypeList"] = bias_list
if activation_type != "none":
res["Activation"] = True
res["ActivationType"] = "hipblaslt_all"
Expand Down Expand Up @@ -406,9 +402,11 @@ def dump_yaml(gpu_idx, gemm_group, yaml_file, m_sum, n_sum, batch_sum, k_sum, sa
if i >= len(data["BenchmarkProblems"]):
data["BenchmarkProblems"].append(copy.deepcopy(data["BenchmarkProblems"][0]))
data["BenchmarkProblems"][i][1]["BenchmarkFinalParameters"][0]["ProblemSizes"] = gemm_group[dtype_str]
if "BiasDataTypeList" in dtype:
data["BenchmarkProblems"][i][1]["BenchmarkFinalParameters"].append({"BiasTypeArgs": list(dtype["BiasDataTypeList"])})

if "UseBias" in dtype and dtype["UseBias"] == 1:
if "BiasTypeArgs" in dtype:
data["BenchmarkProblems"][i][1]["BenchmarkFinalParameters"].append({"BiasTypeArgs": list(dtype["BiasDataTypeList"])})
else:
data["BenchmarkProblems"][i][1]["BenchmarkFinalParameters"].append({"BiasTypeArgs": list(dtype["DestDataType"])})
# Add groupd here if needed
group_params = [[]]

Expand Down
Loading