Skip to content

Commit 5445247

Browse files
committed
remove SYCLRTShared.h to avoid touch LLVM functionality
Signed-off-by: gejin <[email protected]>
1 parent 117bebf commit 5445247

File tree

7 files changed

+46
-39
lines changed

7 files changed

+46
-39
lines changed

llvm/include/llvm/Support/PropertySetIO.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ class PropertySetRegistry {
120120
public:
121121
using MapTy = MapVector<StringRef, PropertySet>;
122122

123+
// Specific property category names used by tools.
124+
static constexpr char SYCL_SPECIALIZATION_CONSTANTS[] =
125+
"SYCL/specialization constants";
126+
static constexpr char SYCL_DEVICELIB_REQ_MASK[] = "SYCL/devicelib req mask";
127+
123128
// Function for bulk addition of an entire property set under given category
124129
// (property set name).
125130
template <typename T>

llvm/include/llvm/Support/SYCLRTShared.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

llvm/lib/Support/PropertySetIO.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,8 @@ template <> uint32_t &PropertyValue::getValueRef<uint32_t>() {
110110
template <> PropertyValue::Type PropertyValue::getTypeTag<uint32_t>() {
111111
return UINT32;
112112
}
113+
114+
constexpr char PropertySetRegistry::SYCL_SPECIALIZATION_CONSTANTS[];
115+
constexpr char PropertySetRegistry::SYCL_DEVICELIB_REQ_MASK[];
113116
} // namespace util
114117
} // namespace llvm

llvm/tools/sycl-post-link/sycl-post-link.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "llvm/Support/InitLLVM.h"
2929
#include "llvm/Support/Path.h"
3030
#include "llvm/Support/PropertySetIO.h"
31-
#include "llvm/Support/SYCLRTShared.h"
3231
#include "llvm/Support/SimpleTable.h"
3332
#include "llvm/Support/SystemUtils.h"
3433
#include "llvm/Support/WithColor.h"
@@ -38,7 +37,6 @@
3837
#include <memory>
3938

4039
using namespace llvm;
41-
using llvm::util::sycl::DeviceLibExt;
4240

