[clang] [llvm] [SYCL] Add SYCL property set registry class (PR #136697)
Justin Cai via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 06:51:06 PDT 2025
================
@@ -159,6 +160,107 @@ namespace intel {
/// the Intel runtime offload plugin.
Error containerizeOpenMPSPIRVImage(std::unique_ptr<MemoryBuffer> &Binary);
} // namespace intel
+
+namespace sycl {
+class PropertySetRegistry;
+
+// A property value. It can be either a 32-bit unsigned integer or a byte array.
+class PropertyValue {
+public:
+ using ByteArrayTy = SmallVector<char, 8>;
+
+ PropertyValue() = default;
+ PropertyValue(uint32_t Val) : Value(Val) {}
+ PropertyValue(StringRef Data)
+ : Value(ByteArrayTy(Data.begin(), Data.end())) {}
+
+ template <typename C, typename T = typename C::value_type>
+ PropertyValue(const C &Data)
+ : PropertyValue({reinterpret_cast<const char *>(Data.data()),
+ Data.size() * sizeof(T)}) {}
----------------
jzc wrote:
I've simplified the byte array code compared to the downstream code, but they won't compatible downstream and would cause ABI-break and runtime changes. The downstream implementation always wrote the number of bits the data uses in the first 8 bytes of a byte-array property value, but after some tests, I found this values way never used, except for one place that could be worked around.
https://github.com/intel/llvm/blob/a9db58476ab1e1ff87f128088ac203539d87d22b/llvm/lib/Support/PropertySetIO.cpp#L153-L169
https://github.com/llvm/llvm-project/pull/136697
More information about the llvm-commits
mailing list