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 reduce section for verify tests #3677

Merged
merged 3 commits into from
Dec 11, 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 test/verify/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ target_link_libraries(test_verify migraphx migraphx_all_targets)
target_include_directories(test_verify PUBLIC ../include)
rocm_clang_tidy_check(test_verify)

foreach(SECTION general rnn conv gemm)
foreach(SECTION general reduce rnn conv gemm)
rocm_add_test(NAME test_verify_${SECTION} COMMAND test_verify ${SECTION})
set_tests_properties(test_verify_${SECTION} PROPERTIES
COST 100
Expand Down
2 changes: 2 additions & 0 deletions test/verify/test_arg_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ struct test_arg_ops : verify_program<test_arg_ops<T, DType, Axis, LastIndex, Non
mm->add_instruction(T{Axis, LastIndex}, param);
return p;
}

std::string section() const { return "reduce"; }
};
// transpose argmax tests
template struct test_arg_ops<migraphx::op::argmax, migraphx::shape::float_type, 0, true, 0>;
Expand Down
2 changes: 2 additions & 0 deletions test/verify/test_block_reduce_small.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ struct test_block_reduce_small : verify_program<test_block_reduce_small<N, T>>
mm->add_return({add});
return p;
};

std::string section() const { return "reduce"; }
};

template <int N>
Expand Down
6 changes: 5 additions & 1 deletion test/verify/test_instancenorm.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -75,6 +75,8 @@ struct test_instancenorm : verify_program<test_instancenorm<TYPE>>
add_instancenorm(*mm, x, {1, 2, 1, 1});
return p;
}

std::string section() const { return "reduce"; }
};
template struct test_instancenorm<migraphx::shape::float_type>;
template struct test_instancenorm<migraphx::shape::half_type>;
Expand All @@ -91,6 +93,8 @@ struct test_instancenorm_large_3d : verify_program<test_instancenorm_large_3d<TY
add_instancenorm(*mm, x, {1, 32, 1, 1, 1});
return p;
}

std::string section() const { return "reduce"; }
};

template struct test_instancenorm_large_3d<migraphx::shape::float_type>;
Expand Down
24 changes: 24 additions & 0 deletions test/verify/test_layernorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct test_layernorm : verify_program<test_layernorm>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm2 : verify_program<test_layernorm2>
Expand All @@ -53,6 +55,8 @@ struct test_layernorm2 : verify_program<test_layernorm2>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_large : verify_program<test_layernorm_large>
Expand All @@ -66,6 +70,8 @@ struct test_layernorm_large : verify_program<test_layernorm_large>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_fp16 : verify_program<test_layernorm_fp16>
Expand All @@ -79,6 +85,8 @@ struct test_layernorm_fp16 : verify_program<test_layernorm_fp16>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_fp8_1 : verify_program<test_layernorm_fp8_1>
Expand All @@ -92,6 +100,8 @@ struct test_layernorm_fp8_1 : verify_program<test_layernorm_fp8_1>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_fp8_2 : verify_program<test_layernorm_fp8_2>
Expand All @@ -105,6 +115,8 @@ struct test_layernorm_fp8_2 : verify_program<test_layernorm_fp8_2>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_fp8_3 : verify_program<test_layernorm_fp8_3>
Expand All @@ -118,6 +130,8 @@ struct test_layernorm_fp8_3 : verify_program<test_layernorm_fp8_3>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_fp8_4 : verify_program<test_layernorm_fp8_4>
Expand All @@ -131,6 +145,8 @@ struct test_layernorm_fp8_4 : verify_program<test_layernorm_fp8_4>
add_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_eps : verify_program<test_layernorm_eps>
Expand All @@ -144,6 +160,8 @@ struct test_layernorm_eps : verify_program<test_layernorm_eps>
add_layernorm(*mm, x, dims, 1e-5f);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_triadd : verify_program<test_layernorm_triadd>
Expand All @@ -161,6 +179,8 @@ struct test_layernorm_triadd : verify_program<test_layernorm_triadd>
add_layernorm(*mm, add2, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_layernorm_triadd_large : verify_program<test_layernorm_triadd_large>
Expand All @@ -178,6 +198,8 @@ struct test_layernorm_triadd_large : verify_program<test_layernorm_triadd_large>
add_layernorm(*mm, add2, dims);
return p;
}

std::string section() const { return "reduce"; }
};

struct test_add_layernorm_add_gemm_nonstd : verify_program<test_add_layernorm_add_gemm_nonstd>
Expand Down Expand Up @@ -210,4 +232,6 @@ struct test_pw_layernorm : verify_program<test_pw_layernorm>
add_pointwise_layernorm(*mm, x, dims);
return p;
}

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_logsoftmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct test_logsoftmax : verify_program<test_logsoftmax<Axis, T>>

return p;
}

std::string section() const { return "reduce"; }
};

