Skip to content

[SYCL] Get rid of ifunc GNU extension uses #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified sycl/doc/Compiler-HLD.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class buffer {

size_t BufSize = 0;
PI_CALL(detail::RT::piMemGetInfo(
detail::pi_cast<detail::RT::PiMem>(MemObject), CL_MEM_SIZE,
detail::pi::pi_cast<detail::RT::PiMem>(MemObject), CL_MEM_SIZE,
sizeof(size_t), &BufSize, nullptr));

Range[0] = BufSize / sizeof(T);
Expand Down
Empty file modified sycl/include/CL/sycl/detail/aligned_allocator.hpp
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/buffer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ template <typename AllocatorT> class buffer_impl : public SYCLMemObjT {
"Creation of interoperability buffer using host context is not "
"allowed");

RT::PiMem Mem = pi_cast<RT::PiMem>(MInteropMemObject);
RT::PiMem Mem = pi::pi_cast<RT::PiMem>(MInteropMemObject);
RT::PiContext Context = nullptr;
PI_CALL(RT::piMemGetInfo(
Mem, CL_MEM_CONTEXT, sizeof(Context), &Context, nullptr));
Expand All @@ -217,7 +217,7 @@ template <typename AllocatorT> class buffer_impl : public SYCLMemObjT {
releaseHostMem(MShadowCopy);

if (MOpenCLInterop)
PI_CALL(RT::piMemRelease(pi_cast<RT::PiMem>(MInteropMemObject)));
PI_CALL(RT::piMemRelease(pi::pi_cast<RT::PiMem>(MInteropMemObject)));
}

void set_final_data(std::nullptr_t) { MUploadDataFn = nullptr; }
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/clusm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ inline cl::sycl::detail::usm::CLUSM *GetCLUSM() {
}

cl::sycl::detail::usm::CLUSM *retVal = nullptr;
if (cl::sycl::detail::piUseBackend(
cl::sycl::detail::PiBackend::SYCL_BE_PI_OPENCL)) {
if (cl::sycl::detail::pi::piUseBackend(
cl::sycl::detail::pi::PiBackend::SYCL_BE_PI_OPENCL)) {
retVal = gCLUSM;
}
return retVal;
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/context_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ template <info::context param> struct get_context_info {
static RetType _(RT::PiContext ctx) {
RetType Result = 0;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piContextGetInfo(ctx, pi_cast<pi_context_info>(param),
PI_CALL(RT::piContextGetInfo(ctx, pi::pi_cast<pi_context_info>(param),
sizeof(Result), &Result, nullptr));
return Result;
}
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/device_impl.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class device_impl_pi : public device_impl {
PI_CALL(RT::piDeviceRetain(m_device));
}
// TODO: check that device is an OpenCL interop one
return pi_cast<cl_device_id>(m_device);
return pi::pi_cast<cl_device_id>(m_device);
}

RT::PiDevice &getHandleRef() override { return m_device; }
Expand Down
30 changes: 15 additions & 15 deletions sycl/include/CL/sycl/detail/device_info.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ template <typename T, info::device param> struct get_device_info {
static T _(RT::PiDevice dev) {
typename sycl_to_pi<T>::type result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
dev, pi::pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
return T(result);
}
};
Expand All @@ -60,7 +60,7 @@ struct get_device_info<platform, param> {
static platform _(RT::PiDevice dev) {
typename sycl_to_pi<platform>::type result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
dev, pi::pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
return createSyclObjFromImpl<platform>(
std::make_shared<platform_impl_pi>(result));
}
Expand All @@ -71,13 +71,13 @@ template <info::device param> struct get_device_info<string_class, param> {
static string_class _(RT::PiDevice dev) {
size_t resultSize;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(param), 0, NULL, &resultSize));
dev, pi::pi_cast<RT::PiDeviceInfo>(param), 0, NULL, &resultSize));
if (resultSize == 0) {
return string_class();
}
unique_ptr_class<char[]> result(new char[resultSize]);
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(param),
dev, pi::pi_cast<RT::PiDeviceInfo>(param),
resultSize, result.get(), NULL));

