Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HIP] Fix error code for unsupported program info #2357

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions source/adapters/cuda/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,6 @@ ur_result_t ur_program_handle_t_::getGlobalVariablePointer(
return UR_RESULT_SUCCESS;
}

/// Finds kernel names by searching for entry points in the PTX source, as the
/// CUDA driver API doesn't expose an operation for this.
/// Note: This is currently only being used by the SYCL program class for the
/// has_kernel method, so an alternative would be to move the has_kernel
/// query to UR and use cuModuleGetFunction to check for a kernel.
/// Note: Another alternative is to add kernel names as metadata, like with
/// reqd_work_group_size.
ur_result_t getKernelNames(ur_program_handle_t) {
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

/// Loads images from a list of PTX or CUBIN binaries.
/// Note: No calls to CUDA driver API in this function, only store binaries
/// for later.
Expand Down Expand Up @@ -421,8 +410,9 @@ urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName,
case UR_PROGRAM_INFO_BINARIES:
return ReturnValue(&hProgram->Binary, 1);
case UR_PROGRAM_INFO_KERNEL_NAMES:
/* TODO: Add implementation for getKernelNames */
UR_ASSERT(getKernelNames(hProgram), UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
// CUDA has no way to query a list of kernels from a binary.
// In SYCL this is only used in kernel bundle when building from source
// which isn't currently supported for CUDA.
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
case UR_PROGRAM_INFO_NUM_KERNELS:
case UR_PROGRAM_INFO_IL:
Expand Down
15 changes: 5 additions & 10 deletions source/adapters/hip/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,6 @@ ur_result_t ur_program_handle_t_::getGlobalVariablePointer(
return UR_RESULT_SUCCESS;
}

/// Finds kernel names by searching for entry points in the PTX source, as the
/// HIP driver API doesn't expose an operation for this.
/// Note: This is currently only being used by the SYCL program class for the
/// has_kernel method, so an alternative would be to move the has_kernel
/// query to UR and use hipModuleGetFunction to check for a kernel.
ur_result_t getKernelNames(ur_program_handle_t) {
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

/// A program must be specific to a device so this entry point is UNSUPPORTED
UR_APIEXPORT ur_result_t UR_APICALL
urProgramCreateWithIL(ur_context_handle_t, const void *, size_t,
Expand Down Expand Up @@ -408,7 +399,11 @@ urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName,
case UR_PROGRAM_INFO_BINARIES:
return ReturnValue(&hProgram->Binary, 1);
case UR_PROGRAM_INFO_KERNEL_NAMES:
return getKernelNames(hProgram);
// HIP has no way to query a list of kernels from a binary.
// In SYCL this is only used in kernel bundle when building from source
// which isn't currently supported for HIP.
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
case UR_PROGRAM_INFO_NUM_KERNELS:
case UR_PROGRAM_INFO_IL:
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
default:
Expand Down
3 changes: 0 additions & 3 deletions test/conformance/program/program_adapter_hip.match
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
urProgramBuildTest.BuildFailure/*
# HIP hasn't implemented urProgramCreateWithNativeHandleTest
{{OPT}}urProgramCreateWithNativeHandleTest.Success/*
# HIP doesn't expose kernel numbers or names
urProgramGetInfoTest.Success/*__UR_PROGRAM_INFO_NUM_KERNELS
urProgramGetInfoTest.Success/*__UR_PROGRAM_INFO_KERNEL_NAMES

# HIP hasn't implemented urProgramLink
{{OPT}}urProgramLinkTest.Success/*
Expand Down
Loading