Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 10 additions & 8 deletions shared/tensile/Tensile/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,8 @@ def gfxName(arch):


def detectIsaWindows(output):
global globalParameters

i = 0
for line in output:
if 'gcnArchName' in line:
Expand All @@ -2226,21 +2228,23 @@ def detectIsaWindows(output):


def detectIsaLinux(output):
global globalParameters

for i, line in enumerate(output):
arch = gfxArch(line.strip())
if arch and arch in globalParameters["SupportedISA"]:
tPrint(1, f"# Detected GPU {i}: {gfxName(arch)}")
globalParameters["CurrentISA"] = arch


def detectGlobalCurrentISA():
def detectGlobalParametersCurrentISA():
"""
Returns returncode if detection failure
"""
global globalParameters

if not (globalParameters["CurrentISA"] == (0,0,0) and globalParameters["ROCmAgentEnumeratorPath"]):
return -1
return 0 # either already set or enumerate disabled so return success

enumerator = globalParameters["ROCmAgentEnumeratorPath"]
process = subprocess.run([enumerator], stdout=subprocess.PIPE)
Expand Down Expand Up @@ -2456,14 +2460,12 @@ def assignGlobalParameters( config, capabilitiesCache: Optional[dict] = None ):

globalParameters["ExtractKernelPath"] = locateExe(os.path.join(globalParameters["ROCmPath"], "hip/bin"), "extractkernel")

# read current gfx version
returncode = detectGlobalCurrentISA()
# read current gfx ISA if enabled
detectGlobalParametersCurrentISA()
if globalParameters["CurrentISA"] == (0,0,0):
printWarning("Did not detect SupportedISA: %s; cannot benchmark assembly kernels." % globalParameters["SupportedISA"])
if returncode:
if os.name == "nt":
globalParameters["CurrentISA"] = (9,0,6)
printWarning("Failed to detect ISA so forcing (gfx906) on windows")
globalParameters["CurrentISA"] = (9,0,6)
printWarning("No detected ISA so using (gfx906) as bootstrap ISA")
isasWithDisabledHWMonitor = ((9,4,2), (9,5,0), (11,0,0), (11,0,1), (11,0,2), (11,0,3), (12,0,0), (12,0,1))
if globalParameters["CurrentISA"] in isasWithDisabledHWMonitor:
isaString = ', '.join(map(gfxName, isasWithDisabledHWMonitor))
Expand Down
7 changes: 6 additions & 1 deletion shared/tensile/Tensile/KernelWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ def setAndAdjustLwEndMfmaIndex(self, kernel, tensorParametersA, tensorParameters
##############################################################################
def makeSchedule(self, kernel, tensorParametersA, tensorParametersB, localWriteEndIter, uDu=0, skipGlobalReadInc=False, firstIter=False, lastLoop=False, lastLc=False):

currentIsa = globalParameters["CurrentISA"]
if "ISA" in kernel:
currentIsa = tuple(kernel["ISA"])
else:
currentIsa = globalParameters["CurrentISA"]
print( f"error: kernel had no ISA, using global CurrentISA {globalParameters['CurrentISA']}" )

maxVmcnt = globalParameters["AsmCaps"][currentIsa]["MaxVmcnt"]

self.unrollLoopHeaderCode = Code.Module()
Expand Down
5 changes: 4 additions & 1 deletion shared/tensile/Tensile/KernelWriterAssembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,12 @@ def initKernel(self, kernel, tPA, tPB ):
self.combineLocalAddresses = 0

# ISA version, such as 803
self.version = globalParameters["CurrentISA"]
if "ISA" in kernel:
self.version = tuple(kernel["ISA"])
else:
self.version = globalParameters["CurrentISA"]
print( f"error: kernel had no ISA, using global CurrentISA {globalParameters['CurrentISA']}" )

if not globalParameters["AsmCaps"][self.version]["SupportedISA"]:
defaultIsa = (9,0,0)
print("warning: ISA:", self.version, " is not supported; overriding with ", defaultIsa)
Expand Down