return string_class(result.get());
Expand All @@ -95,7 +95,7 @@ template <info::device param> struct get_device_info<id<3>, param> {
static id<3> _(RT::PiDevice dev) {
size_t result[3];
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
dev, pi::pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
return id<3>(result[0], result[1], result[2]);
}
};
Expand All @@ -113,7 +113,7 @@ struct get_device_info<vector_class<info::fp_config>, param> {
}
cl_device_fp_config result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
dev, pi::pi_cast<RT::PiDeviceInfo>(param), sizeof(result), &result, NULL));
return read_fp_bitfield(result);
}
};
Expand All @@ -125,7 +125,7 @@ struct get_device_info<vector_class<info::fp_config>,
static vector_class<info::fp_config> _(RT::PiDevice dev) {
cl_device_fp_config result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(info::device::single_fp_config),
dev, pi::pi_cast<RT::PiDeviceInfo>(info::device::single_fp_config),
sizeof(result), &result, NULL));
return read_fp_bitfield(result);
}
Expand All @@ -136,7 +136,7 @@ template <> struct get_device_info<bool, info::device::queue_profiling> {
static bool _(RT::PiDevice dev) {
cl_command_queue_properties result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(info::device::queue_profiling),
dev, pi::pi_cast<RT::PiDeviceInfo>(info::device::queue_profiling),
sizeof(result), &result, NULL));
return (result & CL_QUEUE_PROFILING_ENABLE);
}
Expand All @@ -149,7 +149,7 @@ struct get_device_info<vector_class<info::execution_capability>,
static vector_class<info::execution_capability> _(RT::PiDevice dev) {
cl_device_exec_capabilities result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
dev, pi::pi_cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
sizeof(result), &result, NULL));
return read_execution_bitfield(result);
}
Expand Down Expand Up @@ -183,7 +183,7 @@ struct get_device_info<vector_class<info::partition_property>,
info::device::partition_properties> {
static vector_class<info::partition_property> _(RT::PiDevice dev) {
auto info_partition =
pi_cast<RT::PiDeviceInfo>(info::device::partition_properties);
pi::pi_cast<RT::PiDeviceInfo>(info::device::partition_properties);

size_t resultSize;
PI_CALL(RT::piDeviceGetInfo(dev, info_partition, 0, NULL, &resultSize));
Expand Down Expand Up @@ -212,7 +212,7 @@ struct get_device_info<vector_class<info::partition_affinity_domain>,
static vector_class<info::partition_affinity_domain> _(RT::PiDevice dev) {
cl_device_affinity_domain result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
dev, pi::pi_cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
sizeof(result), &result, NULL));
return read_domain_bitfield(result);
}
Expand All @@ -226,15 +226,15 @@ struct get_device_info<info::partition_affinity_domain,
static info::partition_affinity_domain _(RT::PiDevice dev) {
size_t resultSize;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(
dev, pi::pi_cast<RT::PiDeviceInfo>(
info::device::partition_type_affinity_domain),
0, NULL, &resultSize));
if (resultSize != 1) {
return info::partition_affinity_domain::not_applicable;
}
cl_device_partition_property result;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(
dev, pi::pi_cast<RT::PiDeviceInfo>(
info::device::partition_type_affinity_domain),
sizeof(result), &result, NULL));
if (result == CL_DEVICE_AFFINITY_DOMAIN_NUMA ||
Expand Down Expand Up @@ -278,12 +278,12 @@ struct get_device_info<vector_class<size_t>,
static vector_class<size_t> _(RT::PiDevice dev) {
size_t resultSize = 0;
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
dev, pi::pi_cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
0, nullptr, &resultSize));

vector_class<size_t> result(resultSize);
PI_CALL(RT::piDeviceGetInfo(
dev, pi_cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
dev, pi::pi_cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
resultSize, result.data(), nullptr));
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/kernel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class kernel_impl {
throw invalid_object_error("This instance of kernel is a host instance");
}
PI_CALL(RT::piKernelRetain(Kernel));
return pi_cast<cl_kernel>(Kernel);
return pi::pi_cast<cl_kernel>(Kernel);
}

bool is_host() const { return Context.is_host(); }
Expand Down
89 changes: 89 additions & 0 deletions sycl/include/CL/sycl/detail/pi.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//==------------ pi.def Plugin Interface list of API -----------------------==//
//
// 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 _PI_API
#error Undefined _PI_API macro expansion
#endif

// The list of all PI interfaces wrapped with _PI_API macro.
// This is for convinience of doing same thing for all interfaces, e.g.
// declare, define, initialize.
//
// Platform
_PI_API(piPlatformsGet)
_PI_API(piPlatformGetInfo)
// Device
_PI_API(piDevicesGet)
_PI_API(piDeviceGetInfo)
_PI_API(piDevicePartition)
_PI_API(piDeviceRetain)
_PI_API(piDeviceRelease)
_PI_API(piextDeviceSelectBinary)
// Context
_PI_API(piContextCreate)
_PI_API(piContextGetInfo)
_PI_API(piContextRetain)
_PI_API(piContextRelease)
// Queue
_PI_API(piQueueCreate)
_PI_API(piQueueGetInfo)
_PI_API(piQueueFinish)
_PI_API(piQueueRetain)
_PI_API(piQueueRelease)
// Memory
_PI_API(piMemCreate)
_PI_API(piMemGetInfo)
_PI_API(piMemRetain)
_PI_API(piMemRelease)
// Program
_PI_API(piProgramCreate)
_PI_API(piclProgramCreateWithSource)
_PI_API(piclProgramCreateWithBinary)
_PI_API(piProgramGetInfo)
_PI_API(piProgramCompile)
_PI_API(piProgramBuild)
_PI_API(piProgramLink)
_PI_API(piProgramGetBuildInfo)
_PI_API(piProgramRetain)
_PI_API(piProgramRelease)
// Kernel
_PI_API(piKernelCreate)
_PI_API(piKernelSetArg)
_PI_API(piKernelGetInfo)
_PI_API(piKernelGetGroupInfo)
_PI_API(piKernelGetSubGroupInfo)
_PI_API(piKernelRetain)
_PI_API(piKernelRelease)
// Event
_PI_API(piEventCreate)
_PI_API(piEventGetInfo)
_PI_API(piEventGetProfilingInfo)
_PI_API(piEventsWait)
_PI_API(piEventSetCallback)
_PI_API(piEventSetStatus)
_PI_API(piEventRetain)
_PI_API(piEventRelease)
// Sampler
_PI_API(piSamplerCreate)
_PI_API(piSamplerGetInfo)
_PI_API(piSamplerRetain)
_PI_API(piSamplerRelease)
// Queue commands
_PI_API(piEnqueueKernelLaunch)
_PI_API(piEnqueueEventsWait)
_PI_API(piEnqueueMemRead)
_PI_API(piEnqueueMemReadRect)
_PI_API(piEnqueueMemWrite)
_PI_API(piEnqueueMemWriteRect)
_PI_API(piEnqueueMemCopy)
_PI_API(piEnqueueMemCopyRect)
_PI_API(piEnqueueMemFill)
_PI_API(piEnqueueMemMap)
_PI_API(piEnqueueMemUnmap)

#undef _PI_API
Empty file modified sycl/include/CL/sycl/detail/pi.h
100755 → 100644
Empty file.
Loading