diff --git a/sycl-fusion/common/include/Kernel.h b/sycl-fusion/common/include/Kernel.h index 9ac88db241eed..c889552bf6e07 100644 --- a/sycl-fusion/common/include/Kernel.h +++ b/sycl-fusion/common/include/Kernel.h @@ -12,12 +12,11 @@ #include "DynArray.h" #include -#include #include #include #include -#include -#include +#include +#include namespace jit_compiler { @@ -350,33 +349,6 @@ struct SYCLKernelInfo { : Name{KernelName}, Args{NumArgs}, Attributes{}, NDR{}, BinaryInfo{} {} }; -/// -/// Represents a SPIR-V translation unit containing SYCL kernels by the -/// KernelInfo for each of the contained kernels. -class SYCLModuleInfo { -public: - using KernelInfoList = std::vector; - - void addKernel(SYCLKernelInfo &Kernel) { Kernels.push_back(Kernel); } - - KernelInfoList &kernels() { return Kernels; } - - bool hasKernelFor(const std::string &KernelName) { - return getKernelFor(KernelName) != nullptr; - } - - SYCLKernelInfo *getKernelFor(const std::string &KernelName) { - auto It = - std::find_if(Kernels.begin(), Kernels.end(), [&](SYCLKernelInfo &K) { - return K.Name == KernelName.c_str(); - }); - return (It != Kernels.end()) ? &*It : nullptr; - } - -private: - KernelInfoList Kernels; -}; - } // namespace jit_compiler #endif // SYCL_FUSION_COMMON_KERNEL_H diff --git a/sycl-fusion/common/lib/ModuleInfo.h b/sycl-fusion/common/lib/ModuleInfo.h new file mode 100644 index 0000000000000..0a5aa7b30932b --- /dev/null +++ b/sycl-fusion/common/lib/ModuleInfo.h @@ -0,0 +1,49 @@ +//==------------ ModuleInfo.h - Manages kernel info for the JIT ------------==// +// +// 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_COMMON_MODULEINFO_H +#define SYCL_FUSION_COMMON_MODULEINFO_H + +#include "Kernel.h" + +#include +#include +#include + +namespace jit_compiler { + +/// +/// Represents a SPIR-V translation unit containing SYCL kernels by the +/// KernelInfo for each of the contained kernels. +class SYCLModuleInfo { +public: + using KernelInfoList = std::vector; + + void addKernel(SYCLKernelInfo &Kernel) { Kernels.push_back(Kernel); } + + KernelInfoList &kernels() { return Kernels; } + + bool hasKernelFor(const std::string &KernelName) { + return getKernelFor(KernelName) != nullptr; + } + + SYCLKernelInfo *getKernelFor(const std::string &KernelName) { + auto It = + std::find_if(Kernels.begin(), Kernels.end(), [&](SYCLKernelInfo &K) { + return K.Name == KernelName.c_str(); + }); + return (It != Kernels.end()) ? &*It : nullptr; + } + +private: + KernelInfoList Kernels; +}; + +} // namespace jit_compiler + +#endif // SYCL_FUSION_COMMON_MODULEINFO_H diff --git a/sycl-fusion/jit-compiler/lib/fusion/FusionPipeline.h b/sycl-fusion/jit-compiler/lib/fusion/FusionPipeline.h index 642206025224f..61ae8e0bcb274 100644 --- a/sycl-fusion/jit-compiler/lib/fusion/FusionPipeline.h +++ b/sycl-fusion/jit-compiler/lib/fusion/FusionPipeline.h @@ -10,6 +10,7 @@ #define SYCL_FUSION_JIT_COMPILER_FUSION_FUSIONPIPELINE_H #include "Kernel.h" +#include "ModuleInfo.h" #include "llvm/IR/Module.h" namespace jit_compiler { diff --git a/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.h b/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.h index 85a2c9ca4845a..b590ac1f5edbf 100644 --- a/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.h +++ b/sycl-fusion/passes/kernel-fusion/SYCLKernelFusion.h @@ -10,6 +10,7 @@ #define SYCL_FUSION_PASSES_SYCLKERNELFUSION_H #include "Kernel.h" +#include "ModuleInfo.h" #include "target/TargetFusionInfo.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" diff --git a/sycl-fusion/passes/kernel-info/SYCLKernelInfo.h b/sycl-fusion/passes/kernel-info/SYCLKernelInfo.h index 8baf04d76c7c3..306cd0d912004 100644 --- a/sycl-fusion/passes/kernel-info/SYCLKernelInfo.h +++ b/sycl-fusion/passes/kernel-info/SYCLKernelInfo.h @@ -13,6 +13,7 @@ #include "llvm/Passes/PassPlugin.h" #include "Kernel.h" +#include "ModuleInfo.h" /// /// Analysis pass to make the SYCLModuleInfo available to other