Skip to content

Commit d2b0103

Browse files
authored
Merge branch 'master' into fix-doc-typo
2 parents 3ced905 + ce93e84 commit d2b0103

File tree

88 files changed

+1017
-681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1017
-681
lines changed

Diff for: .bazelversion

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
5.3.0
1+
6.5.0
2+
# NOTE: Update Bazel version in tensorflow/tools/ci_build/release/common.sh.oss

Diff for: .github/workflows/ci.yaml

+27-22
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v1
1212
- uses: actions/setup-python@v1
1313
with:
14-
python-version: '3.9'
14+
python-version: '3.10'
1515
architecture: 'x64'
1616
- name: Install Lint tools
1717
run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@v1
2727
- uses: actions/setup-python@v1
2828
with:
29-
python-version: '3.9'
29+
python-version: '3.10'
3030
architecture: 'x64'
3131
- name: Install Format tools
3232
run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
@@ -41,7 +41,7 @@ jobs:
4141
- uses: actions/checkout@v1
4242
- uses: actions/setup-python@v1
4343
with:
44-
python-version: '3.9'
44+
python-version: '3.10'
4545
architecture: 'x64'
4646
- name: Install Bazel on CI
4747
run: ./scripts/ci_install.sh
@@ -61,7 +61,7 @@ jobs:
6161
- uses: actions/checkout@v1
6262
- uses: actions/setup-python@v1
6363
with:
64-
python-version: '3.9'
64+
python-version: '3.10'
6565
architecture: 'x64'
6666
- name: Install Bazel on CI
6767
run: ./scripts/ci_install.sh
@@ -70,23 +70,28 @@ jobs:
7070
- name: Full Library Test
7171
run: ./scripts/test_all.sh
7272

73-
leak-tests:
74-
name: Memory Leak tests
75-
runs-on: ubuntu-20.04
76-
needs: [lint, format]
77-
78-
steps:
79-
- uses: actions/checkout@v1
80-
- uses: actions/setup-python@v1
81-
with:
82-
python-version: '3.9'
83-
architecture: 'x64'
84-
- name: Install Bazel on CI
85-
run: ./scripts/ci_install.sh
86-
- name: Configure CI TF
87-
run: echo "Y\n" | ./configure.sh
88-
- name: Leak Test qsim and src
89-
run: ./scripts/msan_test.sh
73+
# 2024-11-30 [mhucka] temporarily turning off leak-tests because it produces
74+
# false positives on GH that we can't immediately address. TODO: if updating
75+
# TFQ to use Clang and the latest TF does not resolve this, find a way to
76+
# skip the handful of failing tests and renable the rest of the msan tests.
77+
#
78+
# leak-tests:
79+
# name: Memory Leak tests
80+
# runs-on: ubuntu-20.04
81+
# needs: [lint, format]
82+
#
83+
# steps:
84+
# - uses: actions/checkout@v1
85+
# - uses: actions/setup-python@v1
86+
# with:
87+
# python-version: '3.10'
88+
# architecture: 'x64'
89+
# - name: Install Bazel on CI
90+
# run: ./scripts/ci_install.sh
91+
# - name: Configure CI TF
92+
# run: echo "Y\n" | ./configure.sh
93+
# - name: Leak Test qsim and src
94+
# run: ./scripts/msan_test.sh
9095

9196
tutorials-test:
9297
name: Tutorial tests
@@ -97,7 +102,7 @@ jobs:
97102
- uses: actions/checkout@v1
98103
- uses: actions/setup-python@v1
99104
with:
100-
python-version: '3.9'
105+
python-version: '3.10'
101106
architecture: 'x64'
102107
- name: Install notebook dependencies
103108
run: pip install --upgrade pip seaborn==0.10.0

Diff for: .github/workflows/cirq_compatibility.yaml

