Skip to content
Closed
Changes from 4 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
21 changes: 19 additions & 2 deletions projects/hipblaslt/tensilelite/Tensile/Contractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from Tensile.Common.Architectures import gfxToIsa
from Tensile.Common.DataType import DataType
from Tensile.Common.GlobalParameters import internalParameters
from Tensile.Common.Utilities import printExit
from Tensile.SolutionStructs import Solution as OriginalSolution
from Tensile.SolutionStructs.Problem import getBiasDataTypeListDefault
from Tensile.Toolchain.Component import Assembler
Expand Down Expand Up @@ -221,7 +222,15 @@ def FromOriginalState(cls, d):
rv.setConstStrideBias = []

if 'UseBias' in d:
rv.useBias = d['UseBias']
useBiasValue = d['UseBias']
# Validate that UseBias is an integer, not a boolean
if isinstance(useBiasValue, bool):
printExit(f"UseBias must be an integer (0, 1, 2, or 3), got boolean value: {useBiasValue}. "
"Use 0 for no bias, 1 for M direction, 2 for N direction, or 3 for both M and N directions.")
# Validate that UseBias is in the valid range
if not isinstance(useBiasValue, int) or useBiasValue not in [0, 1, 2, 3]:
printExit(f"UseBias must be 0, 1, 2, or 3. Got: {useBiasValue}")
rv.useBias = useBiasValue
if 'BiasDataTypeList' in d:
d["BiasDataTypeList"].sort() # Sort to make sure names are unique
rv.biasDataTypeWhiteList = d['BiasDataTypeList']
Expand Down Expand Up @@ -254,7 +263,15 @@ def FromOriginalState(cls, d):

rv.useScaleAlphaVec = 0
if 'UseScaleAlphaVec' in d:
rv.useScaleAlphaVec = d['UseScaleAlphaVec']
useScaleAlphaVecValue = d['UseScaleAlphaVec']
# Validate that UseScaleAlphaVec is an integer, not a boolean
if isinstance(useScaleAlphaVecValue, bool):
printExit(f"UseScaleAlphaVec must be an integer (0, 1, 2, or 3), got boolean value: {useScaleAlphaVecValue}. "
"Use 0 for disabled, 1 for M direction, 2 for N direction, or 3 for both M and N directions.")
# Validate that UseScaleAlphaVec is in the valid range
if not isinstance(useScaleAlphaVecValue, int) or useScaleAlphaVecValue not in [0, 1, 2, 3]:
printExit(f"UseScaleAlphaVec must be 0, 1, 2, or 3. Got: {useScaleAlphaVecValue}")
rv.useScaleAlphaVec = useScaleAlphaVecValue

rv.batched = d['Batched']

Expand Down
Loading