| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
from dataclasses import dataclass |
| 26 |
from typing import NamedTuple |
| 27 |
|
| 28 |
@dataclass |
| 29 |
class IsaInfo: |
| 30 |
asmCaps: dict |
| 31 |
archCaps: dict |
| 32 |
regCaps: dict |
| 33 |
asmBugs: dict |
| 34 |
|
| 35 |
|
| 36 |
class SemanticVersion(NamedTuple): |
| 37 |
major: int |
| 38 |
minor: int |
| 39 |
patch: int |
| 40 |
|
| 41 |
IsaVersion = SemanticVersion |
| 42 |
|
| 43 |
class DebugConfig(NamedTuple): |
| 44 |
""" |
| 45 |
Members: |
| 46 |
debugKernel: assembly only, kernel gets buffer for debug "printing"; |
| 47 |
kernel writes data to memory, gets coppied to host and printed. |
| 48 |
forceGenerateKernel: Even if error occurs in kernel generation (i.e. due to resource overflow), |
| 49 |
generate the kernel source anyway. Tensile will also attempt to run |
| 50 |
the kernel. Useful to examine and debug overflow errors. |
| 51 |
printSolutionRejectionReason: Print why a solution is marked as invalid. |
| 52 |
printIndexAssignmentInfo: Print the tensor index assignment info. |
| 53 |
|
| 54 |
""" |
| 55 |
enableAsserts: bool=False |
| 56 |
enableDebugA: bool=False |
| 57 |
enableDebugB: bool=False |
| 58 |
enableDebugC: bool=False |
| 59 |
expectedValueC: float=16.0 |
| 60 |
forceCExpectedValue: bool=False |
| 61 |
debugKernel: bool=False |
| 62 |
forceGenerateKernel: bool=False |
| 63 |
printSolutionRejectionReason: bool=False |
| 64 |
splitGSU: bool=False |
| 65 |
printIndexAssignmentInfo: bool=False |
| 66 |
|
| 67 |
|
| 68 |
def makeDebugConfig(config: dict) -> DebugConfig: |
| 69 |
|
| 70 |
enableAsserts = False |
| 71 |
enableDebugA = False |
| 72 |
enableDebugB = False |
| 73 |
enableDebugC = False |
| 74 |
expectedValueC = 16.0 |
| 75 |
forceCExpectedValue = False |
| 76 |
debugKernel = False |
| 77 |
forceGenerateKernel = False |
| 78 |
printSolutionRejectionReason = False |
| 79 |
splitGSU = False |
| 80 |
printIndexAssignmentInfo = False |
| 81 |
|
| 82 |
if "EnableAsserts" in config: |
| 83 |
enableAsserts = config["EnableAsserts"] |
| 84 |
if "EnableDebugA" in config: |
| 85 |
enableDebugA = config["EnableDebugA"] |
| 86 |
if "EnableDebugB" in config: |
| 87 |
enableDebugB = config["EnableDebugB"] |
| 88 |
if "EnableDebugC" in config: |
| 89 |
enableDebugC = config["EnableDebugC"] |
| 90 |
if "ExpectedValueC" in config: |
| 91 |
expectedValueC = config["ExpectedValueC"] |
| 92 |
if "ForceCExpectedValue" in config: |
| 93 |
forceCExpectedValue = config["ForceCExpectedValue"] |
| 94 |
if "DebugKernel" in config: |
| 95 |
debugKernel = config["DebugKernel"] |
| 96 |
if "ForceGenerateKernel" in config: |
| 97 |
forceGenerateKernel = config["ForceGenerateKernel"] |
| 98 |
if "PrintSolutionRejectionReason" in config: |
| 99 |
printSolutionRejectionReason = config["PrintSolutionRejectionReason"] |
| 100 |
if "SplitGSU" in config: |
| 101 |
splitGSU = config["SplitGSU"] |
| 102 |
if "PrintIndexAssignmentInfo" in config: |
| 103 |
printIndexAssignmentInfo = config["PrintIndexAssignmentInfo"] |
| 104 |
|
| 105 |
return DebugConfig( |
| 106 |
enableAsserts, |
| 107 |
enableDebugA, |
| 108 |
enableDebugB, |
| 109 |
enableDebugC, |
| 110 |
expectedValueC, |
| 111 |
forceCExpectedValue, |
| 112 |
debugKernel, |
| 113 |
forceGenerateKernel, |
| 114 |
printSolutionRejectionReason, |
| 115 |
splitGSU, |
| 116 |
printIndexAssignmentInfo, |
| 117 |
) |