+164-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,171 @@
1-
name: Cirq Compatibility
1+
# Copyright 2024 The TensorFlow Quantum Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# Summary: GitHub CI workflow for testing TFQ against Cirq releases
17+
#
18+
# This workflow is executed every night on a schedule. By default, this
19+
# workflow will save Bazel build artifacts if an error occurs during a run.
20+
#
21+
# For testing, this workflow can be invoked manually from the GitHub page at
22+
# https://github.com/tensorflow/quantum/actions/workflows/cirq_compatibility.yaml
23+
# Clicking the "Run workflow" button there will present a form interface with
24+
# options for overridding some of the parameters for the run.
25+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26+
27+
name: Cirq compatibility tests
28+
29+
# Default values. These can be overridden when workflow dispatch is used.
30+
env:
31+
# Python version to test against.
32+
py_version: '3.10'
33+
# Bazel version. Note: this needs to match what is used in TF & TFQ.
34+
bazel_version: 6.5.0
35+
# Machine architecture.
36+
arch: x64
37+
# Additional .bazelrc options to use.
38+
bazelrc_additions: |
39+
common --announce_rc
40+
build --verbose_failures
41+
test --test_timeout=3000
242
343
on:
44+
# Nightly runs.
445
schedule:
5-
- cron: "0 0 * * *"
46+
- cron: 0 0 * * *
47+
# Manual on-demand invocations.
48+
workflow_dispatch:
49+
inputs:
50+
py_version:
51+
description: Version of Python to use
52+
bazel_version:
53+
description: Version of Bazel Python to use
54+
arch:
55+
description: Computer architecture to use
56+
use_bazel_disk_cache:
57+
description: Use Bazel disk_cache between runs?
58+
type: boolean
59+
default: true
60+
cache_bazel_tests:
61+
description: Allow Bazel to cache test results?
62+
type: boolean
63+
default: true
64+
save_artifacts:
65+
description: Make Bazel build outputs downloadable?
66+
type: boolean
67+
default: true
668

769
jobs:
8-
consistency:
9-
name: Nightly Compatibility
10-
runs-on: ubuntu-16.04
70+
test-compatibility:
71+
name: Run TFQ tests
72+
runs-on: ubuntu-20.04
1173
steps:
12-
- uses: actions/checkout@v1
13-
- uses: actions/setup-python@v1
74+
- name: Check out a copy of the TFQ git repository
75+
uses: actions/checkout@v4
76+
77+
- name: Set up Python
78+
id: python
79+
uses: actions/setup-python@v5
80+
with:
81+
python-version: ${{github.event.inputs.py_version || env.py_version}}
82+
architecture: ${{github.event.inputs.arch || env.arch}}
83+
cache: pip
84+
85+
- name: Install TensorFlow Quantum dependencies
86+
run: |
87+
pip install --upgrade pip setuptools wheel
88+
pip install -r requirements.txt
89+
90+
- name: Install the nightly build version of Cirq
91+
run: |
92+
pip install -U cirq --pre
93+
94+
- name: Configure Bazel options
95+
run: |
96+
# If we didn't get a cache hit on the installed Python environment,
97+
# something's changed, and we want to make sure to re-run all tests.
98+
if [[ "${{steps.python.outputs.cache-hit}}" == "true"
99+
&& "${{github.event.inputs.cache_bazel_tests}}" != "false" ]]; then
100+
echo "cache_bazel_tests=auto" >> "$GITHUB_ENV"
101+
else
102+
echo "cache_bazel_tests=no" >> "$GITHUB_ENV"
103+
fi
104+
# Use the disk cache unless told not to.
105+
if [[ "${{github.event.inputs.use_bazel_disk_cache}}" != "false" ]]; then
106+
echo "use_bazel_disk_cache=true" >> "$GITHUB_ENV"
107+
else
108+
echo "use_bazel_disk_cache=false" >> "$GITHUB_ENV"
109+
fi
110+
111+
- name: Set up Bazel with caching
112+
if: env.use_bazel_disk_cache == 'true'
113+
uses: bazel-contrib/[email protected]
114+
env:
115+
USE_BAZEL_VERSION: ${{github.event.inputs.bazel_version || env.bazel_version}}
116+
with:
117+
disk-cache: ${{github.workflow}}
118+
bazelisk-cache: true
119+
external-cache: true
120+
repository-cache: true
121+
bazelrc: |
122+
${{env.bazelrc_additions}}
123+
test --cache_test_results=${{env.cache_bazel_tests}}
124+
125+
- name: Set up Bazel without caching
126+
if: env.use_bazel_disk_cache == 'false'
127+
uses: bazel-contrib/[email protected]
128+
env:
129+
USE_BAZEL_VERSION: ${{github.event.inputs.bazel_version || env.bazel_version}}
130+
with:
131+
bazelrc: |
132+
${{env.bazelrc_additions}}
133+
test --cache_test_results=${{env.cache_bazel_tests}}
134+
135+
- name: Configure TFQ
136+
run: |
137+
set -x -e
138+
# Save information to the run log, in case it's needed for debugging.
139+
which python
140+
python --version
141+
python -c 'import site; print(site.getsitepackages())'
142+
python -c 'import tensorflow; print(tensorflow.version.VERSION)'
143+
python -c 'import cirq; print(cirq.__version__)'
144+
# Run the TFQ configuration script.
145+
printf "Y\n" | ./configure.sh
146+
147+
- name: Run TFQ tests
148+
# TODO: when the msan tests are working again, replace the "touch"
149+
# line with ./scripts/msan_test.sh 2>&1 | tee msan-tests-output.log
150+
run: |
151+
set -x -e
152+
./scripts/test_all.sh 2>&1 | tee main-tests-output.log
153+
touch msan-tests-output.log
154+
155+
- name: Make Bazel artifacts downloadable (if desired)
156+
if: >-
157+
github.event.inputs.save_artifacts == 'true'
158+
&& (failure() || github.event_name == 'workflow_dispatch')
159+
uses: actions/upload-artifact@v4
14160
with:
15-
python-version: '3.8'
16-
architecture: 'x64'
17-
- name: Install Bazel on CI
18-
run: ./scripts/ci_install.sh
19-
- name: Configure CI TF
20-
run: echo "Y\n" | ./configure.sh
21-
- name: Install Cirq nightly
22-
run: pip install -U cirq --pre
23-
- name: Nightly tests
24-
run: ./scripts/test_all.sh
161+
name: bazel-out
162+
retention-days: 7
163+
include-hidden-files: true
164+
path: |
165+
main-tests-output.log
166+
msan-tests-output.log
167+
/home/runner/.bazel/execroot/__main__/bazel-out/
168+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.so
169+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.o
170+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_objs
171+
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_solib_k8

