Enable XLA MLIR GPU lit tests for open source.
PiperOrigin-RevId: 307342297 Change-Id: Ie2a577c701bdeda644a5ff1404e23bbfbb02decd
This commit is contained in:
parent
fcb485f663
commit
b53fc48adb
tensorflow/compiler
@ -26,7 +26,7 @@ _ALWAYS_EXCLUDE = [
|
|||||||
"**/* */**",
|
"**/* */**",
|
||||||
]
|
]
|
||||||
|
|
||||||
def _run_lit_test(name, data, size, tags, driver, features):
|
def _run_lit_test(name, data, size, tags, driver, features, exec_properties):
|
||||||
"""Runs lit on all tests it can find in `data` under tensorflow/compiler/mlir.
|
"""Runs lit on all tests it can find in `data` under tensorflow/compiler/mlir.
|
||||||
|
|
||||||
Note that, due to Bazel's hermetic builds, lit only sees the tests that
|
Note that, due to Bazel's hermetic builds, lit only sees the tests that
|
||||||
@ -64,6 +64,7 @@ def _run_lit_test(name, data, size, tags, driver, features):
|
|||||||
],
|
],
|
||||||
size = size,
|
size = size,
|
||||||
main = "lit.py",
|
main = "lit.py",
|
||||||
|
exec_properties = exec_properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
def glob_lit_tests(
|
def glob_lit_tests(
|
||||||
@ -76,7 +77,8 @@ def glob_lit_tests(
|
|||||||
default_tags = _default_tags,
|
default_tags = _default_tags,
|
||||||
tags_override = {},
|
tags_override = {},
|
||||||
driver = _default_driver,
|
driver = _default_driver,
|
||||||
features = []):
|
features = [],
|
||||||
|
exec_properties = {}):
|
||||||
"""Creates all plausible Lit tests (and their inputs) under this directory.
|
"""Creates all plausible Lit tests (and their inputs) under this directory.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -92,6 +94,7 @@ def glob_lit_tests(
|
|||||||
Note: use of a custom driver is not currently supported
|
Note: use of a custom driver is not currently supported
|
||||||
and specifying a default driver will abort the tests.
|
and specifying a default driver will abort the tests.
|
||||||
features: [str], list of extra features to enable.
|
features: [str], list of extra features to enable.
|
||||||
|
exec_properties: a dictionary of properties to pass on.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Ignore some patterns by default for tests and input data.
|
# Ignore some patterns by default for tests and input data.
|
||||||
@ -115,6 +118,7 @@ def glob_lit_tests(
|
|||||||
tags = default_tags + tags_override.pop(curr_test, []),
|
tags = default_tags + tags_override.pop(curr_test, []),
|
||||||
driver = driver,
|
driver = driver,
|
||||||
features = features,
|
features = features,
|
||||||
|
exec_properties = exec_properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
def lit_test(
|
def lit_test(
|
||||||
@ -123,7 +127,8 @@ def lit_test(
|
|||||||
size = _default_size,
|
size = _default_size,
|
||||||
tags = _default_tags,
|
tags = _default_tags,
|
||||||
driver = _default_driver,
|
driver = _default_driver,
|
||||||
features = []):
|
features = [],
|
||||||
|
exec_properties = {}):
|
||||||
"""Runs test files under lit.
|
"""Runs test files under lit.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -136,4 +141,4 @@ def lit_test(
|
|||||||
and specifying a default driver will abort the tests.
|
and specifying a default driver will abort the tests.
|
||||||
features: [str], list of extra features to enable.
|
features: [str], list of extra features to enable.
|
||||||
"""
|
"""
|
||||||
_run_lit_test(name + ".test", data + [name], size, tags, driver, features)
|
_run_lit_test(name + ".test", data + [name], size, tags, driver, features, exec_properties)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
load(
|
load(
|
||||||
"//tensorflow/core/platform:build_config_root.bzl",
|
"//tensorflow/core/platform:build_config_root.bzl",
|
||||||
"tf_cuda_tests_tags",
|
"tf_cuda_tests_tags",
|
||||||
|
"tf_exec_properties",
|
||||||
)
|
)
|
||||||
load("//tensorflow/compiler/mlir:glob_lit_test.bzl", "glob_lit_tests")
|
load("//tensorflow/compiler/mlir:glob_lit_test.bzl", "glob_lit_tests")
|
||||||
|
|
||||||
@ -18,9 +19,7 @@ package_group(
|
|||||||
|
|
||||||
glob_lit_tests(
|
glob_lit_tests(
|
||||||
data = [":test_utilities"],
|
data = [":test_utilities"],
|
||||||
# TODO(141337082): Figure out why the tests do not run successfully in open
|
default_tags = tf_cuda_tests_tags() + ["config-cuda-only"],
|
||||||
# source.
|
|
||||||
default_tags = ["no_oss"] + tf_cuda_tests_tags(),
|
|
||||||
driver = "@llvm-project//mlir:run_lit.sh",
|
driver = "@llvm-project//mlir:run_lit.sh",
|
||||||
exclude = [
|
exclude = [
|
||||||
# TODO(b/149302060) Reenable once fusion is fixed.
|
# TODO(b/149302060) Reenable once fusion is fixed.
|
||||||
@ -28,6 +27,7 @@ glob_lit_tests(
|
|||||||
# TODO(b/137624192): Reenable once we can fuse reductions.
|
# TODO(b/137624192): Reenable once we can fuse reductions.
|
||||||
"fused_reduce.hlo",
|
"fused_reduce.hlo",
|
||||||
],
|
],
|
||||||
|
exec_properties = tf_exec_properties({"tags": tf_cuda_tests_tags()}),
|
||||||
test_file_exts = ["hlo"],
|
test_file_exts = ["hlo"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -80,8 +80,7 @@ int main(int argc, char **argv) {
|
|||||||
: opt.CompileAndOutputIr(file->getBuffer().str(),
|
: opt.CompileAndOutputIr(file->getBuffer().str(),
|
||||||
output->os(), lowering_stage);
|
output->os(), lowering_stage);
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
output->os() << status.error_message();
|
LOG(ERROR) << status.error_message();
|
||||||
output->keep();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
output->keep();
|
output->keep();
|
||||||
|
Loading…
Reference in New Issue
Block a user