From c16e2e5ed10a4bf915afb8671d03247e1311be48 Mon Sep 17 00:00:00 2001 From: Devavret Makkar Date: Tue, 19 May 2020 02:04:58 +0530 Subject: [PATCH] Add context to cache key So that kernels made for one context don't run on another. --- jitify.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jitify.hpp b/jitify.hpp index e70dced..8ada7b9 100644 --- a/jitify.hpp +++ b/jitify.hpp @@ -3285,10 +3285,13 @@ inline KernelInstantiation_impl::KernelInstantiation_impl( _template_inst = (template_args.empty() ? "" : reflection::reflect_template(template_args)); + CUcontext c; + cuCtxGetCurrent(&c); using detail::hash_combine; using detail::hash_larson64; _hash = _kernel._hash; _hash = hash_combine(_hash, hash_larson64(_template_inst.c_str())); + _hash = hash_combine(_hash, std::hash()(c)); JitCache_impl& cache = _kernel._program._cache; uint64_t cache_key = _hash; #if JITIFY_THREAD_SAFE