Diff for: WORKSPACE

+22-15
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# This file includes external dependencies that are required to compile the
22
# TensorFlow op.
33

4+
5+
46
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
57

6-
EIGEN_COMMIT = "3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e"
7-
EIGEN_SHA256 = "eca9847b3fe6249e0234a342b78f73feec07d29f534e914ba5f920f3e09383a3"
8+
9+
10+
EIGEN_COMMIT = "aa6964bf3a34fd607837dd8123bc42465185c4f8"
811

912

1013
http_archive(
@@ -16,7 +19,6 @@ cc_library(
1619
visibility = ["//visibility:public"],
1720
)
1821
""",
19-
sha256 = EIGEN_SHA256,
2022
strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT),
2123
urls = [
2224
"https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
@@ -27,35 +29,41 @@ cc_library(
2729
http_archive(
2830
name = "qsim",
2931
sha256 = "b9c1eba09a885a938b5e73dfc2e02f5231cf3b01d899415caa24769346a731d5",
32+
# patches = [
33+
# "//third_party/tf:qsim.patch",
34+
# ],
3035
strip_prefix = "qsim-0.13.3",
3136
urls = ["https://github.com/quantumlib/qsim/archive/refs/tags/v0.13.3.zip"],
3237
)
3338

3439
http_archive(
3540
name = "org_tensorflow",
36-
sha256 = "e52cda3bae45f0ae0fccd4055e9fa29892b414f70e2df94df9a3a10319c75fff",
37-
strip_prefix = "tensorflow-2.11.0",
41+
patches = [
42+
"//third_party/tf:tf.patch",
43+
],
44+
# sha256 = "e52cda3bae45f0ae0fccd4055e9fa29892b414f70e2df94df9a3a10319c75fff",
45+
strip_prefix = "tensorflow-2.15.0",
3846
urls = [
39-
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.zip",
47+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.15.0.zip",
4048
],
4149
)
4250

4351

44-
load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
52+
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
4553

46-
workspace()
54+
tf_workspace3()
4755

48-
load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
56+
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
4957

50-
workspace()
58+
tf_workspace2()
5159

52-
load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
60+
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
5361

54-
workspace()
62+
tf_workspace1()
5563

56-
load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")
64+
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
5765

58-
workspace()
66+
tf_workspace0()
5967

6068
load("//third_party/tf:tf_configure.bzl", "tf_configure")
6169

@@ -72,4 +80,3 @@ bind(
7280
name = "six",
7381
actual = "@six_archive//:six",
7482
)
75-

0 commit comments

Comments
 (0)