Skip to content

Commit

Permalink
[MINOR] Added a meaningful error message to genKernelInst.py.
Browse files Browse the repository at this point in the history
- When the user specifies a wrong number of template values for a template instantiation, the script now shows an error message that actually points out the problem.
  • Loading branch information
pdamme committed Mar 24, 2023
1 parent a8b3660 commit c1e5042
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/runtime/local/kernels/genKernelInst.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def generateKernelInstantiation(kernelTemplateInfo, templateValues, opCodes, out
if "opCodeAsTemplateParam" in kernelTemplateInfo:
opCodeAsTemplateParam = True if kernelTemplateInfo["opCodeAsTemplateParam"] == 1 else False

if len(templateParams) != len(templateValues):
raise RuntimeError(
f"kernel \"{opName}\" has {len(templateParams)} template parameters, but "
f"{len(templateValues)} template values are supplied in an instantiation"
)

if opCodes is not None:
# We assume that the op-code is the first run-time parameter.
opCodeType = runtimeParams[0]["type"]
Expand Down

0 comments on commit c1e5042

Please sign in to comment.