blob: 63df34693f96fd96daa485cba08f259b4ef9e164 [file] [log] [blame]
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/fuzzers/mojolpm.gni")
import("//third_party/protobuf/proto_library.gni")
source_set("coreml_graph_builder") {
sources = [
"coreml/graph_builder.cc",
"coreml/graph_builder.h",
]
deps = [
"//base",
"//services/webnn/public/mojom",
"//third_party/coremltools:modelformat_proto",
]
}
component("webnn_service") {
sources = [
"error.h",
"webnn_context_impl.cc",
"webnn_context_impl.h",
"webnn_context_provider_impl.cc",
"webnn_context_provider_impl.h",
"webnn_graph_impl.cc",
"webnn_graph_impl.h",
"webnn_utils.cc",
"webnn_utils.h",
]
if (is_win) {
sources += [
"dml/adapter.cc",
"dml/adapter.h",
"dml/command_queue.cc",
"dml/command_queue.h",
"dml/command_recorder.cc",
"dml/command_recorder.h",
"dml/context_impl.cc",
"dml/context_impl.h",
"dml/error.h",
"dml/graph_builder.cc",
"dml/graph_builder.h",
"dml/graph_impl.cc",
"dml/graph_impl.h",
"dml/platform_functions.cc",
"dml/platform_functions.h",
"dml/tensor_desc.cc",
"dml/tensor_desc.h",
"dml/utils.cc",
"dml/utils.h",
]
}
deps = [
"//base",
"//components/ml/webnn",
"//mojo/public/cpp/bindings",
"//services/webnn/public/mojom",
]
if (is_mac) {
sources += [
"coreml/context_impl.h",
"coreml/context_impl.mm",
"coreml/graph_impl.h",
"coreml/graph_impl.mm",
]
frameworks = [
"CoreFoundation.framework",
"CoreML.framework",
"Foundation.framework",
]
deps += [ ":coreml_graph_builder" ]
}
if (is_win) {
deps += [
"//third_party/fp16",
"//ui/gl",
"//ui/gl/init",
]
}
defines = [ "IS_WEBNN_SERVICE_IMPL" ]
}
source_set("tests") {
testonly = true
sources = [
"webnn_context_provider_impl_unittest.cc",
"webnn_graph_impl_unittest.cc",
"webnn_test_utils.cc",
"webnn_test_utils.h",
]
if (is_win) {
sources += [
"dml/adapter_test.cc",
"dml/command_queue_test.cc",
"dml/command_recorder_test.cc",
"dml/context_impl_test.cc",
"dml/graph_builder_test.cc",
"dml/graph_impl_test.cc",
"dml/platform_functions_test.cc",
"dml/tensor_desc_test.cc",
"dml/test_base.cc",
"dml/test_base.h",
]
}
if (is_mac) {
sources += [ "coreml/graph_impl_test.cc" ]
}
deps = [
":webnn_service",
"//base",
"//base/test:test_support",
"//components/ml/webnn",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/test_support:test_utils",
"//services/webnn/public/mojom",
"//testing/gtest",
]
if (is_win) {
deps += [
"//third_party/fp16",
"//ui/gl",
"//ui/gl/init",
]
}
}
mojolpm_fuzzer_test("webnn_graph_mojolpm_fuzzer") {
sources = [ "webnn_graph_mojolpm_fuzzer.cc" ]
proto_source = "webnn_graph_mojolpm_fuzzer.proto"
proto_deps = [ "//services/webnn/public/mojom:mojom_mojolpm" ]
deps = [
":coreml_graph_builder",
":webnn_service",
"//base",
"//base/test:test_support",
"//content/test/fuzzer:mojolpm_fuzzer_support",
"//services/webnn/public/mojom",
"//third_party/libprotobuf-mutator",
]
}