Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add one benchmark to measure performance of MaskedScatterNDOfShape #182

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Testing/*
plot_*.csv
plot_*.xlsx
*.data
test_ort_version/*
test_ort_version*
x64/*
CMakeFiles/*
dist/*
Expand Down
12 changes: 10 additions & 2 deletions _doc/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ plot_op_scatternd_cuda

See :ref:`l-example-op-scatternd_cuda`.

The benchmark compares two operators Mul profiles
with their fusion into a single operator.
The benchmark compares two operators ScatterND, using
atomic, no atomic.

plot_op_scatternd_mask_cuda
+++++++++++++++++++++++++++

See :ref:`l-example-op-scatternd_mask_cuda`.

The benchmark compares three operators ScatterND to update
a matrix.

plot_op_transpose2dcast_cuda
++++++++++++++++++++++++++++
Expand Down
15 changes: 10 additions & 5 deletions _doc/examples/plot_op_scatternd_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Where the shapes are:

* zeros: 32000x4906
* zeros: 32000x4096
* indices: 2x1024x1
* updates: 2x1024x4096
"""
Expand Down Expand Up @@ -337,14 +337,18 @@ def benchmark(

print(f"sizes={sizes}")

data_nd1 = benchmark(sess1, sizes, script_args.config, "Atomic", itype=itype)
data_nd1 = benchmark(
sess1, sizes, script_args.config, "Atomic/Not Fused", itype=itype
)

#######################################
# Fused.

if sess2 is not None:

data_nd2 = benchmark(sess2, sizes, script_args.config, "No Atomic", itype=itype)
data_nd2 = benchmark(
sess2, sizes, script_args.config, "No Atomic/Fused", itype=itype
)


##########################################
Expand All @@ -364,10 +368,11 @@ def benchmark(
if sess2 is not None:

pivot = df.pivot(index="size", columns="label", values="time")
pivot["ratio"] = pivot["Atomic"] / pivot["No Atomic"]
pivot["ratio"] = pivot["Atomic/Not Fused"] / pivot["No Atomic/Fused"]
print("Speed up compare to the onnx standaed.")
print(pivot)

ax = pivot[["Atomic", "No Atomic"]].plot(
ax = pivot[["Atomic/Not Fused", "No Atomic/Fused"]].plot(
logx=True,
logy=True,
title=f"Atomic/No-Atomic implementation for ScatterND on CUDA\nitype={itype}",
Expand Down
Loading
Loading