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

Improve ADD_REL_POS perf in SAM by doing it inplace #466

Merged
merged 7 commits into from
Aug 21, 2023
Prev Previous commit
Remove not needed build_forward_expand from add-rel-pos unit test
  • Loading branch information
YavorGIvanov committed Aug 21, 2023
commit 415dbf173804cc06cc5da4f19233490d2591fdbe
4 changes: 0 additions & 4 deletions tests/test-rel-pos.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,10 @@ int main(int argc, const char** argv) {

struct ggml_tensor * out = ggml_add_rel_pos(ctx, in, rw_f32, rh_f32);
struct ggml_cgraph gf = ggml_build_forward(out);
ggml_build_forward_expand(&gf, rw_f32);
ggml_build_forward_expand(&gf, rh_f32);
ggml_graph_compute_with_ctx(ctx, &gf, 1);

out_inplace = ggml_add_rel_pos_inplace(ctx, out_inplace, rw_f32, rh_f32);
struct ggml_cgraph gf_2 = ggml_build_forward(out_inplace);
ggml_build_forward_expand(&gf_2, rw_f32);
ggml_build_forward_expand(&gf_2, rh_f32);
ggml_graph_compute_with_ctx(ctx, &gf_2, 1);

check_tensor(out, (float*)expected_out, 9, 4, 1);
Expand Down
Loading