TPUs: float64 without float64 hardware, and QuantEcon's JAX workloads on Google Cloud

Đang mở
#27 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
google-cloud, python
Lĩnh vực
performance

Hướng nghiên cứu

Start with the precision/ probe for Question 1 and the existing W1–W3 benchmarks in precision/; read the method and results referenced in #1 before comparing measurements. Phase 0 can run as a diagnostic on Colab's free v5e; Phase 1 requires TPU quota and approval to spend on Google Cloud. Done when Question 1 is answered, any Phase 1 results are saved under results/<host>/<date>.jsonl, and a summary is posted here.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Google's TPUs have no float64 hardware. This issue records what is known about float64 on a TPU, and sets out a comparison to run on Google Cloud later: what JAX does with float64 there, what each precision costs, and how QuantEcon's JAX workloads run on a TPU against the CPUs and GPUs measured in #1. It is not scheduled: Phase 1 needs a Google Cloud project with TPU quota, and a yes on spend.

What is known (read 2026-11-03)

Source
"TPUs have no true float64 hardware." JAX's float64 accuracy tables cover CPUs and NVIDIA GPUs only, though its platform list includes TPU v2 to v5e, v5p, v6e and TPU7x JAX: accuracy of operations
The matrix unit (MXU) multiplies bfloat16 inputs, with int8 on v5e and v6e and FP8 on v5p and TPU7x, and accumulates in float32 Cloud TPU system architecture
A float32 matmul in JAX runs in bfloat16 on a TPU by default. Full float32 takes precision=jax.lax.Precision.HIGHEST, or jax_default_matmul_precision set to it A JAX maintainer on jax-ml/jax#9973 (2022)
For float64 FFTs, "you may need to use CPU or GPU implementations for now" A JAX maintainer on jax-ml/jax#9881 (2022, still open)

Not documented: what JAX does with a float64 array on a TPU when jax_enable_x64 is on. It could raise an error, compute in float32 behind a float64 dtype, or emulate float64 in software, possibly short of IEEE float64 in precision or range. Question 1 finds out.

Why

  • Readers can pick a TPU. Colab's free tier offers a single v5e chip when one is available (MaxText's guide), beside its free T4, and Colab has added a v6e chip (release notes), though not necessarily on the free tier. A reader who opens a lecture in Colab and picks the TPU runtime gets whatever JAX does there, and for a float64 lecture we don't know what that is.
  • Both precisions are in question. A float64 lecture on a TPU meets the unknown above. A float32 lecture meets bfloat16 matrix products by default, so its printed answers could change although it never asks for float64.
  • Most of lecture-jax's float64 lectures may not need float64. Of the 13, only arellano_jax needs it for its answer (Part 1's summary on #11). That was measured on CPUs and GPUs, where a float32 matrix product is full float32, so it doesn't yet carry over to a TPU.
  • It is the far end of QuantEcon/project-econ-on-ai-hardware's question: hardware built for AI, with no float64 at all.

Questions

  1. What float64 does on a TPU. With jax_enable_x64 on: an error, float32 behind a float64 dtype, or emulation; and the accuracy against CPU float64 of elementwise arithmetic, transcendentals, a matmul, linalg.solve, eigh and an FFT.
  2. What each precision costs, on #1's workloads W1 to W3: float64 if it runs, float32 at HIGHEST, and float32 at the default.
  3. Whether the default changes answers: lecture-jax's float32 lectures, and its float64 lectures run in float32, at the default and at HIGHEST, against their float64 answers on a CPU.
  4. As used: lecture-jax's lectures on a TPU in a fresh process, compile time counted, against the T4 and the M6 from #4. That is the comparison a Colab reader faces: CPU, T4 or TPU.

Workloads

Question Workload
1 A short probe, new, under precision/: the cases in question 1, each result's dtype printed and its error against CPU float64 recorded in ULPs
2 precision/'s W1 to W3 (#1), with matmul precision as an added axis
3 and 4 lectures/whole/'s runner (#4), recording each lecture's answers as #11's method does

Platforms

Device Where Why
TPU v5e, one chip, 16 GB Google Cloud; Colab's free tier for Phase 0 The chip a Colab reader gets
TPU v6e (Trillium), one chip, 32 GB Google Cloud The next generation, with twice the memory
TPU7x (Ironwood) Google Cloud, optional The newest, with FP8
The TPU VM's own CPU The same VM The same-box baseline, as on qe-wharton1-gpu

The comparison points are already in results/: the M6, the T4 and its Xeon, the TITAN RTX, and Phase 2's rented cards. They need no re-run if the JAX release matches.

Method

#1's method holds: one fresh process per cell, cold and warm times apart, the same JAX release everywhere. On a TPU, also:

  • A float64 dtype proves nothing. #1 asserts the result dtype so that a silent float32 can't pass as float64. On a TPU the dtype could say float64 whatever the hardware did, so every float64 cell is checked against CPU float64 as well.
  • Matmul precision is an axis. Run float32 at the default and at HIGHEST, and record jax_default_matmul_precision in each cell's environment block.
  • The environment block adds the TPU generation, the chip count and the libtpu version. Install jax[tpu] at the pinned 0.12.0.1 if libtpu has a matching release; otherwise record the version used.
  • Colab runs are diagnostics, not measurements. The runtime is shared and its JAX comes preinstalled. Question 1's answer can come from Colab; the timings can't.

Phases

  • Phase 0, free: question 1's probe on Colab's free v5e, as a diagnostic. It takes minutes, and its answer decides how much of Phase 1 is worth running.
  • Phase 1, needs a yes on spend: questions 2 to 4 on one v5e chip and one v6e chip on Google Cloud. v5e lists at about USD 1.20 a chip-hour on demand in us-central1 (pricing, 2026-11-03); v6e's price wasn't confirmed. Request TPU quota in the project's region first.
  • Longer term: the TPU Research Cloud gives researchers TPU time free, by application. It is worth applying if TPUs become a platform we re-run on.

What the results would change

If Then
float64 raises an error on a TPU float64 lectures can't run there. A lecture could say so, or choose its device
float64 runs as float32 behind a float64 dtype A silent wrong answer, the worst case. arellano_jax, and any lecture that needs float64, should refuse a TPU
float64 is emulated close to IEEE accuracy It becomes a cost question by kernel type, as on the GPUs, and question 2 answers it
The default matmul precision changes a lecture's printed answers That lecture sets HIGHEST, or says why a TPU's answers differ
A v5e chip beats Colab's T4 on lectures as used Readers could be pointed to Colab's TPU runtime

Done when

Question 1 is answered, from Colab if need be; questions 2 to 4 have results in results/<host>/<date>.jsonl, if Phase 1 runs; and a summary is posted here.

Ngôn ngữ chính
Python
Star
0
Fork
1
Merge trung bình
3 giờ 29 phút
Pull request đã merge (30 ngày)
64

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QuantEcon/benchmarks

Tất cả issue của QuantEcon/benchmarks

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.