Skip to content

Use RBE to cache TF build results#6867

Merged
GMNGeoffrey merged 2 commits intoiree-org:mainfrom
GMNGeoffrey:tf-remote-cache
Aug 25, 2021
Merged

Use RBE to cache TF build results#6867
GMNGeoffrey merged 2 commits intoiree-org:mainfrom
GMNGeoffrey:tf-remote-cache

Conversation

@GMNGeoffrey
Copy link
Copy Markdown
Contributor

@GMNGeoffrey GMNGeoffrey commented Aug 25, 2021

TF makes it a total PITA to build it with remote execution, but we can
get a bunch of the benefits (and with much less configuration) with
remote caching. This has actions executed locally but cached remotely.

Note that we need to ensure that the machines reading and writing from
the cache are ~identical, so this should only be executed inside of a
docker container and the docker image digest is used as the cache key.

Not really sure why I didn't think of this earlier.

Tested: observe that in the integrations build of the second commit
here, the Bazel part of the build took 30 seconds.

@google-cla google-cla Bot added the cla: yes label Aug 25, 2021
@GMNGeoffrey GMNGeoffrey requested a review from ScottTodd August 25, 2021 22:22
@GMNGeoffrey GMNGeoffrey marked this pull request as ready for review August 25, 2021 22:22
@GMNGeoffrey GMNGeoffrey enabled auto-merge (squash) August 25, 2021 22:26
@GMNGeoffrey GMNGeoffrey added infrastructure Relating to build systems, CI, or testing infrastructure/bazel integrations Relating to high-level frontend integrations integrations/tensorflow TensorFlow model import and conversion labels Aug 25, 2021
# specific docker container the TF build is run in. The image URL is included
# for clarity and so that this reference is automatically updated by
# manage_images.py
build:remote_cache_tf_integrations --host_platform_remote_properties_override='properties:{name:"cache-silo-key" value:"gcr.io/iree-oss/cmake-bazel-frontends-swiftshader@sha256:103676490242311b9fad841294689a7ce1c755b935a21d8d898c25cfe3ec15e8"}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more place to update when the docker image changes... could we just use the prod or latest tag?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is a just an opaque string. If we used a tag it would never change, which would defeat the point 😛

manage_images.py updates all references to the docker image, so this should be ~zero marginal maintenance cost.

@GMNGeoffrey GMNGeoffrey requested a review from ScottTodd August 25, 2021 22:29
@GMNGeoffrey GMNGeoffrey merged commit b3db3dd into iree-org:main Aug 25, 2021
@GMNGeoffrey GMNGeoffrey deleted the tf-remote-cache branch August 25, 2021 22:32
GMNGeoffrey added a commit that referenced this pull request Aug 26, 2021
#6867 enabled this for the
swiftshader integrations build, to good effect, frequently halving the
time for the whole workflow. We don't run these builds on presubmit by
default, but they're running on machines with real GPUs, so the
resources are actually much more precious. Due to GCE constraints on
machines with real GPUs, they build machines are also only 16 cores.

Technically, these builds are running in slightly different docker
containers and so should perhaps have different cache keys, but the only
difference is in the final stage either installing nvidia or swiftshader
and that only makes a difference for the CMake part of each build when
we run vulkan tests.

Tested: Bazel part of the turing presubmit run on this PR took under a
minute instead of the typical 45 minutes
(https://source.cloud.google.com/results/invocations/c23ee21c-2ca8-4717-896d-83e39e49e281
vs
https://source.cloud.google.com/results/invocations/8511982d-8120-4e18-985f-5f68be93d4a8)
@hanhanW hanhanW mentioned this pull request Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Relating to build systems, CI, or testing integrations/tensorflow TensorFlow model import and conversion integrations Relating to high-level frontend integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants