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 per module runtime #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xuanzhang816
Copy link

@xuanzhang816 xuanzhang816 commented May 13, 2024

On top of this PR -- pytorch/pytorch#125957

@xuanzhang816 xuanzhang816 marked this pull request as ready for review May 13, 2024 16:44
@xuanzhang816
Copy link
Author

@sanketpurandare

@xuanzhang816
Copy link
Author

sample output with n_layer = 2.

Estimated (operator-level-cost-model)total_time: 1297.821 ms
===== FORWARD RUN TIMES =====
 {
    "Global": 385.6099806192309,
    "GPT": 385.60998057582765,
    "GPT.transformer.wte": 0.36801693121693124,
    "GPT.transformer.wpe": 0.026023280423280427,
    "GPT.transformer.drop": 0.10402539682539684,
    "GPT.transformer.h.0.ln_1": 0.3123534391534392,
    "GPT.transformer.h.0": 73.39711463469551,
    "GPT.transformer.h.0.attn": 47.6066228526399,
    "GPT.transformer.h.0.attn.c_attn": 8.695990172239108,
    "GPT.transformer.h.0.attn.c_proj": 3.1067141843971635,
    "GPT.transformer.h.0.attn.resid_dropout": 0.10402539682539684,
    "GPT.transformer.h.0.ln_2": 0.3123534391534392,
    "GPT.transformer.h.0.mlp": 24.333581729145557,
    "GPT.transformer.h.0.mlp.c_fc": 11.490628166160082,
    "GPT.transformer.h.0.mlp.gelu": 1.248304761904762,
    "GPT.transformer.h.0.mlp.c_proj": 11.49062340425532,
    "GPT.transformer.h.0.mlp.dropout": 0.10402539682539684,
    "GPT.transformer.h.1": 73.39711463469551,
    "GPT.transformer.h.1.ln_1": 0.3123534391534392,
    "GPT.transformer.h.1.attn.c_attn": 8.695990172239108,
    "GPT.transformer.h.1.attn": 47.6066228526399,
    "GPT.transformer.h.1.attn.c_proj": 3.1067141843971635,
    "GPT.transformer.h.1.attn.resid_dropout": 0.10402539682539684,
    "GPT.transformer.h.1.ln_2": 0.3123534391534392,
    "GPT.transformer.h.1.mlp": 24.333581729145557,
    "GPT.transformer.h.1.mlp.c_fc": 11.490628166160082,
    "GPT.transformer.h.1.mlp.gelu": 1.248304761904762,
    "GPT.transformer.h.1.mlp.c_proj": 11.49062340425532,
    "GPT.transformer.h.1.mlp.dropout": 0.10402539682539684,
    "GPT.transformer.ln_f": 0.3123534391534392,
    "GPT.lm_head": 176.3632243161094
} ===== BACKWARD RUN TIMES =====
 {
    "Global": 912.2110417797575,
    "GPT": 912.2110417797575,
    "GPT.lm_head": 388.8972168861872,
    "GPT.transformer.ln_f": 1.0405534391534388,
    "GPT.transformer.h.1": 167.14525148035523,
    "GPT.transformer.h.1.mlp": 56.9925015535292,
    "GPT.transformer.h.1.mlp.c_proj": 27.195911887875667,
    "GPT.transformer.h.1.mlp.dropout": 336.951756106384,
    "GPT.transformer.h.1.mlp.gelu": 4.161015873015873,
    "GPT.transformer.h.1.mlp.c_fc": 25.635573792637572,
    "GPT.transformer.h.1.ln_2": 1.3526296296296292,
    "GPT.transformer.h.1.attn.resid_dropout": 277.2542947644926,
    "GPT.transformer.h.1.attn.c_proj": 7.579179162445108,
    "GPT.transformer.h.1.attn": 104.74283035010644,
    "GPT.transformer.h.1.attn.c_attn": 19.61677558257345,
    "GPT.transformer.h.1.ln_1": 1.3526296296296292,
    "GPT.transformer.h.0": 167.14525148035523,
    "GPT.transformer.h.0.mlp": 56.9925015535292,
    "GPT.transformer.h.0.mlp.dropout": 169.80650462602398,
    "GPT.transformer.h.0.mlp.c_proj": 27.195911887875667,
    "GPT.transformer.h.0.mlp.gelu": 4.161015873015873,
    "GPT.transformer.h.0.mlp.c_fc": 25.635573792637572,
    "GPT.transformer.h.0.ln_2": 1.3526296296296292,
    "GPT.transformer.h.0.attn.c_proj": 7.579179162445108,
    "GPT.transformer.h.0.attn": 104.74283035010644,
    "GPT.transformer.h.0.attn.resid_dropout": 110.10904328413358,
    "GPT.transformer.h.0.attn.c_attn": 19.61677558257345,
    "GPT.transformer.h.0.ln_1": 1.3526296296296292,
    "GPT.transformer.drop": 4.013583304398143,
    "GPT.transformer.wpe": 3.1228658440806725,
    "GPT.transformer.wte": 3.0643346271494556
}
Estimation process total_time: 284.861 ms
peak active: 0.0 GB | peak reserved: 0.001953125 GB
Estimated (operator-level-benchmark)total_time: 1388.629 ms
===== FORWARD RUN TIMES =====
 {
    "Global": 468.1806168566478,
    "GPT": 468.0210971625083,
    "GPT.transformer.wte": 0.6041598856778195,
    "GPT.transformer.wpe": 0.05903993228077889,
    "GPT.transformer.drop": 0.001226650799314181,
    "GPT.transformer.h.0.ln_1": 0.37707723453640946,
    "GPT.transformer.h.0": 81.91163517240562,
    "GPT.transformer.h.0.attn": 46.16283664666986,
    "GPT.transformer.h.0.attn.c_attn": 15.165898302004981,
    "GPT.transformer.h.0.attn.c_proj": 5.063210437149429,
    "GPT.transformer.h.0.attn.resid_dropout": 0.001130651164179047,
    "GPT.transformer.h.0.ln_2": 0.3334399241140733,
    "GPT.transformer.h.0.mlp": 34.31688412099022,
    "GPT.transformer.h.0.mlp.c_fc": 16.70306071086104,
    "GPT.transformer.h.0.mlp.gelu": 0.9647253080829978,
    "GPT.transformer.h.0.mlp.c_proj": 16.647999450654407,
    "GPT.transformer.h.0.mlp.dropout": 0.001098651391764482,
    "GPT.transformer.h.1": 75.65896355429233,
    "GPT.transformer.h.1.ln_1": 0.32328525569289923,
    "GPT.transformer.h.1.attn.c_attn": 12.461044962701079,
    "GPT.transformer.h.1.attn": 39.87656392582259,
    "GPT.transformer.h.1.attn.c_proj": 4.5661971119412526,
    "GPT.transformer.h.1.attn.resid_dropout": 0.0011306514820704856,
    "GPT.transformer.h.1.ln_2": 0.3335999211966992,
    "GPT.transformer.h.1.mlp": 34.40291189267673,
    "GPT.transformer.h.1.mlp.c_fc": 16.76643210730081,
    "GPT.transformer.h.1.mlp.gelu": 0.9636053096279501,
    "GPT.transformer.h.1.mlp.c_proj": 16.671754492128272,
    "GPT.transformer.h.1.mlp.dropout": 0.0011199836196998756,
    "GPT.transformer.ln_f": 0.3261225704594205,
    "GPT.lm_head": 275.3458804402072
} ===== BACKWARD RUN TIMES =====
 {
    "GPT.transformer.drop": 6.7659048870857745,
    "Global": 920.4481403356291,
    "GPT.transformer.wte": 6.2831321057404015,
    "GPT.transformer.wpe": 6.566513126241658,
    "GPT.transformer.h.0.mlp.dropout": 168.55343033045406,
    "GPT.transformer.h.1.attn.resid_dropout": 257.95337108719116,
    "GPT.transformer.h.0.attn.resid_dropout": 96.06949570222504,
    "GPT": 920.4481403356291,
    "GPT.transformer.h.1.mlp.dropout": 330.60479249553003,
    "GPT.lm_head": 547.079509586151,
    "GPT.transformer.ln_f": 0.9316796716252966,
    "GPT.transformer.h.1": 162.0515114867786,
    "GPT.transformer.h.1.mlp": 71.34376328913747,
    "GPT.transformer.h.1.mlp.c_proj": 34.63814287957237,
    "GPT.transformer.h.1.mlp.gelu": 1.4245332712239274,
    "GPT.transformer.h.1.mlp.c_fc": 35.28108713834112,
    "GPT.transformer.h.1.ln_2": 1.2932156415190548,
    "GPT.transformer.h.1.attn.c_proj": 8.656980591962114,
    "GPT.transformer.h.1.attn": 88.10194663996997,
    "GPT.transformer.h.1.attn.c_attn": 25.284478925915433,
    "GPT.transformer.h.1.ln_1": 1.2837436347771434,
    "GPT.transformer.h.0": 161.80177592535807,
    "GPT.transformer.h.0.mlp": 71.17786582034887,
    "GPT.transformer.h.0.mlp.c_proj": 34.538005014196656,
    "GPT.transformer.h.0.mlp.gelu": 1.4252478958672532,
    "GPT.transformer.h.0.mlp.c_fc": 35.21461291028497,
    "GPT.transformer.h.0.ln_2": 1.2914769907724115,
    "GPT.transformer.h.0.attn.c_proj": 8.709823195289818,
    "GPT.transformer.h.0.attn": 88.01500452075278,
    "GPT.transformer.h.0.attn.c_attn": 25.136201193052038,
    "GPT.transformer.h.0.ln_1": 1.2885862943865354
}
Estimation process total_time: 7541.540 ms
peak active: 36.8516845703125 GB | peak reserved: 39.4296875 GB
Actual run_time : 1394.169 ms
peak active: 43.869290351867676 GB | peak reserved: 51.712890625 GB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant