Skip to content

Commit fd636ef

Browse files
[SYCL] Non-standard RT namespace removed (#7133) (#9972)
Continuation of previous partial removal (#9837)
1 parent 79ea9b7 commit fd636ef

Some content is hidden

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

63 files changed

+919
-774
lines changed

sycl/include/sycl/detail/backend_traits_opencl.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ namespace pi {
162162
// Cast for std::vector<cl_event>, according to the spec, make_event
163163
// should create one(?) event from a vector of cl_event
164164
template <class To> inline To cast(std::vector<cl_event> value) {
165-
RT::assertion(value.size() == 1,
166-
"Temporary workaround requires that the "
167-
"size of the input vector for make_event be equal to one.");
165+
sycl::detail::pi::assertion(
166+
value.size() == 1,
167+
"Temporary workaround requires that the "
168+
"size of the input vector for make_event be equal to one.");
168169
return cast<To>(value[0]);
169170
}
170171

sycl/include/sycl/detail/cg.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class CGExecKernel : public CG {
167167
std::string MKernelName;
168168
std::vector<std::shared_ptr<detail::stream_impl>> MStreams;
169169
std::vector<std::shared_ptr<const void>> MAuxiliaryResources;
170-
RT::PiKernelCacheConfig MKernelCacheConfig;
170+
sycl::detail::pi::PiKernelCacheConfig MKernelCacheConfig;
171171

172172
CGExecKernel(NDRDescT NDRDesc, std::shared_ptr<HostKernelBase> HKernel,
173173
std::shared_ptr<detail::kernel_impl> SyclKernel,
@@ -176,7 +176,8 @@ class CGExecKernel : public CG {
176176
std::string KernelName,
177177
std::vector<std::shared_ptr<detail::stream_impl>> Streams,
178178
std::vector<std::shared_ptr<const void>> AuxiliaryResources,
179-
CGTYPE Type, RT::PiKernelCacheConfig KernelCacheConfig,
179+
CGTYPE Type,
180+
sycl::detail::pi::PiKernelCacheConfig KernelCacheConfig,
180181
detail::code_location loc = {})
181182
: CG(Type, std::move(CGData), std::move(loc)),
182183
MNDRDesc(std::move(NDRDesc)), MHostKernel(std::move(HKernel)),

sycl/include/sycl/detail/helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace detail {
4040
class context_impl;
4141
// The function returns list of events that can be passed to OpenCL API as
4242
// dependency list and waits for others.
43-
__SYCL_EXPORT std::vector<RT::PiEvent>
43+
__SYCL_EXPORT std::vector<sycl::detail::pi::PiEvent>
4444
getOrWaitEvents(std::vector<sycl::event> DepEvents,
4545
std::shared_ptr<sycl::detail::context_impl> Context);
4646

sycl/include/sycl/detail/pi.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData,
241241

242242
} // namespace pi
243243

244-
namespace RT = sycl::detail::pi;
245-
246244
// Workaround for build with GCC 5.x
247245
// An explicit specialization shall be declared in the namespace block.
248246
// Having namespace as part of template name is not supported by GCC
@@ -253,7 +251,8 @@ namespace pi {
253251
// operators.
254252
template <class To, class From> inline To cast(From value) {
255253
// TODO: see if more sanity checks are possible.
256-
RT::assertion((sizeof(From) == sizeof(To)), "assert: cast failed size check");
254+
sycl::detail::pi::assertion((sizeof(From) == sizeof(To)),
255+
"assert: cast failed size check");
257256
return (To)(value);
258257
}
259258

sycl/source/backend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ __SYCL_EXPORT queue make_queue(pi_native_handle NativeHandle,
104104
const device *Device, bool KeepOwnership,
105105
const property_list &PropList,
106106
const async_handler &Handler, backend Backend) {
107-
RT::PiDevice PiDevice =
107+
sycl::detail::pi::PiDevice PiDevice =
108108
Device ? getSyclObjImpl(*Device)->getHandleRef() : nullptr;
109109
const auto &Plugin = getPlugin(Backend);
110110
const auto &ContextImpl = getSyclObjImpl(Context);
111111

112112
// Create PI properties from SYCL properties.
113-
RT::PiQueueProperties Properties[] = {
113+
sycl::detail::pi::PiQueueProperties Properties[] = {
114114
PI_QUEUE_FLAGS,
115115
queue_impl::createPiQueueProperties(
116116
PropList, PropList.has_property<property::queue::in_order>()

sycl/source/backend/opencl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ __SYCL_EXPORT bool has_extension(const sycl::platform &SyclPlatform,
6161

6262
std::shared_ptr<sycl::detail::platform_impl> PlatformImpl =
6363
getSyclObjImpl(SyclPlatform);
64-
detail::RT::PiPlatform PluginPlatform = PlatformImpl->getHandleRef();
64+
sycl::detail::pi::PiPlatform PluginPlatform = PlatformImpl->getHandleRef();
6565
const PluginPtr &Plugin = PlatformImpl->getPlugin();
6666

6767
// Manual invocation of plugin API to avoid using deprecated
@@ -92,7 +92,7 @@ __SYCL_EXPORT bool has_extension(const sycl::device &SyclDevice,
9292

9393
std::shared_ptr<sycl::detail::device_impl> DeviceImpl =
9494
getSyclObjImpl(SyclDevice);
95-
detail::RT::PiDevice PluginDevice = DeviceImpl->getHandleRef();
95+
sycl::detail::pi::PiDevice PluginDevice = DeviceImpl->getHandleRef();
9696
const PluginPtr &Plugin = DeviceImpl->getPlugin();
9797

9898
// Manual invocation of plugin API to avoid using deprecated

sycl/source/context.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ context::context(const std::vector<device> &DeviceList,
8787
context::context(cl_context ClContext, async_handler AsyncHandler) {
8888
const auto &Plugin = sycl::detail::pi::getPlugin<backend::opencl>();
8989
impl = std::make_shared<detail::context_impl>(
90-
detail::pi::cast<detail::RT::PiContext>(ClContext), AsyncHandler, Plugin);
90+
detail::pi::cast<sycl::detail::pi::PiContext>(ClContext), AsyncHandler,
91+
Plugin);
9192
}
9293

9394
template <typename Param>

sycl/source/detail/allowlist.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,9 @@ bool deviceIsAllowed(const DeviceDescT &DeviceDesc,
334334
return ShouldDeviceBeAllowed;
335335
}
336336

337-
void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
338-
RT::PiPlatform PiPlatform, const PluginPtr &Plugin) {
337+
void applyAllowList(std::vector<sycl::detail::pi::PiDevice> &PiDevices,
338+
sycl::detail::pi::PiPlatform PiPlatform,
339+
const PluginPtr &Plugin) {
339340

340341
AllowListParsedT AllowListParsed =
341342
parseAllowList(SYCLConfig<SYCL_DEVICE_ALLOWLIST>::get());
@@ -363,13 +364,13 @@ void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
363364
PiPlatform, Plugin));
364365

365366
int InsertIDx = 0;
366-
for (RT::PiDevice Device : PiDevices) {
367+
for (sycl::detail::pi::PiDevice Device : PiDevices) {
367368
auto DeviceImpl = PlatformImpl->getOrMakeDeviceImpl(Device, PlatformImpl);
368369
// get DeviceType value and put it to DeviceDesc
369-
RT::PiDeviceType PiDevType;
370-
Plugin->call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_TYPE,
371-
sizeof(RT::PiDeviceType),
372-
&PiDevType, nullptr);
370+
sycl::detail::pi::PiDeviceType PiDevType;
371+
Plugin->call<PiApiKind::piDeviceGetInfo>(
372+
Device, PI_DEVICE_INFO_TYPE, sizeof(sycl::detail::pi::PiDeviceType),
373+
&PiDevType, nullptr);
373374
sycl::info::device_type DeviceType = pi::cast<info::device_type>(PiDevType);
374375
for (const auto &SyclDeviceType : getSyclDeviceTypeMap()) {
375376
if (SyclDeviceType.second == DeviceType) {

sycl/source/detail/allowlist.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ AllowListParsedT parseAllowList(const std::string &AllowListRaw);
2727
bool deviceIsAllowed(const DeviceDescT &DeviceDesc,
2828
const AllowListParsedT &AllowListParsed);
2929

30-
void applyAllowList(std::vector<RT::PiDevice> &PiDevices,
31-
RT::PiPlatform PiPlatform, const PluginPtr &Plugin);
30+
void applyAllowList(std::vector<sycl::detail::pi::PiDevice> &PiDevices,
31+
sycl::detail::pi::PiPlatform PiPlatform,
32+
const PluginPtr &Plugin);
3233

3334
} // namespace detail
3435
} // __SYCL_INLINE_VER_NAMESPACE(_V1)

sycl/source/detail/buffer_impl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ namespace detail {
2020
uint8_t GBufferStreamID;
2121
#endif
2222
void *buffer_impl::allocateMem(ContextImplPtr Context, bool InitFromUserData,
23-
void *HostPtr, RT::PiEvent &OutEventToWait) {
23+
void *HostPtr,
24+
sycl::detail::pi::PiEvent &OutEventToWait) {
2425
bool HostPtrReadOnly = false;
2526
BaseT::determineHostPtr(Context, InitFromUserData, HostPtr, HostPtrReadOnly);
2627

@@ -52,7 +53,7 @@ void buffer_impl::addInteropObject(
5253
Handles.end()) {
5354
const PluginPtr &Plugin = getPlugin();
5455
Plugin->call<PiApiKind::piMemRetain>(
55-
pi::cast<RT::PiMem>(MInteropMemObject));
56+
pi::cast<sycl::detail::pi::PiMem>(MInteropMemObject));
5657
Handles.push_back(pi::cast<pi_native_handle>(MInteropMemObject));
5758
}
5859
}
@@ -67,7 +68,8 @@ buffer_impl::getNativeVector(backend BackendName) const {
6768
}
6869

6970
for (auto &Cmd : MRecord->MAllocaCommands) {
70-
RT::PiMem NativeMem = pi::cast<RT::PiMem>(Cmd->getMemAllocation());
71+
sycl::detail::pi::PiMem NativeMem =
72+
pi::cast<sycl::detail::pi::PiMem>(Cmd->getMemAllocation());
7173
auto Ctx = Cmd->getWorkerContext();
7274
auto Platform = Ctx->getPlatformImpl();
7375
// If Host Shared Memory is not supported then there is alloca for host that

sycl/source/detail/buffer_impl.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
146146
std::move(Allocator)) {}
147147

148148
void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
149-
void *HostPtr, RT::PiEvent &OutEventToWait) override;
149+
void *HostPtr,
150+
sycl::detail::pi::PiEvent &OutEventToWait) override;
150151
void constructorNotification(const detail::code_location &CodeLoc,
151152
void *UserObj, const void *HostObj,
152153
const void *Type, uint32_t Dim,

sycl/source/detail/context_impl.cpp

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
4545
MPlatform(), MPropList(PropList), MHostContext(false),
4646
MSupportBufferLocationByDevices(NotChecked) {
4747
MPlatform = detail::getSyclObjImpl(MDevices[0].get_platform());
48-
std::vector<RT::PiDevice> DeviceIds;
48+
std::vector<sycl::detail::pi::PiDevice> DeviceIds;
4949
for (const auto &D : MDevices) {
5050
DeviceIds.push_back(getSyclObjImpl(D)->getHandleRef());
5151
}
@@ -69,27 +69,27 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
6969
MKernelProgramCache.setContextPtr(this);
7070
}
7171

72-
context_impl::context_impl(RT::PiContext PiContext, async_handler AsyncHandler,
73-
const PluginPtr &Plugin)
72+
context_impl::context_impl(sycl::detail::pi::PiContext PiContext,
73+
async_handler AsyncHandler, const PluginPtr &Plugin)
7474
: MAsyncHandler(AsyncHandler), MDevices(), MContext(PiContext), MPlatform(),
7575
MHostContext(false), MSupportBufferLocationByDevices(NotChecked) {
7676

77-
std::vector<RT::PiDevice> DeviceIds;
77+
std::vector<sycl::detail::pi::PiDevice> DeviceIds;
7878
size_t DevicesNum = 0;
7979
// TODO catch an exception and put it to list of asynchronous exceptions
8080
Plugin->call<PiApiKind::piContextGetInfo>(
8181
MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,
8282
nullptr);
8383
DeviceIds.resize(DevicesNum);
8484
// TODO catch an exception and put it to list of asynchronous exceptions
85-
Plugin->call<PiApiKind::piContextGetInfo>(MContext, PI_CONTEXT_INFO_DEVICES,
86-
sizeof(RT::PiDevice) * DevicesNum,
87-
&DeviceIds[0], nullptr);
85+
Plugin->call<PiApiKind::piContextGetInfo>(
86+
MContext, PI_CONTEXT_INFO_DEVICES,
87+
sizeof(sycl::detail::pi::PiDevice) * DevicesNum, &DeviceIds[0], nullptr);
8888

8989
if (!DeviceIds.empty()) {
9090
std::shared_ptr<detail::platform_impl> Platform =
9191
platform_impl::getPlatformFromPiDevice(DeviceIds[0], Plugin);
92-
for (RT::PiDevice Dev : DeviceIds) {
92+
for (sycl::detail::pi::PiDevice Dev : DeviceIds) {
9393
MDevices.emplace_back(createSyclObjFromImpl<device>(
9494
Platform->getOrMakeDeviceImpl(Dev, Platform)));
9595
}
@@ -230,8 +230,10 @@ context_impl::get_info<info::context::atomic_fence_scope_capabilities>() const {
230230
return CapabilityList;
231231
}
232232

233-
RT::PiContext &context_impl::getHandleRef() { return MContext; }
234-
const RT::PiContext &context_impl::getHandleRef() const { return MContext; }
233+
sycl::detail::pi::PiContext &context_impl::getHandleRef() { return MContext; }
234+
const sycl::detail::pi::PiContext &context_impl::getHandleRef() const {
235+
return MContext;
236+
}
235237

236238
KernelProgramCache &context_impl::getKernelProgramCache() const {
237239
return MKernelProgramCache;
@@ -245,8 +247,8 @@ bool context_impl::hasDevice(
245247
return false;
246248
}
247249

248-
DeviceImplPtr
249-
context_impl::findMatchingDeviceImpl(RT::PiDevice &DevicePI) const {
250+
DeviceImplPtr context_impl::findMatchingDeviceImpl(
251+
sycl::detail::pi::PiDevice &DevicePI) const {
250252
for (device D : MDevices)
251253
if (getSyclObjImpl(D)->getHandleRef() == DevicePI)
252254
return getSyclObjImpl(D);
@@ -283,7 +285,7 @@ void context_impl::addAssociatedDeviceGlobal(const void *DeviceGlobalPtr) {
283285
}
284286

285287
void context_impl::addDeviceGlobalInitializer(
286-
RT::PiProgram Program, const std::vector<device> &Devs,
288+
sycl::detail::pi::PiProgram Program, const std::vector<device> &Devs,
287289
const RTDeviceBinaryImage *BinImage) {
288290
std::lock_guard<std::mutex> Lock(MDeviceGlobalInitializersMutex);
289291
for (const device &Dev : Devs) {
@@ -292,7 +294,7 @@ void context_impl::addDeviceGlobalInitializer(
292294
}
293295
}
294296

295-
std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
297+
std::vector<sycl::detail::pi::PiEvent> context_impl::initializeDeviceGlobals(
296298
pi::PiProgram NativePrg, const std::shared_ptr<queue_impl> &QueueImpl) {
297299
const PluginPtr &Plugin = getPlugin();
298300
const DeviceImplPtr &DeviceImpl = QueueImpl->getDeviceImplPtr();
@@ -306,12 +308,13 @@ std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
306308
DeviceGlobalInitializer &InitRef = ImgIt->second;
307309
{
308310
std::lock_guard<std::mutex> InitLock(InitRef.MDeviceGlobalInitMutex);
309-
std::vector<RT::PiEvent> &InitEventsRef = InitRef.MDeviceGlobalInitEvents;
311+
std::vector<sycl::detail::pi::PiEvent> &InitEventsRef =
312+
InitRef.MDeviceGlobalInitEvents;
310313
if (!InitEventsRef.empty()) {
311314
// Initialization has begun but we do not know if the events are done.
312315
auto NewEnd = std::remove_if(
313316
InitEventsRef.begin(), InitEventsRef.end(),
314-
[&Plugin](const RT::PiEvent &Event) {
317+
[&Plugin](const sycl::detail::pi::PiEvent &Event) {
315318
return get_event_info<info::event::command_execution_status>(
316319
Event, Plugin) == info::event_command_status::complete;
317320
});
@@ -373,7 +376,7 @@ std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
373376

374377
// Write the pointer to the device global and store the event in the
375378
// initialize events list.
376-
RT::PiEvent InitEvent;
379+
sycl::detail::pi::PiEvent InitEvent;
377380
void *const &USMPtr = DeviceGlobalUSM.getPtr();
378381
Plugin->call<PiApiKind::piextEnqueueDeviceGlobalVariableWrite>(
379382
QueueImpl->getHandleRef(), NativePrg,
@@ -389,7 +392,7 @@ std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
389392

390393
void context_impl::DeviceGlobalInitializer::ClearEvents(
391394
const PluginPtr &Plugin) {
392-
for (const RT::PiEvent &Event : MDeviceGlobalInitEvents)
395+
for (const sycl::detail::pi::PiEvent &Event : MDeviceGlobalInitEvents)
393396
Plugin->call<PiApiKind::piEventRelease>(Event);
394397
MDeviceGlobalInitEvents.clear();
395398
}
@@ -398,7 +401,7 @@ void context_impl::memcpyToHostOnlyDeviceGlobal(
398401
const std::shared_ptr<device_impl> &DeviceImpl, const void *DeviceGlobalPtr,
399402
const void *Src, size_t DeviceGlobalTSize, bool IsDeviceImageScoped,
400403
size_t NumBytes, size_t Offset) {
401-
std::optional<RT::PiDevice> KeyDevice = std::nullopt;
404+
std::optional<sycl::detail::pi::PiDevice> KeyDevice = std::nullopt;
402405
if (IsDeviceImageScoped)
403406
KeyDevice = DeviceImpl->getHandleRef();
404407
auto Key = std::make_pair(DeviceGlobalPtr, KeyDevice);
@@ -421,7 +424,7 @@ void context_impl::memcpyFromHostOnlyDeviceGlobal(
421424
const void *DeviceGlobalPtr, bool IsDeviceImageScoped, size_t NumBytes,
422425
size_t Offset) {
423426

424-
std::optional<RT::PiDevice> KeyDevice = std::nullopt;
427+
std::optional<sycl::detail::pi::PiDevice> KeyDevice = std::nullopt;
425428
if (IsDeviceImageScoped)
426429
KeyDevice = DeviceImpl->getHandleRef();
427430
auto Key = std::make_pair(DeviceGlobalPtr, KeyDevice);
@@ -440,7 +443,7 @@ void context_impl::memcpyFromHostOnlyDeviceGlobal(
440443
std::memcpy(Dest, ValuePtr + Offset, NumBytes);
441444
}
442445

443-
std::optional<RT::PiProgram> context_impl::getProgramForDevImgs(
446+
std::optional<sycl::detail::pi::PiProgram> context_impl::getProgramForDevImgs(
444447
const device &Device, const std::set<std::uintptr_t> &ImgIdentifiers,
445448
const std::string &ObjectTypeName) {
446449

@@ -449,7 +452,8 @@ std::optional<RT::PiProgram> context_impl::getProgramForDevImgs(
449452
auto LockedCache = MKernelProgramCache.acquireCachedPrograms();
450453
auto &KeyMap = LockedCache.get().KeyMap;
451454
auto &Cache = LockedCache.get().Cache;
452-
RT::PiDevice &DevHandle = getSyclObjImpl(Device)->getHandleRef();
455+
sycl::detail::pi::PiDevice &DevHandle =
456+
getSyclObjImpl(Device)->getHandleRef();
453457
for (std::uintptr_t ImageIDs : ImgIdentifiers) {
454458
auto OuterKey = std::make_pair(ImageIDs, DevHandle);
455459
size_t NProgs = KeyMap.count(OuterKey);
@@ -475,13 +479,14 @@ std::optional<RT::PiProgram> context_impl::getProgramForDevImgs(
475479
return *MKernelProgramCache.waitUntilBuilt<compile_program_error>(BuildRes);
476480
}
477481

478-
std::optional<RT::PiProgram> context_impl::getProgramForDeviceGlobal(
482+
std::optional<sycl::detail::pi::PiProgram>
483+
context_impl::getProgramForDeviceGlobal(
479484
const device &Device, DeviceGlobalMapEntry *DeviceGlobalEntry) {
480485
return getProgramForDevImgs(Device, DeviceGlobalEntry->MImageIdentifiers,
481486
"device_global");
482487
}
483488
/// Gets a program associated with a HostPipe Entry from the cache.
484-
std::optional<RT::PiProgram>
489+
std::optional<sycl::detail::pi::PiProgram>
485490
context_impl::getProgramForHostPipe(const device &Device,
486491
HostPipeMapEntry *HostPipeEntry) {
487492
// One HostPipe entry belongs to one Img

0 commit comments

Comments
 (0)