Skip to content

Commit 0224ec0

Browse files
committed
Merge branch 'sycl' into sycl-web
2 parents 55eebe0 + a8d6290 commit 0224ec0

File tree

82 files changed

+1037
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1037
-235
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
jobs:
77
code_formatter:
88
runs-on: ubuntu-latest
9-
if: github.repository == 'llvm/llvm-project' || github.repository == 'intel/llvm'
9+
if: (github.repository == 'llvm/llvm-project' || github.repository == 'intel/llvm') && !contains(github.event.pull_request.labels.*.name, 'disable-lint')
1010
steps:
1111
- name: Fetch LLVM sources
1212
uses: actions/checkout@v4

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
198198
Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
199199
DiagnosticsEngine &Diags, std::string Title,
200200
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
201-
: Diags(Diags), VFS(std::move(VFS)), Mode(GCCMode),
202-
SaveTemps(SaveTempsNone), DumpDeviceCode(false), BitcodeEmbed(EmbedNone),
201+
: Diags(Diags), VFS(std::move(VFS)), DumpDeviceCode(false), Mode(GCCMode),
202+
SaveTemps(SaveTempsNone), BitcodeEmbed(EmbedNone),
203203
Offload(OffloadHostDevice), CXX20HeaderType(HeaderMode_None),
204204
ModulesModeCXX20(false), LTOMode(LTOK_None), OffloadLTOMode(LTOK_None),
205205
ClangExecutable(ClangExecutable), SysRoot(DEFAULT_SYSROOT),

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10283,7 +10283,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
1028310283
// TODO: Try to extend this feature for non-Intel GPUs.
1028410284
if (!TCArgs.hasFlag(options::OPT_fno_sycl_remove_unused_external_funcs,
1028510285
options::OPT_fsycl_remove_unused_external_funcs, false) &&
10286-
!T.isNVPTX() && !T.isAMDGPU())
10286+
!T.isNVPTX() && !T.isAMDGPU() &&
10287+
!isSYCLNativeCPU(getToolChain(), C.getDefaultToolChain()))
1028710288
addArgs(CmdArgs, TCArgs, {"-emit-only-kernels-as-entry-points"});
1028810289

1028910290
// OPT_fsycl_device_code_split is not checked as it is an alias to

clang/test/Driver/sycl-native-cpu-fsycl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
//CHECK_INVO:{{.*}}clang{{.*}}-fsycl-is-device{{.*}}"-fsycl-is-native-cpu" "-D" "__SYCL_NATIVE_CPU__"
4141
//CHECK_INVO:{{.*}}clang{{.*}}"-x" "ir"
42+
//CHECK_INVO-NOT:{{.*}}sycl-post-link{{.*}}-emit-only-kernels-as-entry-points
4243
//CHECK_INVO:{{.*}}clang{{.*}}"-fsycl-is-host"{{.*}}
4344

4445
// checks that the device and host triple is correct in the generated actions when it is set explicitly

