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.

opr_impl.cpp 1.4 kB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * \file dnn/src/rocm/fill/opr_impl.cpp
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #include "src/rocm/fill/opr_impl.h"
  12. #include "hcc_detail/hcc_defs_prologue.h"
  13. #include "src/rocm/fill/fill.h.hip"
  14. #include "src/rocm/utils.h"
  15. namespace megdnn {
  16. namespace rocm {
  17. void FillImpl::exec(_megdnn_tensor_out dst, _megdnn_workspace workspace) {
  18. check_exec(dst.layout, workspace.size);
  19. auto stream = hip_stream(handle());
  20. auto size = dst.layout.total_nr_elems();
  21. #define cb(DType) \
  22. if (dst.layout.dtype == DType()) { \
  23. using ctype = typename DTypeTrait<DType>::ctype; \
  24. fill::exec_internal<ctype>( \
  25. dst.ptr<ctype>(), static_cast<ctype>(param().value), size, stream); \
  26. }
  27. MEGDNN_FOREACH_COMPUTING_DTYPE(cb)
  28. #undef cb
  29. }
  30. } // namespace rocm
  31. } // namespace megdnn
  32. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}