@@ -496,12 +496,9 @@ event handler::finalize() {
496496 if (type == detail::CGType::Kernel && impl->MKernelFuncPtr &&
497497 (!KernelFastPath || impl->MKernelHasSpecialCaptures )) {
498498 clearArgs ();
499- detail:: extractArgsAndReqsFromLambda ((char *)impl->MKernelFuncPtr ,
499+ extractArgsAndReqsFromLambda ((char *)impl->MKernelFuncPtr ,
500500 impl->MKernelParamDescGetter ,
501- impl->MKernelNumArgs , impl->MKernelIsESIMD ,
502- Queue && Queue->hasCommandGraph (),
503- impl->get_graph_or_null () != nullptr ,
504- impl->MNDRDesc , impl->MDynamicParameters , impl->MArgs );
501+ impl->MKernelNumArgs , impl->MKernelIsESIMD );
505502 }
506503
507504 // According to 4.7.6.9 of SYCL2020 spec, if a placeholder accessor is passed
@@ -1042,6 +1039,7 @@ void handler::associateWithHandler(
10421039 static_cast <int >(AccTarget));
10431040}
10441041
1042+ #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
10451043void handler::processArg (void *Ptr, const detail::kernel_param_kind_t &Kind,
10461044 const int Size, const size_t Index, size_t &IndexShift,
10471045 bool IsKernelCreatedFromSource, bool IsESIMD) {
@@ -1210,6 +1208,7 @@ void handler::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
12101208 break ;
12111209 }
12121210}
1211+ #endif // __INTEL_PREVIEW_BREAKING_CHANGES
12131212
12141213void handler::setArgHelper (int ArgIndex, detail::work_group_memory_impl &Arg) {
12151214 impl->MWorkGroupMemoryObjects .push_back (
@@ -1224,16 +1223,6 @@ void handler::setArgHelper(int ArgIndex, stream &&Str) {
12241223 ArgIndex);
12251224}
12261225
1227- // The argument can take up more space to store additional information about
1228- // MAccessRange, MMemoryRange, and MOffset added with addArgsForGlobalAccessor.
1229- // We use the worst-case estimate because the lifetime of the vector is short.
1230- // In processArg the kind_stream case introduces the maximum number of
1231- // additional arguments. The case adds additional 12 arguments to the currently
1232- // processed argument, hence worst-case estimate is 12+1=13.
1233- // TODO: the constant can be removed if the size of MArgs will be calculated at
1234- // compile time.
1235- inline constexpr size_t MaxNumAdditionalArgs = 13 ;
1236-
12371226void handler::extractArgsAndReqs () {
12381227 assert (MKernel && " MKernel is not initialized" );
12391228 std::vector<detail::ArgDesc> UnPreparedArgs = std::move (impl->MArgs );
@@ -1246,74 +1235,38 @@ void handler::extractArgsAndReqs() {
12461235 });
12471236
12481237 const bool IsKernelCreatedFromSource = MKernel->isCreatedFromSource ();
1249- impl->MArgs .reserve (MaxNumAdditionalArgs * UnPreparedArgs.size ());
12501238
1251- size_t IndexShift = 0 ;
1252- for (size_t I = 0 ; I < UnPreparedArgs.size (); ++I) {
1253- void *Ptr = UnPreparedArgs[I].MPtr ;
1254- const detail::kernel_param_kind_t &Kind = UnPreparedArgs[I].MType ;
1255- const int &Size = UnPreparedArgs[I].MSize ;
1256- const int Index = UnPreparedArgs[I].MIndex ;
1257- processArg (Ptr, Kind, Size, Index, IndexShift, IsKernelCreatedFromSource,
1258- false );
1259- }
1239+ detail::extractArgsAndReqs (IsKernelCreatedFromSource, impl->MNDRDesc ,
1240+ impl->MDynamicParameters , UnPreparedArgs,
1241+ impl->MArgs );
12601242}
12611243
1262- #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
1263- // TODO: Those functions are not used anymore, remove it in the next
1264- // ABI-breaking window.
12651244void handler::extractArgsAndReqsFromLambda (
12661245 char *LambdaPtr, detail::kernel_param_desc_t (*ParamDescGetter)(int ),
12671246 size_t NumKernelParams, bool IsESIMD) {
1268- size_t IndexShift = 0 ;
1269- impl->MArgs .reserve (MaxNumAdditionalArgs * NumKernelParams);
1270-
1271- for (size_t I = 0 ; I < NumKernelParams; ++I) {
1272- detail::kernel_param_desc_t ParamDesc = ParamDescGetter (I);
1273- void *Ptr = LambdaPtr + ParamDesc.offset ;
1274- const detail::kernel_param_kind_t &Kind = ParamDesc.kind ;
1275- const int &Size = ParamDesc.info ;
1276- if (Kind == detail::kernel_param_kind_t ::kind_accessor) {
1277- // For args kind of accessor Size is information about accessor.
1278- // The first 11 bits of Size encodes the accessor target.
1279- const access::target AccTarget =
1280- static_cast <access::target>(Size & AccessTargetMask);
1281- if ((AccTarget == access::target::device ||
1282- AccTarget == access::target::constant_buffer) ||
1283- (AccTarget == access::target::image ||
1284- AccTarget == access::target::image_array)) {
1285- detail::AccessorBaseHost *AccBase =
1286- static_cast <detail::AccessorBaseHost *>(Ptr);
1287- Ptr = detail::getSyclObjImpl (*AccBase).get ();
1288- } else if (AccTarget == access::target::local) {
1289- detail::LocalAccessorBaseHost *LocalAccBase =
1290- static_cast <detail::LocalAccessorBaseHost *>(Ptr);
1291- Ptr = detail::getSyclObjImpl (*LocalAccBase).get ();
1292- }
1293- } else if (Kind == detail::kernel_param_kind_t ::kind_dynamic_accessor) {
1294- // For args kind of accessor Size is information about accessor.
1295- // The first 11 bits of Size encodes the accessor target.
1296- // Only local targets are supported for dynamic accessors.
1297- assert (static_cast <access::target>(Size & AccessTargetMask) ==
1298- access::target::local);
1299-
1300- ext::oneapi::experimental::detail::dynamic_parameter_base
1301- *DynamicParamBase = static_cast <
1302- ext::oneapi::experimental::detail::dynamic_parameter_base *>(Ptr);
1303- Ptr = detail::getSyclObjImpl (*DynamicParamBase).get ();
1304- } else if (Kind ==
1305- detail::kernel_param_kind_t ::kind_dynamic_work_group_memory) {
1306- ext::oneapi::experimental::detail::dynamic_parameter_base
1307- *DynamicParamBase = static_cast <
1308- ext::oneapi::experimental::detail::dynamic_parameter_base *>(Ptr);
1309- Ptr = detail::getSyclObjImpl (*DynamicParamBase).get ();
1310- }
1247+ detail::queue_impl *Queue = impl->get_queue_or_null ();
1248+ bool QueueHasCommandGraph = Queue && Queue->hasCommandGraph ();
1249+ bool IsGraphSubmission = impl->get_graph_or_null () != nullptr ;
13111250
1312- processArg (Ptr, Kind, Size, I, IndexShift,
1313- /* IsKernelCreatedFromSource=*/ false , IsESIMD);
1314- }
1251+ detail::extractArgsAndReqsFromLambda (
1252+ LambdaPtr, ParamDescGetter, NumKernelParams, IsESIMD,
1253+ QueueHasCommandGraph, IsGraphSubmission, impl->MNDRDesc ,
1254+ impl->MDynamicParameters , impl->MArgs );
13151255}
13161256
1257+ #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
1258+ // The argument can take up more space to store additional information about
1259+ // MAccessRange, MMemoryRange, and MOffset added with addArgsForGlobalAccessor.
1260+ // We use the worst-case estimate because the lifetime of the vector is short.
1261+ // In processArg the kind_stream case introduces the maximum number of
1262+ // additional arguments. The case adds additional 12 arguments to the currently
1263+ // processed argument, hence worst-case estimate is 12+1=13.
1264+ // TODO: the constant can be removed if the size of MArgs will be calculated at
1265+ // compile time.
1266+ inline constexpr size_t MaxNumAdditionalArgs = 13 ;
1267+
1268+ // TODO: Those functions are not used anymore, remove it in the next
1269+ // ABI-breaking window.
13171270void handler::extractArgsAndReqsFromLambda (
13181271 char *LambdaPtr, const std::vector<detail::kernel_param_desc_t > &ParamDescs,
13191272 bool IsESIMD) {
0 commit comments