You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

eye.cpp 1.2 kB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "hcc_detail/hcc_defs_prologue.h"
  2. #include "test/rocm/fixture.h"
  3. #include "megdnn/oprs.h"
  4. #include "test/common/checker.h"
  5. #include "test/rocm/benchmarker.h"
  6. namespace megdnn {
  7. namespace test {
  8. TEST_F(ROCM, EYE) {
  9. Checker<Eye> checker(handle_rocm());
  10. for (DType dtype : std::vector<DType>{
  11. DNN_INC_FLOAT16(dtype::Float16() MEGDNN_COMMA) dtype::Int32(),
  12. dtype::Float32()})
  13. for (int k = -20; k < 20; ++k) {
  14. checker.set_param({k, dtype.enumv()});
  15. checker.set_dtype(0, dtype);
  16. checker.exec(TensorShapeArray{{3, 4}});
  17. checker.exec(TensorShapeArray{{4, 3}});
  18. }
  19. }
  20. TEST_F(ROCM, EYE_BENCHMARK) {
  21. auto benchmarker = ROCMBenchmarker<Eye>(handle_rocm(), handle_naive(false));
  22. benchmarker.set_display(true);
  23. benchmarker.set_param({10240, dtype::Float32().enumv()});
  24. benchmarker.set_dtype(0, dtype::Float32());
  25. auto time_ms = benchmarker.execs({{10000, 10000}});
  26. float io = 10000 * 10000 * dtype::Float32().size();
  27. printf("io = %.3f GB, bandwidth = %.3f GB/s\n", io / 1e9, io / (1e6 * time_ms));
  28. }
  29. } // namespace test
  30. } // namespace megdnn
  31. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}