Conversation
Author
|
The original reason Run import re
import sys
from pathlib import Path
import jax
label = sys.argv[1] # before or after
# Load the benchmark definitions without running its speed tests.
path = Path("benchmarks/against_scan.py")
source = "\n".join(
line for line in path.read_text().splitlines()
if not line.startswith("speedtest(")
)
benchmark = {}
exec(compile(source, str(path), "exec"), benchmark)
compiled = jax.jit(benchmark["dfx_fn"]).lower(
benchmark["fields"], benchmark["ts"]
).compile()
hlo = compiled.as_text()
Path(f"{label}.raw-hlo.txt").write_text(hlo)
# Exclude module header/source tables and instruction debug metadata.
start = re.search(r"^(?:%|ENTRY %)", hlo, re.MULTILINE).start()
instructions = re.sub(r", metadata=\{[^\n]*?\}", "", hlo[start:])
Path(f"{label}.instructions.txt").write_text(instructions)before the patch with . Then run There should be no difference in instructions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #738
The main issue comes up in the evaluation of
This also shows up in jax-ml/jax#31461 where
jax.ensure_compile_time_evaldoesn't play well with sharding.In this particular case however
ensure_compile_time_eval()makes no difference to optimized code. to reproduce that, run,with
JAX_PLATFORMS=cpu JAX_NUM_CPU_DEVICES=2 PYTHONPATH=. python check_hlo.py beforebefore the patch is applied (Note that before does not have a mesh set, setting a mesh leads to the compilation error described). Then run
JAX_PLATFORMS=cpu JAX_NUM_CPU_DEVICES=2 PYTHONPATH=. python check_hlo.py after diff -u before.instructions.txt after.instructions.txtafter the patch is applied. The instructions show no difference