Skip to content

Commit

Permalink
Added analyze-simd functionality for stick/unstick simd instructions (o…
Browse files Browse the repository at this point in the history
…nnx#2707)

Signed-off-by: Alexandre Eichenberger <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
  • Loading branch information
AlexandreEichenberger and tungld authored Feb 8, 2024
1 parent 20983d8 commit 0aeb33e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions utils/analyze-simd.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def define_arch_op_names(arch):
op_name["vfma"] = "vfma"
op_name["vmul"] = "vfm.b"
op_name["vdiv"] = "vfd"
# vector conversion between formats (NNPA <-> fp)
op_name["vconv"] = "(vclfnh|vclfnl|vcfn|vcrnf|vcnf)"
# add | sub| max | min | compare
op_name["vadd"] = "([vw]fa|[vw]fs|[vw]fmax|[vw]fmin|[vw]f[ck][eh])"
op_name["load"] = "lg"
Expand All @@ -101,6 +103,7 @@ def define_arch_op_names(arch):
op_name["vfma"] = "v?fmadd[123]+p[ds]"
op_name["vmul"] = "v?mulp[ds]"
op_name["vdiv"] = "v?divp[sd]"
op_name["vconv"] = ""
# add | sub| max | min | compare | and
op_name["vadd"] = (
"(v?addp[ds]|v?subp[ds]|v?maxp[ds]|v?min[dp]|cmp..p[sd]|andp|andnp|orp|xorp|pand|pandn|por|pxor)"
Expand Down Expand Up @@ -191,6 +194,10 @@ def characterize_op(line):
inc_aggr_dict("vcompute")
inc_aggr_dict("vec")
return "vfma"
if re.match(r".*\s" + op_name["vconv"], line):
inc_op_dict("vconv")
inc_aggr_dict("vec")
return "vconv"
# Scalar
if re.match(r".*\s" + op_name["load"], line):
inc_op_dict("load")
Expand Down Expand Up @@ -237,6 +244,8 @@ def print_characterization(details=False):
+ get_aggr_dict("vec")
+ ", compute, "
+ get_aggr_dict("vcompute")
+ ", conversion, "
+ get_op_dict("vconv")
+ ", mem, "
+ get_aggr_dict("vmem")
+ ", overhead, "
Expand Down Expand Up @@ -440,6 +449,7 @@ def main(argv):
pattern = add_pattern(pattern, op_name["vadd"])
pattern = add_pattern(pattern, op_name["vmul"])
pattern = add_pattern(pattern, op_name["vdiv"])
pattern = add_pattern(pattern, op_name["vconv"])
# Mem
pattern = add_pattern(pattern, op_name["vload"])
pattern = add_pattern(pattern, op_name["vload-splat"])
Expand All @@ -453,6 +463,7 @@ def main(argv):
pattern = add_pattern(pattern, op_name["vadd"])
pattern = add_pattern(pattern, op_name["vmul"])
pattern = add_pattern(pattern, op_name["vdiv"])
pattern = add_pattern(pattern, op_name["vconv"])
elif opt in ("-m", "--mem"):
if not pattern:
define_arch_op_names(arch)
Expand Down

0 comments on commit 0aeb33e

Please sign in to comment.