sycl-fusion/jit-compiler/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
add_llvm_library(sycl-fusion
33
lib/KernelFusion.cpp
4-
lib/JITContext.cpp
54
lib/translation/KernelTranslation.cpp
65
lib/translation/SPIRVLLVMTranslation.cpp
76
lib/fusion/FusionPipeline.cpp
87
lib/fusion/FusionHelper.cpp
8+
lib/fusion/JITContext.cpp
99
lib/fusion/ModuleHelper.cpp
1010
lib/helper/ConfigHelper.cpp
1111

sycl-fusion/jit-compiler/include/KernelFusion.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef SYCL_FUSION_JIT_COMPILER_KERNELFUSION_H
1010
#define SYCL_FUSION_JIT_COMPILER_KERNELFUSION_H
1111

12-
#include "JITContext.h"
1312
#include "Kernel.h"
1413
#include "Options.h"
1514
#include "Parameter.h"
@@ -55,16 +54,14 @@ class FusionResult {
5554
class KernelFusion {
5655

5756
public:
58-
static FusionResult
59-
fuseKernels(JITContext &JITCtx, Config &&JITConfig,
60-
const std::vector<SYCLKernelInfo> &KernelInformation,
61-
const std::vector<std::string> &KernelsToFuse,
62-
const std::string &FusedKernelName,
63-
jit_compiler::ParamIdentList &Identities,
64-
BarrierFlags BarriersFlags,
65-
const std::vector<jit_compiler::ParameterInternalization>
66-
&Internalization,
67-
const std::vector<jit_compiler::JITConstant> &JITConstants);
57+
static FusionResult fuseKernels(
58+
Config &&JITConfig, const std::vector<SYCLKernelInfo> &KernelInformation,
59+
const std::vector<std::string> &KernelsToFuse,
60+
const std::string &FusedKernelName,
61+
jit_compiler::ParamIdentList &Identities, BarrierFlags BarriersFlags,
62+
const std::vector<jit_compiler::ParameterInternalization>
63+
&Internalization,
64+
const std::vector<jit_compiler::JITConstant> &JITConstants);
6865
};
6966

7067
} // namespace jit_compiler

sycl-fusion/jit-compiler/lib/KernelFusion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ static bool isTargetFormatSupported(BinaryFormat TargetFormat) {
7272
}
7373

7474
FusionResult KernelFusion::fuseKernels(
75-
JITContext &JITCtx, Config &&JITConfig,
76-
const std::vector<SYCLKernelInfo> &KernelInformation,
75+
Config &&JITConfig, const std::vector<SYCLKernelInfo> &KernelInformation,
7776
const std::vector<std::string> &KernelsToFuse,
7877
const std::string &FusedKernelName, ParamIdentList &Identities,
7978
BarrierFlags BarriersFlags,
@@ -103,6 +102,7 @@ FusionResult KernelFusion::fuseKernels(
103102
"Fusion output target format not supported by this build");
104103
}
105104

105+
auto &JITCtx = JITContext::getInstance();
106106
bool CachingEnabled = ConfigHelper::get<option::JITEnableCaching>();
107107
CacheKeyT CacheKey{TargetArch,
108108
KernelsToFuse,

sycl-fusion/jit-compiler/include/Hashing.h renamed to sycl-fusion/jit-compiler/lib/fusion/Hashing.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef SYCL_FUSION_JIT_COMPILER_HASHING_H
10-
#define SYCL_FUSION_JIT_COMPILER_HASHING_H
9+
#ifndef SYCL_FUSION_JIT_COMPILER_FUSION_HASHING_H
10+
#define SYCL_FUSION_JIT_COMPILER_FUSION_HASHING_H
1111

1212
#include "Kernel.h"
1313
#include "Parameter.h"
@@ -57,4 +57,4 @@ template <typename... T> struct hash<tuple<T...>> {
5757
};
5858
} // namespace std
5959

60-
#endif // SYCL_FUSION_JIT_COMPILER_HASHING_H
60+
#endif // SYCL_FUSION_JIT_COMPILER_FUSION_HASHING_H

sycl-fusion/jit-compiler/lib/JITContext.cpp renamed to sycl-fusion/jit-compiler/lib/fusion/JITContext.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ BinaryFormat KernelBinary::format() const { return Format; }
2525

2626
JITContext::JITContext() : LLVMCtx{new llvm::LLVMContext}, Binaries{} {}
2727

28-
JITContext::~JITContext() = default;
29-
3028
llvm::LLVMContext *JITContext::getLLVMContext() { return LLVMCtx.get(); }
3129

3230
std::optional<SYCLKernelInfo>

sycl-fusion/jit-compiler/include/JITContext.h renamed to sycl-fusion/jit-compiler/lib/fusion/JITContext.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef SYCL_FUSION_JIT_COMPILER_JITCONTEXT_H
10-
#define SYCL_FUSION_JIT_COMPILER_JITCONTEXT_H
9+
#ifndef SYCL_FUSION_JIT_COMPILER_FUSION_JITCONTEXT_H
10+
#define SYCL_FUSION_JIT_COMPILER_FUSION_JITCONTEXT_H
1111

1212
#include <memory>
1313
#include <mutex>
@@ -61,9 +61,10 @@ class KernelBinary {
6161
class JITContext {
6262

6363
public:
64-
JITContext();
65-
66-
~JITContext();
64+
static JITContext &getInstance() {
65+
static JITContext Instance{};
66+
return Instance;
67+
}
6768

6869
llvm::LLVMContext *getLLVMContext();
6970

@@ -77,6 +78,13 @@ class JITContext {
7778
void addCacheEntry(CacheKeyT &Identifier, SYCLKernelInfo &Kernel);
7879

7980
private:
81+
JITContext();
82+
~JITContext() = default;
83+
JITContext(const JITContext &) = delete;
84+
JITContext(JITContext &&) = delete;
85+
JITContext &operator=(const JITContext &) = delete;
86+
JITContext &operator=(const JITContext &&) = delete;
87+
8088
// FIXME: Change this to std::shared_mutex after switching to C++17.
8189
using MutexT = std::shared_timed_mutex;
8290

@@ -96,4 +104,4 @@ class JITContext {
96104
};
97105
} // namespace jit_compiler
98106

99-
#endif // SYCL_FUSION_JIT_COMPILER_JITCONTEXT_H
107+
#endif // SYCL_FUSION_JIT_COMPILER_FUSION_JITCONTEXT_H

0 commit comments

Comments
 (0)