Skip to content
Merged
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
1 change: 1 addition & 0 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2984,6 +2984,7 @@ typedef struct ur_program_properties_t {
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
/// + `length == 0`
/// - ::UR_RESULT_ERROR_INVALID_BINARY
/// + If `pIL` is not a valid IL binary for devices in `hContext`.
/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE
Expand Down
2 changes: 2 additions & 0 deletions scripts/core/program.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ returns:
- "If `pIL` is not a valid IL binary for devices in `hContext`."
- $X_RESULT_ERROR_COMPILER_NOT_AVAILABLE:
- "If devices in `hContext` don't have the capability to compile an IL binary at runtime."
- $X_RESULT_ERROR_INVALID_SIZE:
- "`length == 0`"
--- #--------------------------------------------------------------------------
type: function
desc: "Create a program object from device native binary."
Expand Down
4 changes: 4 additions & 0 deletions source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,10 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
pProperties->count == 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}

if (length == 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
}

ur_result_t result =
Expand Down
1 change: 1 addition & 0 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,7 @@ ur_result_t UR_APICALL urUSMPoolGetInfo(
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
/// + `length == 0`
/// - ::UR_RESULT_ERROR_INVALID_BINARY
/// + If `pIL` is not a valid IL binary for devices in `hContext`.
/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE
Expand Down
1 change: 1 addition & 0 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ ur_result_t UR_APICALL urUSMPoolGetInfo(
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
/// + `length == 0`
/// - ::UR_RESULT_ERROR_INVALID_BINARY
/// + If `pIL` is not a valid IL binary for devices in `hContext`.
/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/kernel/urKernelCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST_P(urKernelCreateTest, InvalidNullPointerKernel) {
}

TEST_P(urKernelCreateTest, InvalidKernelName) {
std::string invalid_name = "";
std::string invalid_name = "incorrect_kernel_name";
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_NAME,
urKernelCreate(program, invalid_name.data(), &kernel));
}
2 changes: 1 addition & 1 deletion test/conformance/kernel/urKernelGetGroupInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST_P(urKernelGetGroupInfoTest, InvalidNullHandleDevice) {
TEST_P(urKernelGetGroupInfoTest, InvalidEnumeration) {
size_t bad_enum_length = 0;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
urKernelGetGroupInfo(nullptr, device,
urKernelGetGroupInfo(kernel, device,
UR_KERNEL_GROUP_INFO_FORCE_UINT32, 0,
nullptr, &bad_enum_length));
}
2 changes: 1 addition & 1 deletion test/conformance/kernel/urKernelGetSubGroupInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ TEST_P(urKernelGetSubGroupInfoTest, InvalidEnumeration) {
size_t bad_enum_length = 0;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION,
urKernelGetSubGroupInfo(
nullptr, device, UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32,
kernel, device, UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32,
0, nullptr, &bad_enum_length));
}
4 changes: 2 additions & 2 deletions test/conformance/kernel/urKernelSetArgValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST_P(urKernelSetArgValueTest, InvalidNullHandleKernel) {

TEST_P(urKernelSetArgValueTest, InvalidNullPointerArgValue) {
ASSERT_EQ_RESULT(
UR_RESULT_ERROR_INVALID_NULL_HANDLE,
UR_RESULT_ERROR_INVALID_NULL_POINTER,
urKernelSetArgValue(kernel, 2, sizeof(arg_value), nullptr));
}

Expand All @@ -44,6 +44,6 @@ TEST_P(urKernelSetArgValueTest, InvalidKernelArgumentIndex) {
}

TEST_P(urKernelSetArgValueTest, InvalidKernelArgumentSize) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX,
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE,
urKernelSetArgValue(kernel, 2, 0, &arg_value));
}
6 changes: 3 additions & 3 deletions test/conformance/kernel/urKernelSetExecInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ TEST_P(urKernelSetExecInfoTest, InvalidNullHandleKernel) {
TEST_P(urKernelSetExecInfoTest, InvalidEnumeration) {
bool property_value = false;
ASSERT_EQ_RESULT(
UR_RESULT_ERROR_INVALID_NULL_HANDLE,
urKernelSetExecInfo(nullptr, UR_KERNEL_EXEC_INFO_FORCE_UINT32,
UR_RESULT_ERROR_INVALID_ENUMERATION,
urKernelSetExecInfo(kernel, UR_KERNEL_EXEC_INFO_FORCE_UINT32,
sizeof(property_value), &property_value));
}

TEST_P(urKernelSetExecInfoTest, InvalidNullPointerPropValue) {
bool property_value = false;
ASSERT_EQ_RESULT(
UR_RESULT_ERROR_INVALID_NULL_POINTER,
urKernelSetExecInfo(nullptr, UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS,
urKernelSetExecInfo(kernel, UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS,
sizeof(property_value), nullptr));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

struct urKernelSetSpecializationConstantsTest : uur::urKernelExecutionTest {
void SetUp() override {
program_name = "spec_constant";
UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp());
bool supports_kernel_spec_constant = false;
ASSERT_SUCCESS(urDeviceGetInfo(
device, UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS,
Expand All @@ -16,8 +18,6 @@ struct urKernelSetSpecializationConstantsTest : uur::urKernelExecutionTest {
GTEST_SKIP()
<< "Device does not support setting kernel spec constants.";
}
program_name = "spec_constant";
UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp());
}

uint32_t spec_value = 42;
Expand Down
21 changes: 9 additions & 12 deletions test/conformance/program/urProgramGetFunctionPointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ struct urProgramGetFunctionPointerTest : uur::urProgramTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urProgramTest::SetUp());
ASSERT_SUCCESS(urProgramBuild(context, program, nullptr));
std::string kernel_list;
size_t kernel_list_size = 0;
ASSERT_SUCCESS(urProgramGetInfo(program, UR_PROGRAM_INFO_KERNEL_NAMES,
0, nullptr, &kernel_list_size));
kernel_list.resize(kernel_list_size);
ASSERT_SUCCESS(urProgramGetInfo(program, UR_PROGRAM_INFO_KERNEL_NAMES,
kernel_list_size, kernel_list.data(),
nullptr));
function_name = kernel_list.substr(0, kernel_list.find(";"));
auto kernel_names =
uur::KernelsEnvironment::instance->GetEntryPointNames(
this->program_name);
function_name = kernel_names[0];
}

std::string function_name;
Expand All @@ -31,11 +26,13 @@ TEST_P(urProgramGetFunctionPointerTest, Success) {
ASSERT_NE(function_pointer, nullptr);
}

TEST_P(urProgramGetFunctionPointerTest, SuccessFunctionNotFound) {
TEST_P(urProgramGetFunctionPointerTest, InvalidFunctionName) {
void *function_pointer = nullptr;
std::string missing_function = "aFakeFunctionName";
ASSERT_SUCCESS(urProgramGetFunctionPointer(
device, program, missing_function.data(), &function_pointer));
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_FUNCTION_NAME,
urProgramGetFunctionPointer(device, program,
missing_function.data(),
&function_pointer));
ASSERT_EQ(function_pointer, nullptr);
}

Expand Down
17 changes: 5 additions & 12 deletions test/conformance/program/urProgramLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct urProgramLinkTest : uur::urProgramTest {
uur::KernelsEnvironment::instance->LoadSource("bar", 0, bar_binary);
ASSERT_SUCCESS(urProgramCreateWithIL(context, bar_binary->data(),
bar_binary->size(), nullptr,
&program));
&bar_program));
ASSERT_SUCCESS(urProgramCompile(context, bar_program, nullptr));
programs.push_back(bar_program);
}
Expand All @@ -39,17 +39,10 @@ UUR_INSTANTIATE_KERNEL_TEST_SUITE_P(urProgramLinkTest);
TEST_P(urProgramLinkTest, Success) {
ASSERT_SUCCESS(urProgramLink(context, programs.size(), programs.data(),
nullptr, &linked_program));
size_t original_kernel_count = 0;
ASSERT_SUCCESS(urProgramGetInfo(program, UR_PROGRAM_INFO_NUM_KERNELS,
sizeof(original_kernel_count),
&original_kernel_count, nullptr));

size_t linked_kernel_count = 0;
ASSERT_SUCCESS(urProgramGetInfo(linked_program, UR_PROGRAM_INFO_NUM_KERNELS,
sizeof(linked_kernel_count),
&linked_kernel_count, nullptr));

ASSERT_GT(linked_kernel_count, original_kernel_count);
ur_program_binary_type_t binary_type = UR_PROGRAM_BINARY_TYPE_NONE;
ASSERT_SUCCESS(urProgramGetBuildInfo(
program, device, UR_PROGRAM_BUILD_INFO_BINARY_TYPE, sizeof(binary_type),
&binary_type, nullptr));
}

TEST_P(urProgramLinkTest, InvalidNullHandleContext) {
Expand Down