@@ -324,6 +324,17 @@ urKernelSetArgMemObj(ur_kernel_handle_t hKernel, uint32_t argIndex,
324324 }
325325}
326326
327+ ur_result_t
328+ urKernelSetArgLocal (ur_kernel_handle_t hKernel, uint32_t argIndex,
329+ size_t argSize,
330+ const ur_kernel_arg_local_properties_t *pProperties) {
331+ TRACK_SCOPE_LATENCY (" ur_kernel_handle_t_::setArgLocal" );
332+
333+ std::ignore = pProperties;
334+
335+ return hKernel->setArgValue (argIndex, argSize, nullptr , nullptr );
336+ }
337+
327338ur_result_t urKernelSetExecInfo (
328339 ur_kernel_handle_t hKernel, // /< [in] handle of the kernel object
329340 ur_kernel_exec_info_t propName, // /< [in] name of the execution attribute
@@ -338,4 +349,114 @@ ur_result_t urKernelSetExecInfo(
338349
339350 return hKernel->setExecInfo (propName, pPropValue);
340351}
352+
353+ ur_result_t urKernelGetGroupInfo (
354+ ur_kernel_handle_t hKernel, // /< [in] handle of the Kernel object
355+ ur_device_handle_t hDevice, // /< [in] handle of the Device object
356+ ur_kernel_group_info_t
357+ paramName, // /< [in] name of the work Group property to query
358+ size_t
359+ paramValueSize, // /< [in] size of the Kernel Work Group property value
360+ void *pParamValue, // /< [in,out][optional][range(0, propSize)] value of the
361+ // /< Kernel Work Group property.
362+ size_t *pParamValueSizeRet // /< [out][optional] pointer to the actual size
363+ // /< in bytes of data being queried by propName.
364+ ) {
365+ UrReturnHelper returnValue (paramValueSize, pParamValue, pParamValueSizeRet);
366+
367+ std::shared_lock<ur_shared_mutex> Guard (hKernel->Mutex );
368+ switch (paramName) {
369+ case UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE: {
370+ // TODO: To revisit after level_zero/issues/262 is resolved
371+ struct {
372+ size_t Arr[3 ];
373+ } GlobalWorkSize = {{(hDevice->ZeDeviceComputeProperties ->maxGroupSizeX *
374+ hDevice->ZeDeviceComputeProperties ->maxGroupCountX ),
375+ (hDevice->ZeDeviceComputeProperties ->maxGroupSizeY *
376+ hDevice->ZeDeviceComputeProperties ->maxGroupCountY ),
377+ (hDevice->ZeDeviceComputeProperties ->maxGroupSizeZ *
378+ hDevice->ZeDeviceComputeProperties ->maxGroupCountZ )}};
379+ return returnValue (GlobalWorkSize);
380+ }
381+ case UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE: {
382+ ZeStruct<ze_kernel_max_group_size_properties_ext_t > workGroupProperties;
383+ workGroupProperties.maxGroupSize = 0 ;
384+
385+ ZeStruct<ze_kernel_properties_t > kernelProperties;
386+ kernelProperties.pNext = &workGroupProperties;
387+
388+ auto zeDevice = hKernel->getZeHandle (hDevice);
389+ if (zeDevice) {
390+ auto zeResult =
391+ ZE_CALL_NOCHECK (zeKernelGetProperties, (zeDevice, &kernelProperties));
392+ if (zeResult == ZE_RESULT_SUCCESS &&
393+ workGroupProperties.maxGroupSize != 0 ) {
394+ return returnValue (workGroupProperties.maxGroupSize );
395+ }
396+ return returnValue (
397+ uint64_t {hDevice->ZeDeviceComputeProperties ->maxTotalGroupSize });
398+ }
399+ }
400+ case UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE: {
401+ auto props = hKernel->getProperties (hDevice);
402+ struct {
403+ size_t Arr[3 ];
404+ } WgSize = {{props.requiredGroupSizeX , props.requiredGroupSizeY ,
405+ props.requiredGroupSizeZ }};
406+ return returnValue (WgSize);
407+ }
408+ case UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE: {
409+ auto props = hKernel->getProperties (hDevice);
410+ return returnValue (uint32_t {props.localMemSize });
411+ }
412+ case UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: {
413+ return returnValue (
414+ size_t {hDevice->ZeDeviceProperties ->physicalEUSimdWidth });
415+ }
416+ case UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: {
417+ auto props = hKernel->getProperties (hDevice);
418+ return returnValue (uint32_t {props.privateMemSize });
419+ }
420+ default : {
421+ logger::error (
422+ " Unknown ParamName in urKernelGetGroupInfo: ParamName={}(0x{})" ,
423+ paramName, logger::toHex (paramName));
424+ return UR_RESULT_ERROR_INVALID_VALUE;
425+ }
426+ }
427+ return UR_RESULT_SUCCESS;
428+ }
429+
430+ ur_result_t urKernelGetSubGroupInfo (
431+ ur_kernel_handle_t hKernel, // /< [in] handle of the Kernel object
432+ ur_device_handle_t hDevice, // /< [in] handle of the Device object
433+ ur_kernel_sub_group_info_t
434+ propName, // /< [in] name of the SubGroup property to query
435+ size_t propSize, // /< [in] size of the Kernel SubGroup property value
436+ void *pPropValue, // /< [in,out][range(0, propSize)][optional] value of the
437+ // /< Kernel SubGroup property.
438+ size_t *pPropSizeRet // /< [out][optional] pointer to the actual size in
439+ // /< bytes of data being queried by propName.
440+ ) {
441+ std::ignore = hDevice;
442+
443+ UrReturnHelper returnValue (propSize, pPropValue, pPropSizeRet);
444+
445+ auto props = hKernel->getProperties (hDevice);
446+
447+ std::shared_lock<ur_shared_mutex> Guard (hKernel->Mutex );
448+ if (propName == UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE) {
449+ returnValue (uint32_t {props.maxSubgroupSize });
450+ } else if (propName == UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS) {
451+ returnValue (uint32_t {props.maxNumSubgroups });
452+ } else if (propName == UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS) {
453+ returnValue (uint32_t {props.requiredNumSubGroups });
454+ } else if (propName == UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL) {
455+ returnValue (uint32_t {props.requiredSubgroupSize });
456+ } else {
457+ die (" urKernelGetSubGroupInfo: parameter not implemented" );
458+ return {};
459+ }
460+ return UR_RESULT_SUCCESS;
461+ }
341462} // namespace ur::level_zero
0 commit comments