Skip to content

Commit 89def64

Browse files
authored
Merge pull request #2357 from npmiller/hip-program-info
[HIP] Fix error code for unsupported program info
2 parents 4c33882 + 8644396 commit 89def64

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

source/adapters/cuda/program.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,6 @@ ur_result_t ur_program_handle_t_::getGlobalVariablePointer(
176176
return UR_RESULT_SUCCESS;
177177
}
178178

179-
/// Finds kernel names by searching for entry points in the PTX source, as the
180-
/// CUDA driver API doesn't expose an operation for this.
181-
/// Note: This is currently only being used by the SYCL program class for the
182-
/// has_kernel method, so an alternative would be to move the has_kernel
183-
/// query to UR and use cuModuleGetFunction to check for a kernel.
184-
/// Note: Another alternative is to add kernel names as metadata, like with
185-
/// reqd_work_group_size.
186-
ur_result_t getKernelNames(ur_program_handle_t) {
187-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
188-
}
189-
190179
/// Loads images from a list of PTX or CUBIN binaries.
191180
/// Note: No calls to CUDA driver API in this function, only store binaries
192181
/// for later.
@@ -421,8 +410,9 @@ urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName,
421410
case UR_PROGRAM_INFO_BINARIES:
422411
return ReturnValue(&hProgram->Binary, 1);
423412
case UR_PROGRAM_INFO_KERNEL_NAMES:
424-
/* TODO: Add implementation for getKernelNames */
425-
UR_ASSERT(getKernelNames(hProgram), UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
413+
// CUDA has no way to query a list of kernels from a binary.
414+
// In SYCL this is only used in kernel bundle when building from source
415+
// which isn't currently supported for CUDA.
426416
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
427417
case UR_PROGRAM_INFO_NUM_KERNELS:
428418
case UR_PROGRAM_INFO_IL:

source/adapters/hip/program.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,6 @@ ur_result_t ur_program_handle_t_::getGlobalVariablePointer(
259259
return UR_RESULT_SUCCESS;
260260
}
261261

262-
/// Finds kernel names by searching for entry points in the PTX source, as the
263-
/// HIP driver API doesn't expose an operation for this.
264-
/// Note: This is currently only being used by the SYCL program class for the
265-
/// has_kernel method, so an alternative would be to move the has_kernel
266-
/// query to UR and use hipModuleGetFunction to check for a kernel.
267-
ur_result_t getKernelNames(ur_program_handle_t) {
268-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
269-
}
270-
271262
/// A program must be specific to a device so this entry point is UNSUPPORTED
272263
UR_APIEXPORT ur_result_t UR_APICALL
273264
urProgramCreateWithIL(ur_context_handle_t, const void *, size_t,
@@ -408,7 +399,11 @@ urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName,
408399
case UR_PROGRAM_INFO_BINARIES:
409400
return ReturnValue(&hProgram->Binary, 1);
410401
case UR_PROGRAM_INFO_KERNEL_NAMES:
411-
return getKernelNames(hProgram);
402+
// HIP has no way to query a list of kernels from a binary.
403+
// In SYCL this is only used in kernel bundle when building from source
404+
// which isn't currently supported for HIP.
405+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
406+
case UR_PROGRAM_INFO_NUM_KERNELS:
412407
case UR_PROGRAM_INFO_IL:
413408
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
414409
default:

test/conformance/program/program_adapter_hip.match

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
urProgramBuildTest.BuildFailure/*
22
# HIP hasn't implemented urProgramCreateWithNativeHandleTest
33
{{OPT}}urProgramCreateWithNativeHandleTest.Success/*
4-
# HIP doesn't expose kernel numbers or names
5-
urProgramGetInfoTest.Success/*__UR_PROGRAM_INFO_NUM_KERNELS
6-
urProgramGetInfoTest.Success/*__UR_PROGRAM_INFO_KERNEL_NAMES
74

85
# HIP hasn't implemented urProgramLink
96
{{OPT}}urProgramLinkTest.Success/*

0 commit comments

Comments
 (0)