blob: facd6549bc35633d42d77e4f93e475cd486cf96e [file] [log] [blame] [edit]
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "iree/builtins/ukernel/mmt4d_internal.h"
#include "iree/hal/local/executable_loader.h"
#include "iree/hal/local/executable_plugin.h"
// Importer entry point wrapping the actual ukernel.
static int iree_uk_importer_mmt4d(void* params_ptr, void* context,
void* reserved) {
iree_uk_mmt4d_p((const iree_uk_mmt4d_params_t*)params_ptr);
return 0;
}
// Called to resolve the iree_uk_mmt4d import by symbol name.
static iree_status_t iree_uk_importer_resolve(
void* self, iree_host_size_t count, const char* const* symbol_names,
void** out_fn_ptrs, void** out_fn_contexts,
iree_hal_executable_import_resolution_t* out_resolution) {
*out_resolution = 0;
bool any_required_not_found = true;
for (size_t i = 0; i < count; ++i) {
if (out_fn_ptrs[i]) continue;
bool found = iree_hal_executable_plugin_strcmp(symbol_names[i],
"iree_uk_mmt4d") == 0;
if (found) {
out_fn_ptrs[i] = (void*)iree_uk_importer_mmt4d;
out_fn_contexts[i] = NULL;
any_required_not_found = false;
} else {
break;
}
}
return any_required_not_found ? iree_make_status(IREE_STATUS_NOT_FOUND)
: iree_ok_status();
}
iree_hal_executable_import_provider_t importer_query(void) {
static iree_hal_executable_import_provider_t importer = {
.resolve = iree_uk_importer_resolve,
};
return importer;
}