Skip to content

Commit fe33437

Browse files
committed
[SYCL][NFC] Add a new header with kernel argument extraction logic
The kernel argument extraction logic has been refactored and moved to a separate header, to be used in both handler-based and handler-less kernel submission flows.
1 parent c542f4a commit fe33437

File tree

5 files changed

+402
-82
lines changed

5 files changed

+402
-82
lines changed

sycl/include/sycl/ext/oneapi/experimental/work_group_memory.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ template <typename T> struct is_unbounded_array<T[]> : std::true_type {};
2828
template <typename T>
2929
inline constexpr bool is_unbounded_array_v = is_unbounded_array<T>::value;
3030

31+
class NDRDescT;
32+
class ArgDesc;
33+
class dynamic_parameter_impl;
34+
35+
void processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
36+
const int Size, const size_t Index, size_t &IndexShift,
37+
bool IsKernelCreatedFromSource, bool IsESIMD,
38+
detail::NDRDescT NDRDesc, std::vector<std::pair<
39+
ext::oneapi::experimental::detail::dynamic_parameter_impl *, int>>
40+
DynamicParameters, std::vector<ArgDesc> &Args);
41+
3142
class work_group_memory_impl {
3243
public:
3344
work_group_memory_impl() : buffer_size{0} {}
@@ -39,6 +50,12 @@ class work_group_memory_impl {
3950
private:
4051
size_t buffer_size;
4152
friend class sycl::handler;
53+
friend void detail::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
54+
const int Size, const size_t Index, size_t &IndexShift,
55+
bool IsKernelCreatedFromSource, bool IsESIMD,
56+
detail::NDRDescT NDRDesc, std::vector<std::pair<
57+
ext::oneapi::experimental::detail::dynamic_parameter_impl *, int>>
58+
DynamicParameters, std::vector<ArgDesc> &Args);
4259
};
4360

4461
} // namespace detail

sycl/include/sycl/handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,12 @@ class __SYCL_EXPORT handler {
499499
extractArgsAndReqsFromLambda(char *LambdaPtr, size_t KernelArgsNum,
500500
const detail::kernel_param_desc_t *KernelArgs,
501501
bool IsESIMD);
502-
#endif
503502
/// Extracts and prepares kernel arguments from the lambda using information
504503
/// from the built-ins or integration header.
505504
void extractArgsAndReqsFromLambda(
506505
char *LambdaPtr, detail::kernel_param_desc_t (*ParamDescGetter)(int),
507506
size_t NumKernelParams, bool IsESIMD);
507+
#endif
508508

509509
/// Extracts and prepares kernel arguments set via set_arg(s).
510510
void extractArgsAndReqs();

sycl/include/sycl/stream.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ inline namespace _V1 {
4141

4242
namespace detail {
4343

44+
void processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
45+
const int Size, const size_t Index, size_t &IndexShift,
46+
bool IsKernelCreatedFromSource, bool IsESIMD,
47+
detail::NDRDescT NDRDesc, std::vector<std::pair<
48+
ext::oneapi::experimental::detail::dynamic_parameter_impl *, int>>
49+
DynamicParameters, std::vector<ArgDesc> &Args);
50+
4451
class stream_impl;
4552

4653
using FmtFlags = unsigned int;
@@ -1042,6 +1049,12 @@ class __SYCL_EXPORT __SYCL_SPECIAL_CLASS __SYCL_TYPE(stream) stream
10421049
#endif
10431050

10441051
friend class handler;
1052+
friend void detail::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
1053+
const int Size, const size_t Index, size_t &IndexShift,
1054+
bool IsKernelCreatedFromSource, bool IsESIMD,
1055+
detail::NDRDescT NDRDesc, std::vector<std::pair<
1056+
ext::oneapi::experimental::detail::dynamic_parameter_impl *, int>>
1057+
DynamicParameters, std::vector<ArgDesc> &Args);
10451058

10461059
template <typename SYCLObjT> friend class ext::oneapi::weak_object;
10471060

0 commit comments

Comments
 (0)