4341
using string_vector = std::vector<std::string>;
4442
using SpecIDMapTy = std::map<StringRef, unsigned>;
@@ -51,6 +49,18 @@ static constexpr char COL_CODE[] = "Code";
5149
static constexpr char COL_SYM[] = "Symbols";
5250
static constexpr char COL_PROPS[] = "Properties";
5351
static constexpr char DEVICELIB_FUNC_PREFIX[] = "__devicelib_";
52+
53+
// DeviceLibExt is shared between sycl-post-link tool and sycl runtime.
54+
// If any change is made here, need to sync with DeviceLibExt definition
55+
// in sycl/source/detail/program_manager/program_manager.hpp
56+
enum class DeviceLibExt : std::uint32_t {
57+
cl_intel_devicelib_assert,
58+
cl_intel_devicelib_math,
59+
cl_intel_devicelib_math_fp64,
60+
cl_intel_devicelib_complex,
61+
cl_intel_devicelib_complex_fp64
62+
};
63+
5464
// InputFilename - The filename to read from.
5565
static cl::opt<std::string> InputFilename{
5666
cl::Positional, cl::desc("<input bitcode file>"), cl::init("-"),
@@ -485,15 +495,18 @@ static string_vector saveDeviceImageProperty(
485495
if (ImgPSInfo.NeedDeviceLibReqMask) {
486496
uint32_t MRMask = getModuleReqMask(*ResultModules[I]);
487497
std::map<StringRef, uint32_t> RMEntry = {{"DeviceLibReqMask", MRMask}};
488-
PropSet.add(PROP_SYCL_DEVICELIB_REQ_MASK, RMEntry);
498+
PropSet.add(llvm::util::PropertySetRegistry::SYCL_DEVICELIB_REQ_MASK,
499+
RMEntry);
489500
}
490501
if (ImgPSInfo.DoSpecConst && ImgPSInfo.SetSpecConstAtRT) {
491502
// extract spec constant maps per each module
492503
SpecIDMapTy TmpSpecIDMap;
493504
if (ImgPSInfo.SpecConstsMet)
494505
SpecConstantsPass::collectSpecConstantMetadata(*ResultModules[I].get(),
495506
TmpSpecIDMap);
496-
PropSet.add(PROP_SYCL_SPECIALIZATION_CONSTANTS, TmpSpecIDMap);
507+
PropSet.add(
508+
llvm::util::PropertySetRegistry::SYCL_SPECIALIZATION_CONSTANTS,
509+
TmpSpecIDMap);
497510
}
498511
std::error_code EC;
499512
std::string SCFile = makeResultFileName(".prop", I);

sycl/include/CL/sycl/detail/pi.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,14 @@ static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL = 4;
644644
/// PTX 64-bit image <-> "nvptx64", 64-bit NVIDIA PTX device
645645
#define PI_DEVICE_BINARY_TARGET_NVPTX64 "nvptx64"
646646

647+
/// Device binary image property set names recognized by the SYCL runtime.
648+
/// Name must be consistent with
649+
/// PropertySetRegistry::SYCL_SPECIALIZATION_CONSTANTS defined in
650+
/// PropertySetIO.h
651+
#define PI_PROPERTY_SET_SPEC_CONST_MAP "SYCL/specialization constants"
652+
/// PropertySetRegistry::SYCL_DEVICELIB_REQ_MASK defined in PropertySetIO.h
653+
#define PI_PROPERTY_SET_DEVICELIB_REQ_MASK "SYCL/devicelib req mask"
654+
647655
/// This struct is a record of the device binary information. If the Kind field
648656
/// denotes a portable binary type (SPIR-V or LLVM IR), the DeviceTargetSpec
649657
/// field can still be specific and denote e.g. FPGA target. It must match the

sycl/source/detail/pi.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/// \ingroup sycl_pi
1313

1414
#include "context_impl.hpp"
15-
#include "llvm/Support/SYCLRTShared.h"
1615
#include <CL/sycl/context.hpp>
1716
#include <CL/sycl/detail/common.hpp>
1817
#include <CL/sycl/detail/pi.hpp>
@@ -543,8 +542,8 @@ void DeviceBinaryImage::init(pi_device_binary Bin) {
543542
// try to determine the format; may remain "NONE"
544543
Format = getBinaryImageFormat(Bin->BinaryStart, getSize());
545544

546-
SpecConstIDMap.init(Bin, PROP_SYCL_SPECIALIZATION_CONSTANTS);
547-
DeviceLibReqMask.init(Bin, PROP_SYCL_DEVICELIB_REQ_MASK);
545+
SpecConstIDMap.init(Bin, PI_PROPERTY_SET_SPEC_CONST_MAP);
546+
DeviceLibReqMask.init(Bin, PI_PROPERTY_SET_DEVICELIB_REQ_MASK);
548547
}
549548

550549
} // namespace pi

sycl/source/detail/program_manager/program_manager.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#pragma once
10-
#include "llvm/Support/SYCLRTShared.h"
1110
#include <CL/sycl/detail/common.hpp>
1211
#include <CL/sycl/detail/device_binary_image.hpp>
1312
#include <CL/sycl/detail/export.hpp>
@@ -17,6 +16,7 @@
1716
#include <CL/sycl/detail/util.hpp>
1817
#include <CL/sycl/stl.hpp>
1918

19+
#include <cstdint>
2020
#include <map>
2121
#include <memory>
2222
#include <unordered_map>
@@ -43,7 +43,16 @@ namespace detail {
4343
class context_impl;
4444
using ContextImplPtr = std::shared_ptr<context_impl>;
4545
class program_impl;
46-
using llvm::util::sycl::DeviceLibExt;
46+
// DeviceLibExt is shared between sycl runtime and sycl-post-link tool.
47+
// If any update is made here, need to sync with DeviceLibExt definition
48+
// in llvm/tools/sycl-post-link/sycl-post-link.cpp
49+
enum class DeviceLibExt : std::uint32_t {
50+
cl_intel_devicelib_assert,
51+
cl_intel_devicelib_math,
52+
cl_intel_devicelib_math_fp64,
53+
cl_intel_devicelib_complex,
54+
cl_intel_devicelib_complex_fp64
55+
};
4756

4857
// Provides single loading and building OpenCL programs with unique contexts
4958
// that is necessary for no interoperability cases with lambda.

0 commit comments

Comments
 (0)