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
25 changes: 12 additions & 13 deletions unified-runtime/source/adapters/level_zero/v2/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,14 @@ void ur_kernel_handle_t_::completeInitialization() {
assert(nonEmptyKernelIt != deviceKernels.end());
nonEmptyKernel = &nonEmptyKernelIt->value();

zeCommonProperties.Compute = [kernel = nonEmptyKernel](
common_properties_t &props) {
size_t size = 0;
ZE_CALL_NOCHECK(zeKernelGetName, (kernel->hKernel.get(), &size, nullptr));
props.name.resize(size);
ZE_CALL_NOCHECK(zeKernelGetName,
(kernel->hKernel.get(), &size, props.name.data()));
props.numKernelArgs = kernel->zeKernelProperties->numKernelArgs;
};
size_t size = 0;
ZE_CALL_NOCHECK(zeKernelGetName,
(nonEmptyKernel->hKernel.get(), &size, nullptr));
zeCommonProperties.name.resize(size);
ZE_CALL_NOCHECK(zeKernelGetName, (nonEmptyKernel->hKernel.get(), &size,
zeCommonProperties.name.data()));
zeCommonProperties.numKernelArgs =
nonEmptyKernel->zeKernelProperties->numKernelArgs;
}

size_t ur_kernel_handle_t_::deviceIndex(ur_device_handle_t hDevice) const {
Expand Down Expand Up @@ -185,7 +184,7 @@ ur_kernel_handle_t_::getZeHandle(ur_device_handle_t hDevice) {

ur_kernel_handle_t_::common_properties_t
ur_kernel_handle_t_::getCommonProperties() const {
return zeCommonProperties.get();
return zeCommonProperties;
}

const ze_kernel_properties_t &
Expand All @@ -198,7 +197,7 @@ ur_result_t ur_kernel_handle_t_::setArgValue(
uint32_t argIndex, size_t argSize,
const ur_kernel_arg_value_properties_t * /*pProperties*/,
const void *pArgValue) {
if (argIndex > zeCommonProperties->numKernelArgs - 1) {
if (argIndex > zeCommonProperties.numKernelArgs - 1) {
return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX;
}

Expand Down Expand Up @@ -315,7 +314,7 @@ ur_result_t ur_kernel_handle_t_::prepareForSubmission(

ur_result_t ur_kernel_handle_t_::addPendingMemoryAllocation(
pending_memory_allocation_t allocation) {
if (allocation.argIndex > zeCommonProperties->numKernelArgs - 1) {
if (allocation.argIndex > zeCommonProperties.numKernelArgs - 1) {
return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX;
}

Expand All @@ -327,7 +326,7 @@ ur_result_t ur_kernel_handle_t_::addPendingMemoryAllocation(
ur_result_t
ur_kernel_handle_t_::addPendingPointerArgument(uint32_t argIndex,
const void *pArgValue) {
if (argIndex > zeCommonProperties->numKernelArgs - 1) {
if (argIndex > zeCommonProperties.numKernelArgs - 1) {
return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX;
}

Expand Down
2 changes: 1 addition & 1 deletion unified-runtime/source/adapters/level_zero/v2/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct ur_kernel_handle_t_ : ur_object {
std::vector<std::optional<ur_single_device_kernel_t>> deviceKernels;

// Cache of the common kernel properties.
mutable ZeCache<common_properties_t> zeCommonProperties;
common_properties_t zeCommonProperties;

// Index of the device in the deviceKernels vector.
size_t deviceIndex(ur_device_handle_t hDevice) const;
Expand Down