Skip to content

[SYCL] Refactor include/sycl/properties/queue_properties.hpp #8048

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 3 commits into from
Jan 27, 2023
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
31 changes: 31 additions & 0 deletions sycl/include/sycl/properties/queue_properties.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// --*- c++ -*---
#ifndef __SYCL_DATA_LESS_PROP
#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL)
#endif
#ifndef __SYCL_MANUALLY_DEFINED_PROP
#define __SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME)
#endif

__SYCL_DATA_LESS_PROP(property::queue, in_order, InOrder)
__SYCL_DATA_LESS_PROP(property::queue, enable_profiling, QueueEnableProfiling)

__SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, discard_events,
DiscardEvents)
__SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, priority_normal,
QueuePriorityNormal)
__SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, priority_low,
QueuePriorityLow)
__SYCL_DATA_LESS_PROP(ext::oneapi::property::queue, priority_high,
QueuePriorityHigh)

__SYCL_DATA_LESS_PROP(ext::oneapi::cuda::property::queue, use_default_stream,
UseDefaultStream)

// Deprecated alias for ext::oneapi::cuda::property::queue.
__SYCL_MANUALLY_DEFINED_PROP(property::queue::cuda, use_default_stream)

// Contains data field, defined explicitly.
__SYCL_MANUALLY_DEFINED_PROP(ext::intel::property::queue, compute_index)

#undef __SYCL_DATA_LESS_PROP
#undef __SYCL_MANUALLY_DEFINED_PROP
78 changes: 16 additions & 62 deletions sycl/include/sycl/properties/queue_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,13 @@

namespace sycl {
__SYCL_INLINE_VER_NAMESPACE(_V1) {
namespace property::queue {
class in_order : public detail::DataLessProperty<detail::InOrder> {};
class enable_profiling
: public detail::DataLessProperty<detail::QueueEnableProfiling> {};
} // namespace property::queue

namespace ext::oneapi {

namespace property::queue {
class discard_events
: public ::sycl::detail::DataLessProperty<::sycl::detail::DiscardEvents> {};

class priority_normal
: public sycl::detail::DataLessProperty<sycl::detail::QueuePriorityNormal> {
};
class priority_low
: public sycl::detail::DataLessProperty<sycl::detail::QueuePriorityLow> {};
class priority_high
: public sycl::detail::DataLessProperty<sycl::detail::QueuePriorityHigh> {};

} // namespace property::queue
#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) \
namespace NS_QUALIFIER { \
class PROP_NAME \
: public sycl::detail::DataLessProperty<sycl::detail::ENUM_VAL> {}; \
}

namespace cuda::property::queue {
class use_default_stream : public ::sycl::detail::DataLessProperty<
::sycl::detail::UseDefaultStream> {};
} // namespace cuda::property::queue
} // namespace ext::oneapi
#include <sycl/properties/queue_properties.def>

namespace property ::queue {
namespace __SYCL2020_DEPRECATED(
Expand All @@ -51,10 +31,7 @@ class use_default_stream
// clang-format on
} // namespace property::queue

namespace ext {
namespace intel {
namespace property {
namespace queue {
namespace ext::intel::property::queue {
class compute_index : public sycl::detail::PropertyWithData<
sycl::detail::PropWithDataKind::QueueComputeIndex> {
public:
Expand All @@ -64,41 +41,18 @@ class compute_index : public sycl::detail::PropertyWithData<
private:
int idx;
};
} // namespace queue
} // namespace property
} // namespace intel
} // namespace ext
} // namespace ext::intel::property::queue

// Forward declaration
// Queue property trait specializations.
class queue;

// Queue property trait specializations
template <>
struct is_property_of<property::queue::in_order, queue> : std::true_type {};
template <>
struct is_property_of<property::queue::enable_profiling, queue>
: std::true_type {};
template <>
struct is_property_of<ext::oneapi::property::queue::discard_events, queue>
: std::true_type {};
template <>
struct is_property_of<ext::oneapi::property::queue::priority_normal, queue>
: std::true_type {};
template <>
struct is_property_of<ext::oneapi::property::queue::priority_low, queue>
: std::true_type {};
template <>
struct is_property_of<ext::oneapi::property::queue::priority_high, queue>
: std::true_type {};
template <>
struct is_property_of<property::queue::cuda::use_default_stream, queue>
: std::true_type {};
template <>
struct is_property_of<ext::oneapi::cuda::property::queue::use_default_stream,
queue> : std::true_type {};
template <>
struct is_property_of<ext::intel::property::queue::compute_index, queue>
: std::true_type {};
#define __SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME) \
template <> \
struct is_property_of<NS_QUALIFIER::PROP_NAME, queue> : std::true_type {};
#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) \
__SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME)

#include <sycl/properties/queue_properties.def>

} // __SYCL_INLINE_VER_NAMESPACE(_V1)
} // namespace sycl
19 changes: 10 additions & 9 deletions sycl/source/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,16 @@ template <typename PropertyT> PropertyT queue::get_property() const {
return impl->get_property<PropertyT>();
}

