Skip to content

Commit 7fa2519

Browse files
aelovikov-intelsergey-semenov
authored andcommitted
class DeviceKernelInfo : public CompileTimeKernelInfoTy
1 parent cceffaf commit 7fa2519

File tree

6 files changed

+25
-21
lines changed

6 files changed

+25
-21
lines changed

sycl/include/sycl/detail/kernel_desc.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,16 @@ inline namespace compile_time_kernel_info_v1 {
283283
// at least for as long as we support user apps built with GNU libstdc++'s
284284
// pre-C++11 ABI.
285285
struct CompileTimeKernelInfoTy {
286-
const char *Name = nullptr;
287-
unsigned NumParams = 0;
288-
bool IsESIMD = false;
289-
const char *FileName = "";
290-
const char *FunctionName = "";
291-
unsigned LineNumber = 0;
292-
unsigned ColumnNumber = 0;
293-
int64_t KernelSize;
294-
kernel_param_desc_t (*ParamDescGetter)(int) = nullptr;
295-
bool HasSpecialCaptures = false;
286+
const char * const Name = nullptr;
287+
const unsigned NumParams = 0;
288+
const bool IsESIMD = false;
289+
const char * const FileName = "";
290+
const char *const FunctionName = "";
291+
const unsigned LineNumber = 0;
292+
const unsigned ColumnNumber = 0;
293+
const int64_t KernelSize = 0;
294+
kernel_param_desc_t (*const ParamDescGetter)(int) = nullptr;
295+
const bool HasSpecialCaptures = false;
296296
};
297297

298298
template <class Kernel>

sycl/source/detail/get_kernel_name_based_data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ KernelNameBasedCacheT *createKernelNameBasedCache() {
2222
#endif
2323

2424
DeviceKernelInfo &getDeviceKernelInfo(const CompileTimeKernelInfoTy &Info) {
25-
return ProgramManager::getInstance().getOrCreateDeviceKernelInfo(Info.Name);
25+
return ProgramManager::getInstance().getOrCreateDeviceKernelInfo(Info);
2626
}
2727

2828
} // namespace detail

sycl/source/detail/kernel_name_based_data.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ namespace sycl {
1212
inline namespace _V1 {
1313
namespace detail {
1414

15-
DeviceKernelInfo::DeviceKernelInfo(KernelNameStrRefT KernelName) {
16-
init(KernelName);
15+
DeviceKernelInfo::DeviceKernelInfo(const CompileTimeKernelInfoTy &Info)
16+
: CompileTimeKernelInfoTy(Info) {
17+
init(Name);
1718
}
1819

1920
void DeviceKernelInfo::init(KernelNameStrRefT KernelName) {
@@ -53,4 +54,4 @@ void DeviceKernelInfo::assertInitialized() {
5354

5455
} // namespace detail
5556
} // namespace _V1
56-
} // namespace sycl
57+
} // namespace sycl

sycl/source/detail/kernel_name_based_data.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <detail/hashers.hpp>
1111
#include <detail/kernel_arg_mask.hpp>
1212
#include <emhash/hash_table8.hpp>
13+
#include <sycl/detail/kernel_desc.hpp>
1314
#include <sycl/detail/kernel_name_str_t.hpp>
1415
#include <sycl/detail/spinlock.hpp>
1516
#include <sycl/detail/ur.hpp>
@@ -85,12 +86,12 @@ struct FastKernelSubcacheT {
8586
// TODO Currently this class duplicates information fetched from the program
8687
// manager. Instead, we should merge all of the kernel name based information
8788
// into this structure and get rid of the other KernelName -> * maps.
88-
class DeviceKernelInfo {
89+
class DeviceKernelInfo : public CompileTimeKernelInfoTy {
8990
public:
9091
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
9192
DeviceKernelInfo() = default;
9293
#endif
93-
DeviceKernelInfo(KernelNameStrRefT KernelName);
94+
DeviceKernelInfo(const CompileTimeKernelInfoTy &Info);
9495

9596
void init(KernelNameStrRefT KernelName);
9697
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,8 +1821,9 @@ ProgramManager::kernelImplicitLocalArgPos(KernelNameStrRefT KernelName) const {
18211821
}
18221822

18231823
DeviceKernelInfo &
1824-
ProgramManager::getOrCreateDeviceKernelInfo(KernelNameStrRefT KernelName) {
1825-
auto Result = m_KernelNameBasedDataMap.try_emplace(KernelName, KernelName);
1824+
ProgramManager::getOrCreateDeviceKernelInfo(const CompileTimeKernelInfoTy &Info) {
1825+
auto Result =
1826+
m_KernelNameBasedDataMap.try_emplace(KernelNameStrT{Info.Name}, Info);
18261827
return Result.first->second;
18271828
}
18281829

sycl/source/detail/program_manager/program_manager.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,11 @@ class ProgramManager {
376376
std::optional<int>
377377
kernelImplicitLocalArgPos(KernelNameStrRefT KernelName) const;
378378

379-
DeviceKernelInfo &getOrCreateDeviceKernelInfo(KernelNameStrRefT KernelName);
380379
DeviceKernelInfo &
381-
getOrCreateDeviceKernelInfo(const CompileTimeKernelInfoTy &Info) {
382-
return getOrCreateDeviceKernelInfo(Info.Name);
380+
getOrCreateDeviceKernelInfo(const CompileTimeKernelInfoTy &Info);
381+
DeviceKernelInfo &getOrCreateDeviceKernelInfo(KernelNameStrRefT KernelName) {
382+
return getOrCreateDeviceKernelInfo(
383+
CompileTimeKernelInfoTy{KernelName.data()});
383384
}
384385

385386
std::set<const RTDeviceBinaryImage *>

0 commit comments

Comments
 (0)