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


##########
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:
   Right, but the plan is eventually to change `ignore_handles` to be a 
function of CUDNN_VERSION, once the proper version is known.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to