template __SYCL_EXPORT bool
queue::has_property<property::queue::enable_profiling>() const noexcept;
template __SYCL_EXPORT property::queue::enable_profiling
queue::get_property<property::queue::enable_profiling>() const;

template __SYCL_EXPORT bool
queue::has_property<property::queue::in_order>() const;
template __SYCL_EXPORT property::queue::in_order
queue::get_property<property::queue::in_order>() const;
#define __SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME) \
template __SYCL_EXPORT bool queue::has_property<NS_QUALIFIER::PROP_NAME>() \
const noexcept; \
template __SYCL_EXPORT NS_QUALIFIER::PROP_NAME \
queue::get_property<NS_QUALIFIER::PROP_NAME>() const;

#define __SYCL_DATA_LESS_PROP(NS_QUALIFIER, PROP_NAME, ENUM_VAL) \
__SYCL_MANUALLY_DEFINED_PROP(NS_QUALIFIER, PROP_NAME)

#include <sycl/properties/queue_properties.def>

bool queue::is_in_order() const {
return impl->has_property<property::queue::in_order>();
Expand Down
18 changes: 16 additions & 2 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# DO NOT EDIT IT MANUALLY. Refer to sycl/doc/developer/ABIPolicyGuide.md for more info.
################################################################################

# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir %python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libsycl.so
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you removed it? I guess it was done like this for systems where python3 installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what the script did.

# RUN: env LLVM_BIN_PATH=%llvm_build_bin_dir python %sycl_tools_src_dir/abi_check.py --mode check_symbols --reference %s %sycl_libs_dir/libsycl.so
# REQUIRES: linux
# UNSUPPORTED: libcxx

Expand Down Expand Up @@ -4055,9 +4055,23 @@ _ZNK4sycl3_V15queue10get_deviceEv
_ZNK4sycl3_V15queue11get_backendEv
_ZNK4sycl3_V15queue11get_contextEv
_ZNK4sycl3_V15queue11is_in_orderEv
_ZNK4sycl3_V15queue12get_propertyINS0_3ext5intel8property5queue13compute_indexEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_3ext6oneapi4cuda8property5queue18use_default_streamEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_3ext6oneapi8property5queue12priority_lowEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_3ext6oneapi8property5queue13priority_highEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_3ext6oneapi8property5queue14discard_eventsEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_3ext6oneapi8property5queue15priority_normalEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_8property5queue16enable_profilingEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_8property5queue4cuda18use_default_streamEEET_v
_ZNK4sycl3_V15queue12get_propertyINS0_8property5queue8in_orderEEET_v
_ZNK4sycl3_V15queue12has_propertyINS0_3ext5intel8property5queue13compute_indexEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_3ext6oneapi4cuda8property5queue18use_default_streamEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_3ext6oneapi8property5queue12priority_lowEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_3ext6oneapi8property5queue13priority_highEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_3ext6oneapi8property5queue14discard_eventsEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_3ext6oneapi8property5queue15priority_normalEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_8property5queue16enable_profilingEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_8property5queue4cuda18use_default_streamEEEbv
_ZNK4sycl3_V15queue12has_propertyINS0_8property5queue8in_orderEEEbv
_ZNK4sycl3_V15queue16ext_oneapi_emptyEv
_ZNK4sycl3_V15queue28ext_codeplay_supports_fusionEv
Expand Down Expand Up @@ -4318,12 +4332,12 @@ _ZNK4sycl3_V16device8get_infoINS0_4info6device35ext_intel_gpu_eu_count_per_subsl
_ZNK4sycl3_V16device8get_infoINS0_4info6device38sub_group_independent_forward_progressEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device4nameEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device6vendorEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device7aspectsEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device7profileEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device7versionEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device8atomic64EEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device8platformEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device9vendor_idEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device8get_infoINS0_4info6device7aspectsEEENS0_6detail19is_device_info_descIT_E11return_typeEv
_ZNK4sycl3_V16device9getNativeEv
_ZNK4sycl3_V16kernel11get_backendEv
_ZNK4sycl3_V16kernel11get_contextEv
Expand Down
Loading