forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][Fusion] Cache JIT compiled fused kernels (intel#8051)
Avoid repeating the kernel fusion JIT compilation pipeline if the sequence of kernels to be fused is equivalent to a sequence of kernels fused before. Next to the sequence of kernels, the detected parameter identities & constants as well as the user-specified internalizations play a role for the equivalence of two sequences. This is all incorporated in the cache lookup. The JIT compilation caching (on/off) can be controlled through the configuration/environment variable `SYCL_ENABLE_FUSION_CACHING`, the default is on. Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com> Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>
- Loading branch information
1 parent
a7473fd
commit ab0c46b
Showing
9 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//==---- Hashing.h - helper for hashes for JIT internal representations ----==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef SYCL_FUSION_JIT_COMPILER_HASHING_H | ||
#define SYCL_FUSION_JIT_COMPILER_HASHING_H | ||
|
||
#include "Parameter.h" | ||
|
||
#include "llvm/ADT/Hashing.h" | ||
|
||
#include <tuple> | ||
#include <vector> | ||
|
||
namespace jit_compiler { | ||
inline llvm::hash_code hash_value(const ParameterInternalization &P) { | ||
return llvm::hash_combine(P.LocalSize, P.Intern, P.Param); | ||
} | ||
|
||
inline llvm::hash_code hash_value(const Parameter &P) { | ||
return llvm::hash_combine(P.ParamIdx, P.KernelIdx); | ||
} | ||
|
||
inline llvm::hash_code hash_value(const JITConstant &C) { | ||
return llvm::hash_combine(C.Param, C.Value); | ||
} | ||
|
||
inline llvm::hash_code hash_value(const ParameterIdentity &IP) { | ||
return llvm::hash_combine(IP.LHS, IP.RHS); | ||
} | ||
} // namespace jit_compiler | ||
|
||
namespace std { | ||
template <typename T> inline llvm::hash_code hash_value(const vector<T> &V) { | ||
return llvm::hash_combine_range(V.begin(), V.end()); | ||
} | ||
|
||
template <typename... T> struct hash<tuple<T...>> { | ||
size_t operator()(const tuple<T...> &Tuple) const noexcept { | ||
return llvm::hash_value(Tuple); | ||
} | ||
}; | ||
} // namespace std | ||
|
||
#endif // SYCL_FUSION_JIT_COMPILER_HASHING_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters