From b8e0c1f9b7826801d8f62628486972f0e929dbac Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Fri, 25 Aug 2023 17:32:06 -0700 Subject: [PATCH 01/10] Create openxla.md --- docs/openxla.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/openxla.md diff --git a/docs/openxla.md b/docs/openxla.md new file mode 100644 index 000000000000..0423462fafc4 --- /dev/null +++ b/docs/openxla.md @@ -0,0 +1,36 @@ +# OpenXLA + +PyTorch/XLA is a Python package that uses the [XLA deep learning +compiler](https://www.tensorflow.org/xla) to connect the [PyTorch deep learning +framework](https://pytorch.org/) and [Cloud +TPUs](https://cloud.google.com/tpu/). PyTorch/XLA now pull XLA from OpenXLA. +OpenXLA here means [open source machine learning compiler XLA for GPUs, CPUs, and ML accelerators](https://github.com/openxla/xla), +which belongs to the same-name community [OpenXLA Community](https://github.com/openxla) and this community also contain [StableHLO](https://github.com/openxla/stablehlo). + +PyTorch/XLA used to pull XLA from [TensorFlow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/compiler/xla) before https://github.com/pytorch/xla/pull/5202. +After https://github.com/pytorch/xla/pull/5202, PyTorch/XLA has migrated from pull XLA from [TensorFlow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/compiler/xla) +to pull XLA from [OpenXLA](https://github.com/openxla/xla). + + +# How to use OpenXLA + +For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) user, +there is no logic change before and after [Migrate PyTorch/XLA to pull XLA from OpenXLA](https://github.com/pytorch/xla/pull/5202). +For XRT runtime user, because OpenXLA don't support XRT, user could use XRT from [XRT branch of PyTorch/XLA](https://github.com/pytorch/xla/tree/xrt). + +# Difference + +There is no change in user side. Before migrate to pull XLA from OpenXLA, PyTorch/XLA need to build with TensorFlow, but now build with OpenXLA + +# Performance +| Training Throughput on ResNet50 | +| | resnet50-pjrt-v2-8 | resnet50-pjrt-v4-8 | resnet50-pjrt-v4-32 | +| -------- | ------- | ------- | ------- | +| Pre Migration | 18.59 | 20.06 | 27.92 | +| Post Migration | 18.63 | 19.94 | 27.14 | + +# pin dependency sunset +PyTorch/XLA pull XLA from OpenXLA via pin to a specific commit + +# other `OpenXLA` or `openxla` used in PyTorch or PyTorch/XLA + From faa392fd1844e6ebad8ac690df35f5d588cdc0a6 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:12:53 -0700 Subject: [PATCH 02/10] Update openxla.md --- docs/openxla.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index 0423462fafc4..cf576738db6f 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -23,12 +23,13 @@ For XRT runtime user, because OpenXLA don't support XRT, user could use XRT from There is no change in user side. Before migrate to pull XLA from OpenXLA, PyTorch/XLA need to build with TensorFlow, but now build with OpenXLA # Performance -| Training Throughput on ResNet50 | -| | resnet50-pjrt-v2-8 | resnet50-pjrt-v4-8 | resnet50-pjrt-v4-32 | -| -------- | ------- | ------- | ------- | +||Training Throughput on ResNet50|Training Throughput on ResNet50 |Training Throughput on ResNet50 | +| :------------ | :------------ | :------------ | :------------ | +| model-pjrt-tpu | resnet50-pjrt-v2-8 | resnet50-pjrt-v4-8 | resnet50-pjrt-v4-32 | | Pre Migration | 18.59 | 20.06 | 27.92 | | Post Migration | 18.63 | 19.94 | 27.14 | + # pin dependency sunset PyTorch/XLA pull XLA from OpenXLA via pin to a specific commit From df52fb49af7e583b8d534dd571df4932b6f48370 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:20:11 -0700 Subject: [PATCH 03/10] Update openxla.md --- docs/openxla.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index cf576738db6f..b3e9aa435278 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -18,9 +18,6 @@ For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) user there is no logic change before and after [Migrate PyTorch/XLA to pull XLA from OpenXLA](https://github.com/pytorch/xla/pull/5202). For XRT runtime user, because OpenXLA don't support XRT, user could use XRT from [XRT branch of PyTorch/XLA](https://github.com/pytorch/xla/tree/xrt). -# Difference - -There is no change in user side. Before migrate to pull XLA from OpenXLA, PyTorch/XLA need to build with TensorFlow, but now build with OpenXLA # Performance ||Training Throughput on ResNet50|Training Throughput on ResNet50 |Training Throughput on ResNet50 | From 7188db17cb521ed1e1d174140bf94ad1e27f1765 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:21:30 -0700 Subject: [PATCH 04/10] Update openxla.md --- docs/openxla.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index b3e9aa435278..b4d418aabfdf 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -14,9 +14,7 @@ to pull XLA from [OpenXLA](https://github.com/openxla/xla). # How to use OpenXLA -For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) user, -there is no logic change before and after [Migrate PyTorch/XLA to pull XLA from OpenXLA](https://github.com/pytorch/xla/pull/5202). -For XRT runtime user, because OpenXLA don't support XRT, user could use XRT from [XRT branch of PyTorch/XLA](https://github.com/pytorch/xla/tree/xrt). +For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) users, there is no change with this migration. For XRT runtime users, there is a separate [XRT branch of PyTorch/XLA](https://github.com/pytorch/xla/tree/xrt) since OpenXLA doesn't support XRT, . # Performance From 27bef8c575b08e594ed3f2bf4cf8ec3d6c0e9e1b Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:24:44 -0700 Subject: [PATCH 05/10] Update openxla.md --- docs/openxla.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index b4d418aabfdf..3596cd455b07 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -1,16 +1,9 @@ # OpenXLA -PyTorch/XLA is a Python package that uses the [XLA deep learning -compiler](https://www.tensorflow.org/xla) to connect the [PyTorch deep learning -framework](https://pytorch.org/) and [Cloud -TPUs](https://cloud.google.com/tpu/). PyTorch/XLA now pull XLA from OpenXLA. -OpenXLA here means [open source machine learning compiler XLA for GPUs, CPUs, and ML accelerators](https://github.com/openxla/xla), -which belongs to the same-name community [OpenXLA Community](https://github.com/openxla) and this community also contain [StableHLO](https://github.com/openxla/stablehlo). - -PyTorch/XLA used to pull XLA from [TensorFlow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/compiler/xla) before https://github.com/pytorch/xla/pull/5202. -After https://github.com/pytorch/xla/pull/5202, PyTorch/XLA has migrated from pull XLA from [TensorFlow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/compiler/xla) -to pull XLA from [OpenXLA](https://github.com/openxla/xla). +As of ***Jun 28***, PyTorch/XLA now ***pulls*** XLA from OpenXLA. +OpenXLA ***is an*** [open source machine learning compiler XLA for GPUs, CPUs, and ML accelerators](https://github.com/openxla/xla). +Previous to OpenXLA, PyTorch/XLA pulled XLA directly from [TensorFlow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/compiler/xla). With our [XLA to OpenXLA migration](https://github.com/pytorch/xla/pull/5202), PyTorch/XLA now pulls XLA from [OpenXLA](https://github.com/openxla/xla). # How to use OpenXLA From abd32e04f6552289e0a7e44f1fedee9daa5c0ca4 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:15:56 -0700 Subject: [PATCH 06/10] Update openxla.md --- docs/openxla.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index 3596cd455b07..83cdfeccebe1 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -21,5 +21,3 @@ For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) user # pin dependency sunset PyTorch/XLA pull XLA from OpenXLA via pin to a specific commit -# other `OpenXLA` or `openxla` used in PyTorch or PyTorch/XLA - From 4ebc7a4015b97e05abace277d5b8534f8b99b860 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:17:42 -0700 Subject: [PATCH 07/10] Update openxla.md --- docs/openxla.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index 83cdfeccebe1..b376b63c810d 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -1,7 +1,7 @@ # OpenXLA -As of ***Jun 28***, PyTorch/XLA now ***pulls*** XLA from OpenXLA. -OpenXLA ***is an*** [open source machine learning compiler XLA for GPUs, CPUs, and ML accelerators](https://github.com/openxla/xla). +As of June 28th, 2023, PyTorch/XLA now pulls XLA from OpenXLA. +OpenXLA is an [open source machine learning compiler XLA for GPUs, CPUs, and ML accelerators](https://github.com/openxla/xla). Previous to OpenXLA, PyTorch/XLA pulled XLA directly from [TensorFlow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/compiler/xla). With our [XLA to OpenXLA migration](https://github.com/pytorch/xla/pull/5202), PyTorch/XLA now pulls XLA from [OpenXLA](https://github.com/openxla/xla). From f04aa8150e04b27889b10f2d3fe66a773fc677e3 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:19:10 -0700 Subject: [PATCH 08/10] Update openxla.md --- docs/openxla.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index b376b63c810d..4f177462b411 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -11,9 +11,10 @@ For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) user # Performance -||Training Throughput on ResNet50|Training Throughput on ResNet50 |Training Throughput on ResNet50 | +Below is a performance comparison for ResNet50 pre and post the migration on different TPU hardwares. + +| | resnet50-pjrt-v2-8 | resnet50-pjrt-v4-8 | resnet50-pjrt-v4-32 | | :------------ | :------------ | :------------ | :------------ | -| model-pjrt-tpu | resnet50-pjrt-v2-8 | resnet50-pjrt-v4-8 | resnet50-pjrt-v4-32 | | Pre Migration | 18.59 | 20.06 | 27.92 | | Post Migration | 18.63 | 19.94 | 27.14 | From ab61ea23ca732c14c74702c9e16d2a91fb41c132 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:24:42 -0700 Subject: [PATCH 09/10] Update openxla.md --- docs/openxla.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index 4f177462b411..94d421421961 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -17,8 +17,3 @@ Below is a performance comparison for ResNet50 pre and post the migration on dif | :------------ | :------------ | :------------ | :------------ | | Pre Migration | 18.59 | 20.06 | 27.92 | | Post Migration | 18.63 | 19.94 | 27.14 | - - -# pin dependency sunset -PyTorch/XLA pull XLA from OpenXLA via pin to a specific commit - From 897d696b9db8db07c715a27985ccf65be2b83c67 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:40:49 -0700 Subject: [PATCH 10/10] Update openxla.md --- docs/openxla.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/openxla.md b/docs/openxla.md index 94d421421961..5dd3c6a76ce5 100644 --- a/docs/openxla.md +++ b/docs/openxla.md @@ -7,11 +7,11 @@ Previous to OpenXLA, PyTorch/XLA pulled XLA directly from [TensorFlow](https://g # How to use OpenXLA -For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) users, there is no change with this migration. For XRT runtime users, there is a separate [XRT branch of PyTorch/XLA](https://github.com/pytorch/xla/tree/xrt) since OpenXLA doesn't support XRT, . +For [PJRT runtime](https://github.com/pytorch/xla/blob/master/docs/pjrt.md) users, there is no change with this migration. For XRT runtime users, there is a separate [XRT branch of PyTorch/XLA](https://github.com/pytorch/xla/tree/xrt) since OpenXLA doesn't support XRT. # Performance -Below is a performance comparison for ResNet50 pre and post the migration on different TPU hardwares. +Below is a performance visual comparison of throughput for ResNet50 pre and post the migration on different TPU hardwares. | | resnet50-pjrt-v2-8 | resnet50-pjrt-v4-8 | resnet50-pjrt-v4-32 | | :------------ | :------------ | :------------ | :------------ |