template struct test_logsoftmax<0, migraphx::shape::float_type>;
Expand Down
4 changes: 3 additions & 1 deletion test/verify/test_logsoftmax1.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,4 +40,6 @@ struct test_logsoftmax1 : verify_program<test_logsoftmax1>
mm->add_return({r});
return p;
}

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_pointwise_broadcast_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ struct test_pointwise_broadcast_reduce : verify_program<test_pointwise_broadcast
mm->add_return({reshape});
return p;
};

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_reduce_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct test_reduce_add : verify_program<test_reduce_add<DType>>
mm->add_return({add});
return p;
};

std::string section() const { return "reduce"; }
};

template struct test_reduce_add<migraphx::shape::float_type>;
4 changes: 3 additions & 1 deletion test/verify/test_reduce_mean_bias_half.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -45,4 +45,6 @@ struct test_reduce_mean_bias_half : verify_program<test_reduce_mean_bias_half>
mm->add_return({sqrt});
return p;
};

std::string section() const { return "reduce"; }
};
4 changes: 3 additions & 1 deletion test/verify/test_reduce_mean_large_half.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -38,4 +38,6 @@ struct test_reduce_mean_large_half : verify_program<test_reduce_mean_large_half>
mm->add_instruction(migraphx::make_op("reduce_mean", {{"axes", {2}}}), x);
return p;
};

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_reduce_mean_nhwc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ struct test_reduce_mean_nhwc : verify_program<test_reduce_mean_nhwc<DType>>
mm->add_return({sqrt});
return p;
};

std::string section() const { return "reduce"; }
};

template struct test_reduce_mean_nhwc<migraphx::shape::float_type>;
Expand Down
2 changes: 2 additions & 0 deletions test/verify/test_reduce_mean_reduce_sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ struct test_reduce_mean_reduce_sum : verify_program<test_reduce_mean_reduce_sum>
mm->add_return({mean_div2});
return p;
};

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_reduce_mean_variance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ struct test_reduce_mean_variance : verify_program<test_reduce_mean_variance>
mm->add_return({add});
return p;
};

std::string section() const { return "reduce"; }
};
4 changes: 3 additions & 1 deletion test/verify/test_reduce_noop_add.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -45,4 +45,6 @@ struct test_reduce_noop_add : verify_program<test_reduce_noop_add>
mm->add_return({add});
return p;
};

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_reduce_op_large.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct test_reduce_op_large : verify_program<test_reduce_op_large<Op, Axis, T>>
mm->add_instruction(Op{{Axis}}, x);
return p;
};

std::string section() const { return "reduce"; }
};

template struct test_reduce_op_large<migraphx::op::reduce_max, 1, migraphx::shape::float_type>;
Expand Down
2 changes: 2 additions & 0 deletions test/verify/test_reduce_op_small.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct test_reduce_op_small : verify_program<test_reduce_op_small<Op, Axis, T>>
mm->add_instruction(Op{{Axis}}, x);
return p;
};

std::string section() const { return "reduce"; }
};

template struct test_reduce_op_small<migraphx::op::reduce_sum, 1, migraphx::shape::float_type>;
Expand Down
4 changes: 3 additions & 1 deletion test/verify/test_select_module_reduce.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -66,4 +66,6 @@ struct test_select_module_reduce : verify_program<test_select_module_reduce>

return p;
}

std::string section() const { return "reduce"; }
};
2 changes: 2 additions & 0 deletions test/verify/test_softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct test_softmax : verify_program<test_softmax<Axis, T>>

return p;
}

std::string section() const { return "reduce"; }
};

template struct test_softmax<0, migraphx::shape::float_type>;
Expand Down
4 changes: 3 additions & 1 deletion test/verify/test_softmax1.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -37,4 +37,6 @@ struct test_softmax1 : verify_program<test_softmax1>
mm->add_instruction(migraphx::make_op("softmax", {{"axis", 0}}), x);
return p;
}

std::string section() const { return "reduce"; }
};
4 changes: 3 additions & 1 deletion test/verify/test_softmax2.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -38,4 +38,6 @@ struct test_softmax2 : verify_program<test_softmax2>
mm->add_instruction(migraphx::make_op("softmax"), x);
return p;
}

std::string section() const { return "reduce"; }
};
4 changes: 3 additions & 1 deletion test/verify/test_softmax3.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -41,4 +41,6 @@ struct test_softmax3 : verify_program<test_softmax3>
mm->add_return({r});
return p;
}

std::string section() const { return "reduce"; }
};
4 changes: 3 additions & 1 deletion test/verify/test_softmax4.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -38,4 +38,6 @@ struct test_softmax4 : verify_program<test_softmax4>
mm->add_instruction(migraphx::make_op("softmax", {{"axis", 3}}), x);
return p;
}

std::string section() const { return "reduce"; }
};
4 changes: 3 additions & 1 deletion test/verify/test_softmax_large1.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,4 +40,6 @@ struct test_softmax_large1 : verify_program<test_softmax_large1>
mm->add_instruction(migraphx::make_op("softmax", {{"axis", -1}}), add);
return p;
}

std::string section() const { return "reduce"; }
};
Loading
Loading