You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2022/08/04 08:40:03 UTC

[GitHub] [incubator-mxnet] ptrendx commented on a diff in pull request #21104: [BUGFIX] Reenable fwd conv engine 5 on test_group_conv2d_16c

ptrendx commented on code in PR #21104:
URL: https://github.com/apache/incubator-mxnet/pull/21104#discussion_r937510841


##########
src/operator/cudnn_ops.h:
##########
@@ -121,25 +128,39 @@ void MaybeLogSelectedPlan(const cudnn_cxx::Descriptor& plan);
 // Op::Param - a type, collecting all data, required to create cuDNN descriptor(s), but not needed
 //             for execution.
 // Op::MakeKey() - a static function, which maps its arguments to a tuple - a key in the op cache.
-// Op::Make() - a static function, creating the necessary cuDNN descriptor.
-// Op::Exec() - a static function, calling cudnnBackendExecute() with the prepared descriptor and
+// Op::Make() - a static function, creating all necessary cuDNN descriptors.
+// Op::Clone() - a static function, creating a copy of the op's descriptors with a new cudNN handle.
+// Op::Exec() - a static function, calling cudnnBackendExecute() with the prepared descriptor(s) and
 //              the passed arguments.
 template <typename Op, typename... Args>
 bool Exec(const OpContext& ctx, const typename Op::Param& param, Args&&... args) {
   auto key = std::tuple_cat(std::make_tuple(ctx.run_ctx.ctx.dev_id),
                             Op::MakeKey(param, std::forward<Args>(args)...));
-  static std::unordered_map<decltype(key), cudnn_cxx::Descriptor> op_map;
   static std::mutex mx;
   std::unique_lock<std::mutex> lk(mx);
-  auto it = op_map.find(key);
-  if (it == op_map.end()) {
-    auto op = Op::Make(ctx, param, std::forward<Args>(args)...);
-    it      = op_map.emplace(key, std::move(op)).first;
-  }
+  static std::unordered_multimap<decltype(key), const cudnn_cxx::Descriptor> op_map;
+  auto match_it = [&]() {
+    // Some cuDNN Op implementations require that the thread's cuDNN handle
+    // (used in cudnnBackendExecute()) matches the one used in making the plan.
+    const bool ignore_handles = false;

Review Comment:
   Ok, makes sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org