@@ -2994,7 +2994,7 @@ pi_result piKernelCreate(pi_program Program, const char *KernelName,
2994
2994
return mapError (ZeResult);
2995
2995
2996
2996
try {
2997
- *RetKernel = new _pi_kernel (ZeKernel, Program, KernelName );
2997
+ *RetKernel = new _pi_kernel (ZeKernel, Program);
2998
2998
} catch (const std::bad_alloc &) {
2999
2999
return PI_OUT_OF_HOST_MEMORY;
3000
3000
} catch (...) {
@@ -3073,12 +3073,19 @@ pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName,
3073
3073
case PI_KERNEL_INFO_PROGRAM:
3074
3074
return ReturnValue (pi_program{Kernel->Program });
3075
3075
case PI_KERNEL_INFO_FUNCTION_NAME:
3076
- // TODO: Replace with the line in the comment once bug in the Level Zero
3077
- // driver will be fixed. Problem is that currently Level Zero driver
3078
- // truncates name of the returned kernel if it is longer than 256 symbols.
3079
- //
3080
- // return ReturnValue(ZeKernelProperties.name);
3081
- return ReturnValue (Kernel->KernelName .c_str ());
3076
+ try {
3077
+ size_t Size = 0 ;
3078
+ ZE_CALL (zeKernelGetName (Kernel->ZeKernel , &Size, nullptr ));
3079
+ char *KernelName = new char [Size];
3080
+ ZE_CALL (zeKernelGetName (Kernel->ZeKernel , &Size, KernelName));
3081
+ pi_result Res = ReturnValue (static_cast <const char *>(KernelName));
3082
+ delete[] KernelName;
3083
+ return Res;
3084
+ } catch (const std::bad_alloc &) {
3085
+ return PI_OUT_OF_HOST_MEMORY;
3086
+ } catch (...) {
3087
+ return PI_ERROR_UNKNOWN;
3088
+ }
3082
3089
case PI_KERNEL_INFO_NUM_ARGS:
3083
3090
return ReturnValue (pi_uint32{ZeKernelProperties.numKernelArgs });
3084
3091
case PI_KERNEL_INFO_REFERENCE_COUNT:
0 commit comments