Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion backends/xnnpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ if(EXECUTORCH_XNNPACK_ENABLE_KLEIDI)
add_definitions(-DENABLE_XNNPACK_KLEIDI)
endif()

set(_common_compile_options -Wno-deprecated-declarations -fPIC)
set(_common_compile_options
$<$<CXX_COMPILER_ID:MSVC>:/wd4996>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated-declarations -fPIC>
)

set(_xnnpack_schema__include_dir "${CMAKE_BINARY_DIR}/schema/include")
# Paths to headers generated from the .fbs files.
Expand Down
17 changes: 10 additions & 7 deletions backends/xnnpack/runtime/XNNCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,8 +1539,9 @@ Error defineGenericUnaryNode(
MAYBE_UNUSED(graph); \
auto graph_node = node->xnode_union_as_XNN##name(); \
std::pair<float, float> min_max = getOutputMinMax(node); \
union xnn_unary_params params = { \
.clamp = {.min = min_max.first, .max = min_max.second}}; \
union xnn_unary_params params; \
params.clamp.min = min_max.first; \
params.clamp.max = min_max.second; \
return defineGenericUnaryNode( \
subgraph_ptr, \
remapped_ids, \
Expand All @@ -1562,8 +1563,8 @@ Error defineGenericUnaryNode(
const fb_xnnpack::XNNGraph* graph) noexcept { \
MAYBE_UNUSED(graph); \
auto graph_node = node->xnode_union_as_XNNLeakyReLU(); \
union xnn_unary_params params = { \
.leaky_relu = {.negative_slope = graph_node->negative_slope()}}; \
union xnn_unary_params params; \
params.leaky_relu.negative_slope = graph_node->negative_slope(); \
return defineGenericUnaryNode( \
subgraph_ptr, \
remapped_ids, \
Expand All @@ -1585,7 +1586,8 @@ Error defineGenericUnaryNode(
const fb_xnnpack::XNNGraph* graph) noexcept { \
MAYBE_UNUSED(graph); \
auto graph_node = node->xnode_union_as_XNNELU(); \
union xnn_unary_params params = {.elu = {.alpha = graph_node->alpha()}}; \
union xnn_unary_params params; \
params.elu.alpha = graph_node->alpha(); \
return defineGenericUnaryNode( \
subgraph_ptr, \
remapped_ids, \
Expand Down Expand Up @@ -1637,8 +1639,9 @@ Error defineGenericBinaryNode(
MAYBE_UNUSED(graph); \
auto graph_node = node->xnode_union_as_XNN##name(); \
std::pair<float, float> min_max = getOutputMinMax(node); \
struct xnn_binary_params params = { \
.output_min = min_max.first, .output_max = min_max.second}; \
struct xnn_binary_params params; \
params.output_min = min_max.first; \
params.output_max = min_max.second; \
return defineGenericBinaryNode( \
subgraph_ptr, \
remapped_ids, \
Expand Down
6 changes: 5 additions & 1 deletion backends/xnnpack/runtime/XNNPACKBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class XnnpackBackend final

auto program_id =
reinterpret_cast<uintptr_t>(context.get_runtime_allocator());
auto workspace = ET_UNWRAP(get_or_create_workspace(program_id));
auto workspace_result = get_or_create_workspace(program_id);
if (!workspace_result.ok()) {
return workspace_result.error();
}
auto workspace = workspace_result.get();

#ifdef ENABLE_XNNPACK_WEIGHTS_CACHE
const std::lock_guard<std::mutex> lock_weight_cache(weights_cache_mutex_);
Expand Down
9 changes: 4 additions & 5 deletions backends/xnnpack/runtime/XNNWeightsCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,10 @@ size_t XNNWeightsCache::look_up_or_insert(
weight_bias_name.append(bias_entry->second);
}
}
PackedDataMeta packed_data_metadata = {
.offset = next_offset,
.ref_count =
0, // ref_count is only incremented after finalizing for runtime
.in_current_runtime = true};
PackedDataMeta packed_data_metadata;
packed_data_metadata.offset = next_offset;
packed_data_metadata.ref_count = 0; // ref_count is only incremented after finalizing for runtime
packed_data_metadata.in_current_runtime = true;
context->name_to_packed_data_metadata_[weight_bias_name] =
packed_data_metadata;
} else {
Expand Down
Loading