Skip to content

Commit 3fef5c0

Browse files
LukeBoyercopybara-github
authored andcommitted
Path fixes for OSS litert device scripts.
LiteRT-PiperOrigin-RevId: 826070554
1 parent af8279f commit 3fef5c0

File tree

8 files changed

+20
-12
lines changed

8 files changed

+20
-12
lines changed

litert/ats/BUILD

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
load("@rules_cc//cc:cc_library.bzl", "cc_library")
1616
load("@rules_cc//cc:cc_test.bzl", "cc_test")
1717
load("//litert/ats:ats.bzl", "litert_define_ats")
18-
load("//litert/build_common:litert_build_defs.bzl", "litert_test")
18+
load("//litert/build_common:litert_build_defs.bzl", "commandline_flag_copts", "litert_test")
1919
load("//litert/integration_test:litert_device.bzl", "litert_device_test")
2020
load("//litert/integration_test:litert_device_script.bzl", "make_download_model_provider")
2121

@@ -31,7 +31,7 @@ package(
3131
litert_test(
3232
name = "ats",
3333
srcs = ["ats.cc"],
34-
copts = ["-DGOOGLE_COMMANDLINEFLAGS_FULL_API=1"],
34+
copts = commandline_flag_copts(),
3535
linkstatic = True,
3636
no_main = True,
3737
tags = [
@@ -62,6 +62,7 @@ cc_library(
6262
testonly = True,
6363
srcs = ["configure.cc"],
6464
hdrs = ["configure.h"],
65+
copts = commandline_flag_copts(),
6566
deps = [
6667
":common",
6768
"//litert/c:litert_common",
@@ -199,6 +200,7 @@ litert_device_test(
199200
cc_test(
200201
name = "check_ats",
201202
srcs = ["check_ats.cc"],
203+
copts = commandline_flag_copts(),
202204
data = [
203205
"//litert/test:testdata/simple_model.tflite",
204206
"//litert/vendors/examples:example_dispatch_so",
@@ -346,9 +348,8 @@ litert_define_ats(
346348
backend = "example",
347349
compile_only_suffix = "_aot",
348350
do_register = [
349-
# "sub.*f32",
350-
# "mul.*f32",
351-
".*ExtraModel.*",
351+
"sub.*f32",
352+
"mul.*f32",
352353
],
353354
extra_flags = ["--limit=1"],
354355
jit_suffix = "",

litert/ats/ats_aot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#!/bin/bash
1616

17-
source "${0%.*}_lib.sh" || exit 1
17+
source "${0%.sh}_lib.sh" || exit 1
1818

1919
# TODO: Unify workdirs with other scripts.
2020
readonly models_out="/tmp/litert_extras/ats"

litert/build_common/litert_build_defs.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ def _valid_so_name(name):
116116
def _make_target_ref(name):
117117
return ":{}".format(name)
118118

119+
def commandline_flag_copts():
120+
return select({
121+
"@org_tensorflow//tensorflow:android": ["-DGOOGLE_COMMANDLINEFLAGS_FULL_API=1"] + if_oss(["-DABSL_FLAGS_STRIP_NAMES=0"]),
122+
"//conditions:default": [],
123+
})
124+
119125
####################################################################################################
120126
# Explicitly Link System Libraries ("ungrte")
121127

litert/integration_test/BUILD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
1717
load("@rules_cc//cc:cc_library.bzl", "cc_library")
1818
load("@rules_cc//cc:cc_test.bzl", "cc_test")
19+
load("//litert/build_common:litert_build_defs.bzl", "if_oss")
1920
load("//litert/build_common:special_rule.bzl", "litert_android_linkopts")
2021
load("//litert/integration_test:litert_device.bzl", "litert_device_exec", "litert_device_test", "litert_integration_test")
2122
load("//litert/integration_test:litert_device_common.bzl", "device_rlocation", "get_libs")
@@ -416,7 +417,7 @@ platform(
416417
cc_binary(
417418
name = "dummy_binary",
418419
srcs = ["dummy_binary.cc"],
419-
copts = ["-DGOOGLE_COMMANDLINEFLAGS_FULL_API=1"],
420+
copts = ["-DGOOGLE_COMMANDLINEFLAGS_FULL_API=1"] + if_oss(["-DABSL_FLAGS_STRIP_NAMES=0"]),
420421
deps = [
421422
"//litert/core:filesystem",
422423
"@com_google_absl//absl/container:flat_hash_set",
@@ -510,7 +511,7 @@ litert_device_test(
510511
name = "tools_test",
511512
srcs = ["smoketests/tools_test.cc"],
512513
backend_id = "cpu",
513-
copts = ["-DGOOGLE_COMMANDLINEFLAGS_FULL_API=1"],
514+
copts = ["-DGOOGLE_COMMANDLINEFLAGS_FULL_API=1"] + if_oss(["-DABSL_FLAGS_STRIP_NAMES=0"]),
514515
data = ["//litert/integration_test/models:single_op"],
515516
exec_args = ["--models_dir={}".format(device_rlocation("//litert/integration_test/models:single_op"))],
516517
deps = [

litert/integration_test/device_script_template.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Shell library for working with data and executable files from bzl between host
1818
# and device. Meant to be templated via litert_device_script.bzl.
1919

20-
source third_party/odml/litert/litert/integration_test/device_script_common.sh || exit 1
20+
source litert/integration_test/device_script_common.sh || exit 1
2121

2222
# Root of runfiles on the device.
2323
device_runfiles_root="/data/local/tmp/runfiles"

litert/integration_test/device_script_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#!/bin/bash
1616

17-
source ${0#.*}_lib.sh || exit 1
17+
source ${0%.sh}_lib.sh || exit 1
1818

1919
check_host=""
2020
check_device=""

litert/integration_test/download_model_provider.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#!/bin/bash
1616

17-
source third_party/odml/litert/litert/integration_test/device_script_common.sh || exit 1
17+
source litert/integration_test/device_script_common.sh || exit 1
1818

1919
# TODO: Unify workdirs with other scripts.
2020
readonly work_dir="/tmp/litert_extras"

litert/integration_test/mobile_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#!/bin/bash
1616

17-
source "${0%.*}_lib.sh" || exit 1
17+
source "${0%.sh}_lib.sh" || exit 1
1818

1919
extra_args=("${@:1}")
2020
d_bin=$(device_bin)

0 commit comments

Comments
 (0)